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

Function test_vm_operand

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

Source from the content-addressed store, hash-verified

133
134
135def test_vm_operand():
136 ib0 = relax.ExecBuilder()
137 with ib0.function("func0", num_inputs=2):
138 ib0.emit_call("test.vm.add_scalar", args=[ib0.r(0), ib0.r(1)], dst=ib0.r(2))
139 ib0.emit_ret(ib0.r(2))
140 exec0 = ib0.get()
141 vm = relax.VirtualMachine(exec0, tvm.cpu())
142 res = vm["func0"](2, 3)
143 assert res == 5
144
145 ib1 = relax.ExecBuilder()
146 with ib1.function("func1", num_inputs=1):
147 ib1.emit_call("test.vm.get_device_id", args=[ib1.r(0)], dst=ib1.r(1))
148 ib1.emit_ret(ib1.r(1))
149 exec1 = ib1.get()
150 vm = relax.VirtualMachine(exec1, tvm.cpu())
151 res = vm["func1"](tvm.cpu(3))
152 assert res == 3
153
154
155def test_vm_shapeof():

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…