MCPcopy Create free account
hub / github.com/apache/tvm / test_emit_cache

Function test_emit_cache

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

Source from the content-addressed store, hash-verified

98
99
100def test_emit_cache():
101 ib = relax.ExecBuilder()
102
103 with ib.function("func0", num_inputs=1):
104 x0 = ib.convert_constant("str0")
105 x1 = ib.convert_constant("str0")
106 # cache constant str
107 assert x0 == x1
108 s0 = ib.convert_constant(tvm_ffi.Shape([1, 2]))
109 s1 = ib.convert_constant(tvm_ffi.Shape([1, 2]))
110 s2 = ib.convert_constant(tvm_ffi.Shape([1, 3]))
111 assert s0 == s1
112 assert s1 != s2
113 y0 = ib.convert_constant(tvm.runtime.tensor(np.array([1, 2, 3]).astype("int32")))
114 y1 = ib.convert_constant(tvm.runtime.tensor(np.array([1, 2, 3]).astype("int32")))
115 assert y0 == y1
116 ib.emit_ret(ib.r(0))
117
118
119def test_vm_formalize():

Callers

nothing calls this directly

Calls 6

functionMethod · 0.95
convert_constantMethod · 0.95
emit_retMethod · 0.95
rMethod · 0.95
ShapeMethod · 0.80
astypeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…