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

[Bug] Scalar dtype incompatibility with numpy #414

Open
kaushikcfd opened this issue Jan 22, 2023 · 2 comments
Open

[Bug] Scalar dtype incompatibility with numpy #414

kaushikcfd opened this issue Jan 22, 2023 · 2 comments

Comments

@kaushikcfd
Copy link
Collaborator

>>> a_np = np.random.rand(10, 4).astype(np.float32)
>>> np.minimum(a_np, 255).dtype
dtype('float32')
>>> pt.minimum(pt.make_data_wrapper(a_np), 255).dtype
dtype('float64')
@kaushikcfd kaushikcfd changed the title Scalar dtype incompatibility with numpy [Bug] Scalar dtype incompatibility with numpy Jan 22, 2023
@kaushikcfd
Copy link
Collaborator Author

We should probably use np.min_scalar_type in get_common_dtype_of_ary_or_scalars?

@inducer
Copy link
Owner

inducer commented Jan 24, 2023

Jax is another important precedent here. They have put considerable thought into their type promotion semantics. It might be reasonable to follow their lead, which I think might, in this case, match the semantics you're after.

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