Skip to content

Conversation

@sisleyli
Copy link
Contributor

If we use the bfloat16 type of ml_dtypes to create an array of tvm.ndarray, the result of the created tvm.ndarray will be wrong.

x = np.random.uniform(low=0.3, high=13.3, size=shape).astype(ml_dtypes.bfloat16)
# The values of x_ndarray and x are inconsistent!
x_ndarray = tvm.nd.array(x)

I understand that the reason for this error is that we have not considered that the input passed in is ml_dtypes.bfloat16. The np_float2np_bf16 function that has been used in the past (this function will convert the fp32 type numpy array into a uint16 numpy array)

@sisleyli
Copy link
Contributor Author

Hi @masahi @Hzfengsy , could you please help me review this PR? Thank you!

@sisleyli
Copy link
Contributor Author

@tvm-bot rerun

@masahi masahi merged commit ccca00a into apache:main Jan 20, 2024
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

Successfully merging this pull request may close these issues.

2 participants