()
| 42 | |
| 43 | |
| 44 | def test_var(): |
| 45 | # Error: Var gv0 is not defined |
| 46 | gv0 = rx.Var("gv0", R.Tensor([m, n], "float32")) |
| 47 | gv1 = rx.Var("gv1", R.Tensor([m, n], "float32")) |
| 48 | call_node = rx.op.add(x, gv0) |
| 49 | bindings = [rx.VarBinding(gv1, call_node)] |
| 50 | blocks = [rx.BindingBlock(bindings)] |
| 51 | func = build_function(blocks) |
| 52 | mod = tvm.IRModule({rx.GlobalVar("foo"): func}) |
| 53 | assert not rx.analysis.check_well_formed(mod, check_struct_info=False) |
| 54 | |
| 55 | # Error: Var gv0 is defined more than once |
| 56 | gv0 = rx.Var("gv0", R.Tensor([m, n], "float32")) |
| 57 | call_node = rx.op.add(x, x) |
| 58 | call_node2 = rx.op.multiply(x, x) |
| 59 | bindings = [rx.VarBinding(gv0, call_node), rx.VarBinding(gv0, call_node2)] |
| 60 | blocks = [rx.BindingBlock(bindings)] |
| 61 | func = build_function(blocks) |
| 62 | mod = tvm.IRModule({rx.GlobalVar("foo"): func}) |
| 63 | assert not rx.analysis.check_well_formed(mod, check_struct_info=False) |
| 64 | |
| 65 | |
| 66 | def test_dataflow_var(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…