| 141 | |
| 142 | |
| 143 | def test_binding_block() -> None: |
| 144 | m = tirx.Var("m", dtype="int64") |
| 145 | n = tirx.Var("n", dtype="int64") |
| 146 | shape = rx.const([16, 8], "int32") |
| 147 | b0 = rx.MatchCast(rx.Var("v0"), shape, R.Tensor([m, n], "int32")) |
| 148 | |
| 149 | v0 = rx.Var("v0") |
| 150 | val = rx.const(np.random.rand(24, 56)) |
| 151 | b1 = rx.VarBinding(v0, val) |
| 152 | |
| 153 | block0 = rx.BindingBlock([b0, b1]) |
| 154 | block0_str = dump_ast(block0) |
| 155 | assert block0_str.startswith("BindingBlock(") |
| 156 | assert "bindings=" in block0_str |
| 157 | assert "VarBinding(" in block0_str |
| 158 | assert "MatchCast(" in block0_str |
| 159 | assert '"v0"' in block0_str |
| 160 | |
| 161 | |
| 162 | def test_dataflow_block() -> None: |