You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, NumPy has no support for bfloat16. This can easily be checked in the interpreter.
>>> import numpy as np
>>> x = np.random.randn(1)
>>> x.astype("float16")
array([-0.343], dtype=float16)
>>> x.astype("bfloat16")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: data type 'bfloat16' not understood
There is an ongoing discussion in the NumPy repo regarding bfloat16 support. Currently, they are conservative with adopting bfloat16 and are waiting for an external proof-of-concept implementation from the community.
In short, why are we calling np.ndarray.astype("bfloat16") in the to_numpy() conversion? Thank you!
Edit: Another implicit failure comes from array_helpers.py, specifically the array_values() function. The function attempts to return a NumPy array, but when dtype is bfloat16, the return fails:
While examining why test cases were failing for
I realized that the
to_numpy()
function has a special branch for handlingbfloat16
:https://github.com/unifyai/ivy/blob/e4f6cb774f18b8789c99a1ac4df22f342e858764/ivy/functional/backends/torch/general.py#L86-L92
The line I'm struggling to parse is
Currently, NumPy has no support for
bfloat16
. This can easily be checked in the interpreter.There is an ongoing discussion in the NumPy repo regarding
bfloat16
support. Currently, they are conservative with adoptingbfloat16
and are waiting for an external proof-of-concept implementation from the community.In short, why are we calling
np.ndarray.astype("bfloat16")
in theto_numpy()
conversion? Thank you!Edit: Another implicit failure comes from
array_helpers.py
, specifically thearray_values()
function. The function attempts to return a NumPy array, but whendtype
isbfloat16
, the return fails:https://github.com/unifyai/ivy/blob/e4f6cb774f18b8789c99a1ac4df22f342e858764/ivy_tests/test_ivy/helpers/hypothesis_helpers/array_helpers.py#L775
This behavior is observed, for instance, when running
The text was updated successfully, but these errors were encountered: