MCPcopy Create free account
hub / github.com/apache/tvm-ffi / check_tensor

Function check_tensor

tests/python/test_function.py:93–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91 assert fadd1.same_as(fadd)
92
93 def check_tensor() -> None:
94 np_data = np.arange(10, dtype="int32")
95 if not hasattr(np_data, "__dlpack__"):
96 return
97 # test Tensor
98 x = tvm_ffi.from_dlpack(np_data)
99 assert isinstance(x, tvm_ffi.Tensor)
100 tensor_result = fecho(x)
101 assert isinstance(tensor_result, tvm_ffi.Tensor)
102 assert tensor_result.shape == (10,)
103 assert tensor_result.dtype == tvm_ffi.dtype("int32")
104 assert tensor_result.device.dlpack_device_type() == tvm_ffi.DLDeviceType.kDLCPU
105 assert tensor_result.device.index == 0
106
107 check_tensor()
108

Callers 1

test_echoFunction · 0.85

Calls 1

dtypeMethod · 0.45

Tested by

no test coverage detected