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

Fix Bfloat16 support in iree-turbine #4

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions iree/turbine/aot/support/ir_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,9 @@ def create_tensor_global(
)
else:
# Emit inline initialized.
detached_tensor = t.detach().contiguous().cpu()
array = np.array(detached_tensor)
# We know that a Numpy array is a ReadableBuffer so ignore type error.
contents = memoryview(array) # type: ignore
contents = torch.utils.dlpack.to_dlpack(t)
blob_name = symbol_name
elements_attr = DenseResourceElementsAttr.get_from_buffer(
elements_attr = DenseResourceElementsAttr.get_from_ndarray(
contents, blob_name, tensor_type
)
ir_attrs["initial_value"] = elements_attr
Expand Down
Loading