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

Function test_emit

tests/python/relax/test_testing_nn.py:27–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25
26
27def test_emit():
28 class ReLU(nn.Module):
29 def forward(self, input: relax.Expr) -> relax.Var:
30 return nn.emit(relax.op.nn.relu(input))
31
32 @I.ir_module
33 class Expected:
34 @R.function
35 def main(x: R.Tensor((32, 32), dtype="float32")) -> R.Tensor((32, 32), dtype="float32"):
36 gv: R.Tensor((32, 32), dtype="float32") = R.nn.relu(x)
37 return gv
38
39 bb = relax.BlockBuilder()
40 with bb.function("main"):
41 model = ReLU()
42 x = nn.Placeholder((32, 32), dtype="float32", name="x")
43 output = model(x)
44 params = [x] + model.parameters()
45 bb.emit_func_output(output, params)
46
47 tvm.ir.assert_structural_equal(bb.get(), Expected)
48
49
50def test_get_param():

Callers

nothing calls this directly

Calls 5

functionMethod · 0.95
emit_func_outputMethod · 0.95
getMethod · 0.95
ReLUClass · 0.70
parametersMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…