We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d866fd0 commit c3a8c30Copy full SHA for c3a8c30
iree/turbine/aot/support/ir_utils.py
@@ -324,10 +324,11 @@ 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)
+ #detached_tensor = t.detach().contiguous().cpu()
+ #array = np.array(detached_tensor)
+ #array = bytes(detached_tensor.untyped_storage())
331
+ #contents = memoryview(array)
332
blob_name = symbol_name
333
elements_attr = DenseResourceElementsAttr.get_from_buffer(
334
contents, blob_name, tensor_type
0 commit comments