Test fusion case where Tuple node is the root in its group
()
| 242 | |
| 243 | |
| 244 | def test_tuple_root(): |
| 245 | """Test fusion case where Tuple node is the root in its group""" |
| 246 | |
| 247 | def before(): |
| 248 | bb = relax.BlockBuilder() |
| 249 | x = relax.Var("x", R.Tensor((1, 16, 64, 64), "float32")) |
| 250 | with bb.function("main", [x]): |
| 251 | with bb.dataflow(): |
| 252 | lv0 = bb.emit_te( |
| 253 | topi.nn.pool2d, |
| 254 | x, |
| 255 | kernel=(2, 2), |
| 256 | stride=(2, 2), |
| 257 | dilation=(1, 1), |
| 258 | padding=(0, 0, 0, 0), |
| 259 | pool_type="max", |
| 260 | ) |
| 261 | lv1 = bb.emit_te(topi.nn.upsampling, lv0, scale_h=2.0, scale_w=2.0) |
| 262 | gv = bb.emit_output((lv1, x)) |
| 263 | bb.emit_func_output(gv) |
| 264 | |
| 265 | return bb.get() |
| 266 | |
| 267 | # The fusion is supposed to make no change. |
| 268 | _check(before(), before()) |
| 269 | |
| 270 | |
| 271 | def test_fuse_tuple_get_elemwise(): |