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 promotion behavior with Python scalars changed with NumPy 2 #189

Open
hawkinsp opened this issue Sep 13, 2024 · 0 comments
Open

Type promotion behavior with Python scalars changed with NumPy 2 #189

hawkinsp opened this issue Sep 13, 2024 · 0 comments

Comments

@hawkinsp
Copy link
Collaborator

With NumPy 1.26.4

In [1]: import numpy as np, ml_dtypes

In [2]: np.arange(4, dtype=ml_dtypes.bfloat16) + 10
Out[2]: array([10, 11, 12, 13], dtype=bfloat16)

With NumPy 2.1.0

In [1]: import numpy as np, ml_dtypes

In [2]: np.arange(4, dtype=ml_dtypes.bfloat16) + 10
Out[2]: array([10., 11., 12., 13.], dtype=float32)

A promotion behavior change is not surprising, necessarily, but we'd actually expect the NumPy 1 behavior on NumPy 2, since the type of the scalar should be weak.

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

1 participant