We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d866fd0 commit 9e00247Copy full SHA for 9e00247
iree/turbine/aot/support/ir_utils.py
@@ -324,12 +324,9 @@ def create_tensor_global(
324
)
325
else:
326
# Emit inline initialized.
327
- detached_tensor = t.detach().contiguous().cpu()
328
- array = np.array(detached_tensor)
329
- # We know that a Numpy array is a ReadableBuffer so ignore type error.
330
- contents = memoryview(array) # type: ignore
+ contents = torch.utils.dlpack.to_dlpack(t)
331
blob_name = symbol_name
332
- elements_attr = DenseResourceElementsAttr.get_from_buffer(
+ elements_attr = DenseResourceElementsAttr.get_from_buffer_ndarray(
333
contents, blob_name, tensor_type
334
335
ir_attrs["initial_value"] = elements_attr
0 commit comments