MCPcopy
hub / github.com/apache/tvm / verify

Function verify

tests/python/contrib/test_cblas.py:59–91  ·  view source on GitHub ↗
(target="llvm")

Source from the content-addressed store, hash-verified

57 return f
58
59 def verify(target="llvm"):
60 if not tvm.testing.device_enabled(target):
61 print(f"skip because {target} is not enabled...")
62 return
63 if not tvm.get_global_func(lib.__name__ + ".matmul", True):
64 print("skip because extern function is not available")
65 return
66 dev = tvm.cpu(0)
67 name = "test_matmul_add"
68 f = tvm.compile(
69 te.create_prim_func([input1_data, input2_data, final_result, bias]).with_attr(
70 "global_symbol", name
71 ),
72 target=target,
73 )
74 if target == "c":
75 f = compiling(f, name)
76 matrix_input1 = tvm.runtime.tensor(
77 np.random.uniform(size=ashape).astype(input1_data.dtype), dev
78 )
79 matrix_input2 = tvm.runtime.tensor(
80 np.random.uniform(size=bshape).astype(input2_data.dtype), dev
81 )
82 matrix_result = tvm.runtime.tensor(
83 np.zeros((matrix_n, matrix_m), dtype=final_result.dtype), dev
84 )
85 matrix_bias = 10.0
86 f(matrix_input1, matrix_input2, matrix_result, matrix_bias)
87 tvm.testing.assert_allclose(
88 matrix_result.numpy(),
89 get_numpy(matrix_input1.numpy(), matrix_input2.numpy(), matrix_bias, transa, transb),
90 rtol=1e-5,
91 )
92
93 verify("llvm")
94 verify("c")

Callers 3

verify_matmul_addFunction · 0.70
verify_batch_matmulFunction · 0.70

Calls 12

printFunction · 0.85
compilingFunction · 0.85
get_global_funcMethod · 0.80
uniformMethod · 0.80
numpyMethod · 0.80
get_numpyFunction · 0.70
fFunction · 0.50
cpuMethod · 0.45
compileMethod · 0.45
with_attrMethod · 0.45
astypeMethod · 0.45
zerosMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…