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

Function verify

tests/python/relax/test_codegen_coreml.py:69–89  ·  view source on GitHub ↗
(mod, inputs)

Source from the content-addressed store, hash-verified

67
68
69def verify(mod, inputs):
70 from tvm.relax.backend.metal.coreml import partition_for_coreml
71
72 mod1 = partition_for_coreml(mod)
73 mod1 = relax.transform.RunCodegen()(mod1)
74 relax.analysis.well_formed(mod1)
75 assert mod1.attrs, "Should exist if offloaded successfully."
76 assert "external_mods" in mod1.attrs, "Should exist if offloaded successfully."
77 mod1 = relax.transform.LegalizeOps()(mod1)
78 relax.analysis.well_formed(mod1)
79
80 ex1 = tvm.compile(mod1, target=target)
81 vm1 = relax.VirtualMachine(ex1, dev)
82 out1 = vm1["main"](*inputs)
83
84 mod2 = relax.transform.LegalizeOps()(mod)
85 ex2 = tvm.compile(mod2, target=target)
86 vm2 = relax.VirtualMachine(ex2, dev)
87 out2 = vm2["main"](*inputs)
88
89 tvm.testing.assert_allclose(out1.numpy(), out2.numpy(), rtol=1e-3, atol=1e-3)
90
91
92@requires_coreml_runtime

Callers 13

test_addFunction · 0.70
test_add_constFunction · 0.70
test_multiplyFunction · 0.70
test_matmulFunction · 0.70
test_clipFunction · 0.70
test_expand_dimsFunction · 0.70
test_reluFunction · 0.70
test_batch_flattenFunction · 0.70
test_softmaxFunction · 0.70
test_conv2dFunction · 0.70
test_global_avg_pool2dFunction · 0.70
test_subgraph1Function · 0.70

Calls 3

partition_for_coremlFunction · 0.90
numpyMethod · 0.80
compileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…