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

Function test_vm_shapeof

tests/python/relax/test_vm_execbuilder.py:155–166  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

153
154
155def test_vm_shapeof():
156 ib = relax.ExecBuilder()
157 shape = (32, 16)
158 arr = tvm.runtime.tensor(np.random.rand(*shape))
159 with ib.function("main", num_inputs=0):
160 ib.emit_call("vm.builtin.shape_of", args=[arr], dst=ib.r(0))
161 ib.emit_ret(ib.r(0))
162 ex = ib.get()
163 vm = relax.VirtualMachine(ex, tvm.cpu())
164 res = vm["main"]()
165 for i, s in enumerate(res):
166 assert s == shape[i]
167
168
169def test_vm_storage():

Callers

nothing calls this directly

Calls 6

functionMethod · 0.95
emit_callMethod · 0.95
rMethod · 0.95
emit_retMethod · 0.95
getMethod · 0.95
cpuMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…