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] np.ndarray of bfloat16 using ml_dtypes is being interpreted as complex64 #1075

Open
Tracked by #19571
lkarthee opened this issue May 4, 2024 · 0 comments
Open
Tracked by #19571
Labels
bug Something isn't working enhancement New feature or request

Comments

@lkarthee
Copy link

lkarthee commented May 4, 2024

Describe the bug

np.ndarray of bfloat16 using ml_dtypes is being interpreted as complex64 by mlx.

To Reproduce

>>> from ml_dtypes import bfloat16
>>> import numpy as np
>>> x = np.array(1., dtype=bfloat16)
>>> import mlx.core as mx
>>> mx.array(x)
array(1+0j, dtype=complex64)
>>> x = np.array(1)
>>> mx.array(x)
array(1, dtype=int64)
>>> x = np.array(1., dtype=bfloat16)
>>> x.dtype
dtype(bfloat16)
>>> type(x.dtype)
<class 'numpy.dtype[bfloat16]'>
>>>

Expected behavior
Conversion to complex should not happen. Should remain as bfloat16

Desktop (please complete the following information):

  • OS Version: [e.g. MacOS 14.1.2] MacOS 14.1.1
  • Version [e.g. 0.7.0] 0.11

Additional context
Originally posted by @lkarthee in #1066 (comment)

@lkarthee lkarthee changed the title np.ndarray of bfloat16 using ml_dtypes is being interpreted as complex64 by mlx. np.ndarray of bfloat16 using ml_dtypes is being interpreted as complex64 May 4, 2024
@lkarthee lkarthee changed the title np.ndarray of bfloat16 using ml_dtypes is being interpreted as complex64 [BUG] np.ndarray of bfloat16 using ml_dtypes is being interpreted as complex64 May 4, 2024
@awni awni added bug Something isn't working enhancement New feature or request labels May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants