MCPcopy
hub / github.com/apache/tvm / copyto

Method copyto

python/tvm/runtime/_tensor.py:229–245  ·  view source on GitHub ↗

Copy array to target Parameters ---------- target : Tensor The target array to be copied, must have same shape as this array. mem_scope : Optional[str] The memory scope of the array.

(self, target, mem_scope=None)

Source from the content-addressed store, hash-verified

227 return np_arr
228
229 def copyto(self, target, mem_scope=None):
230 """Copy array to target
231
232 Parameters
233 ----------
234 target : Tensor
235 The target array to be copied, must have same shape as this array.
236
237 mem_scope : Optional[str]
238 The memory scope of the array.
239 """
240 if isinstance(target, Tensor):
241 return self._copyto(target)
242 if isinstance(target, tvm_ffi.core.Device):
243 res = empty(self.shape, self.dtype, target, mem_scope)
244 return self._copyto(res)
245 raise ValueError(f"Unsupported target type {type(target)}")
246
247 def _copyto(self, target_nd):
248 """Internal function that implements copy to target ndarray."""

Callers 11

_param_to_tensorFunction · 0.80
__init__Method · 0.80
__call__Method · 0.80
__setitem__Method · 0.80
copyfromMethod · 0.80
test_fp16A_int4B_gemmFunction · 0.80
test_fp16A_int8B_gemmFunction · 0.80
_runFunction · 0.80
my_extern_array_func1Function · 0.80

Calls 2

_copytoMethod · 0.95
emptyFunction · 0.70

Tested by 5

test_fp16A_int4B_gemmFunction · 0.64
test_fp16A_int8B_gemmFunction · 0.64
my_extern_array_func1Function · 0.64