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

data attribute raises a ValueError #80

Open
joshlk opened this issue Jun 13, 2023 · 0 comments
Open

data attribute raises a ValueError #80

joshlk opened this issue Jun 13, 2023 · 0 comments

Comments

@joshlk
Copy link

joshlk commented Jun 13, 2023

numpy.ndarray.data attribute doesn't work with ml_dtypes.

bfloat16 example:

from ml_dtypes import bfloat16
x = np.array([0], dtype=bfloat16)
x.data
# ValueError: cannot include dtype 'E' in a buffer

float8_e4m3fnuz example:

from ml_dtypes import float8_e4m3fnuz
x = np.array([0], dtype=float8_e4m3fnuz)
x.data
# ValueError: cannot include dtype 'G' in a buffer

Current workaround is by using the __array_interface__ attribute:

x.__array_interface__['data'][0]

ml_dtypes version: 0.2.0
numpy version: 1.24.3

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