()
| 25 | |
| 26 | |
| 27 | def 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 | |
| 50 | def test_get_param(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…