Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type casting error on compile #27

Closed
fonnesbeck opened this issue Jan 2, 2023 · 2 comments
Closed

Type casting error on compile #27

fonnesbeck opened this issue Jan 2, 2023 · 2 comments

Comments

@fonnesbeck
Copy link
Member

Despite having set floatX = pytensor.config.floatX = "float32", I'm getting type conversion errors when compiling some models. I have also checked to ensure that all data are float32 or int32

File ~/mambaforge/envs/pymc/lib/python3.10/site-packages/pytensor/tensor/type.py:272, in TensorType.filter_variable(self, other, allow_convert)
    269     if other2 is not None:
    270         return other2
--> 272 raise TypeError(
    273     f"Cannot convert Type {other.type} "
    274     f"(of Variable {other}) into Type {self}. "
    275     f"You can try to manually convert {other} into a {self}."
    276 )

TypeError: Cannot convert Type TensorType(float64, ()) (of Variable Reshape{0}.0) into Type TensorType(float32, ()). You can try to manually convert Reshape{0}.0 into a TensorType(float32, ()).
``

Unfortunately, the traceback does not provide sufficient feedback to isolate which line of model code is responsible for the error.
@fonnesbeck fonnesbeck changed the title Type conversion error on compile Type casting error on compile Jan 2, 2023
@aseyboldt
Copy link
Member

I didn't really test float32 things at all yet. Sounds like what's happening is that nutpie itself currently only works with float64, and passes those into the logp function. I think numba is smart enough to handle that (although I woudn't be surprised if there are corner cases where things won't compile). But the aesara function that computes deterministics now receives float64 values, even though it expects float32.

@aseyboldt
Copy link
Member

Closing in favor of #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants