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

Function verify

tests/python/contrib/test_random.py:38–52  ·  view source on GitHub ↗
(target="llvm")

Source from the content-addressed store, hash-verified

36 A = random.randint(-127, 128, size=(m, n), dtype="int32")
37
38 def verify(target="llvm"):
39 if not tvm.testing.device_enabled(target):
40 print(f"skip because {target} is not enabled...")
41 return
42 if not tvm.get_global_func("tvm.contrib.random.randint", True):
43 print("skip because extern function is not available")
44 return
45 dev = tvm.cpu(0)
46 f = tvm.compile(te.create_prim_func([A]), target=target)
47 a = tvm.runtime.tensor(np.zeros((m, n), dtype=A.dtype), dev)
48 f(a)
49 na = a.numpy()
50 assert abs(np.mean(na)) < 0.3
51 assert np.min(na) == -127
52 assert np.max(na) == 127
53
54 verify()
55

Callers 3

test_randintFunction · 0.70
test_uniformFunction · 0.70
test_normalFunction · 0.70

Calls 12

printFunction · 0.85
get_global_funcMethod · 0.80
numpyMethod · 0.80
meanMethod · 0.80
minMethod · 0.80
maxMethod · 0.80
stdMethod · 0.80
fFunction · 0.50
absFunction · 0.50
cpuMethod · 0.45
compileMethod · 0.45
zerosMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…