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

Function save_function_kwargs_trial

tests/python/relax/test_vm_build.py:1185–1191  ·  view source on GitHub ↗
(vm: relax.VirtualMachine, device: tvm.runtime.Device)

Source from the content-addressed store, hash-verified

1183
1184
1185def save_function_kwargs_trial(vm: relax.VirtualMachine, device: tvm.runtime.Device) -> None:
1186 # just checking that we can use kwargs for the args when saving a function
1187 a = tvm.runtime.tensor(np.random.rand(32, 32).astype("float32"), device)
1188 b = tvm.runtime.tensor(np.random.rand(32, 32).astype("float32"), device)
1189 vm.save_function("main", "saved_main", x=a, w=b)
1190 res0 = vm["saved_main"]()
1191 tvm.testing.assert_allclose(res0.numpy(), a.numpy() * b.numpy(), rtol=1e-7, atol=1e-7)
1192
1193
1194def test_save_function_kwargs(exec_mode):

Callers 1

Calls 3

save_functionMethod · 0.80
numpyMethod · 0.80
astypeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…