MCPcopy Index your code
hub / github.com/apache/tvm / __setitem__

Method __setitem__

python/tvm/runtime/_tensor.py:78–92  ·  view source on GitHub ↗

Set ndarray value

(self, in_slice, value)

Source from the content-addressed store, hash-verified

76 """
77
78 def __setitem__(self, in_slice, value):
79 """Set ndarray value"""
80 if (
81 not isinstance(in_slice, slice)
82 or in_slice.start is not None
83 or in_slice.stop is not None
84 ):
85 raise ValueError("Array only support set from numpy array")
86 if isinstance(value, Tensor):
87 if not value.same_as(self):
88 value.copyto(self)
89 elif isinstance(value, np.ndarray | np.generic):
90 self.copyfrom(value)
91 else:
92 raise TypeError(f"type {type(value)} not supported")
93
94 def copyfrom(self, source_array):
95 """Perform a synchronous copy from the array.

Callers

nothing calls this directly

Calls 3

copyfromMethod · 0.95
copytoMethod · 0.80
same_asMethod · 0.45

Tested by

no test coverage detected