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

[Tracking] Use NumPy bfloat16 directly to make bf16 tensors after it has supported bf16 #4273

Open
jcwchen opened this issue Jun 14, 2022 · 1 comment
Labels
enhancement Request for new feature or operator tracking Tracking issues utility

Comments

@jcwchen
Copy link
Member

jcwchen commented Jun 14, 2022

Feature Request

System information

ONNX version (you are using): 1.12

What is the problem that this feature solves?

It's more straightforward/easy to use bfloat16 type to create bfloat16 tensors, which can prevent some confusion. Currently TensorProto.BFLOAT16 is the only one which does not use the same type from NumPy.

Describe the alternatives you have considered

The current method is using numpy.dtype('float32') and then converting it to uint16 values for ONNX, because native NumPy does not support bfloat16 yet: numpy/numpy#19808.

Describe the feature

After native NumPy has supported bfloat16, ideally ONNX's make_tensor should directly use numpy.dtype('bfloat16') to create bfloat16 tensors. Create this PR for tracking. We need to keep float32 to create bfloat16 tensors for compatibility and deprecate it sometime in the later future.

Will this influence the current api?

In the beginning, ONNX should keep the both ways (float32 and bfloat16) for making bfloat16 tensors. After announcing that ONNX will deprecate float32 way to create bfloat16 tensors, then probably in later future make_tensor will only use numpy.dtype('bfloat16') to create bfloat16 tensors instead of numpy.dtype('float32')

Feature Area

Which area in ONNX does this impact? (e.g. model usage, backend, best practices, converters, shape_inference, version_converter, training, test, operators):
Utility

Are you willing to contribute it (Y/N):

Y

@jcwchen jcwchen added enhancement Request for new feature or operator tracking Tracking issues utility labels Jun 14, 2022
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 8, 2023
@jcwchen
Copy link
Member Author

jcwchen commented Jul 8, 2023

Still valid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Request for new feature or operator tracking Tracking issues utility
Projects
None yet
Development

No branches or pull requests

1 participant