| 453 | |
| 454 | |
| 455 | def test_tuple_consecutive(): |
| 456 | def before(): |
| 457 | bb = relax.BlockBuilder() |
| 458 | |
| 459 | x = relax.Var("x", R.Tensor((1, 16, 64, 64), "float32")) |
| 460 | with bb.function("main", [x]): |
| 461 | with bb.dataflow(): |
| 462 | lv0 = bb.emit_te(topi.add, x, relax.const(1, "float32")) |
| 463 | lv1 = bb.emit_te(topi.add, x, relax.const(1, "float32")) |
| 464 | lv2 = bb.emit_te(topi.add, x, relax.const(1, "float32")) |
| 465 | lv3 = bb.emit_te(topi.concatenate, (lv0, lv1, lv2), axis=1) |
| 466 | lv4 = bb.emit_te(topi.add, lv3, relax.const(1, "float32")) |
| 467 | lv5 = bb.emit_te(topi.add, x, relax.const(1, "float32")) |
| 468 | lv6 = bb.emit_te(topi.add, x, relax.const(1, "float32")) |
| 469 | lv7 = bb.emit_te(topi.add, x, relax.const(1, "float32")) |
| 470 | lv8 = bb.emit_te(topi.concatenate, (lv5, lv6, lv7), axis=1) |
| 471 | lv9 = bb.emit_te(topi.add, lv8, relax.const(1, "float32")) |
| 472 | lv10 = bb.emit_te(topi.add, x, relax.const(1, "float32")) |
| 473 | lv11 = bb.emit_te(topi.add, x, relax.const(1, "float32")) |
| 474 | lv12 = bb.emit_te(topi.add, x, relax.const(1, "float32")) |
| 475 | lv13 = bb.emit_te(topi.concatenate, (lv10, lv11, lv12), axis=1) |
| 476 | lv14 = bb.emit_te(topi.add, lv13, relax.const(1, "float32")) |
| 477 | lv15 = bb.emit_te(topi.concatenate, (lv4, lv9, lv14), axis=1) |
| 478 | lv16 = bb.emit_te( |
| 479 | topi.nn.pool2d, |
| 480 | lv15, |
| 481 | kernel=(2, 2), |
| 482 | stride=(2, 2), |
| 483 | dilation=(1, 1), |
| 484 | padding=(0, 0, 0, 0), |
| 485 | pool_type="max", |
| 486 | ) |
| 487 | lv17 = bb.emit_te(topi.add, lv16, relax.const(1, "float32")) |
| 488 | lv18 = bb.emit_te(topi.add, lv17, relax.const(1, "float32")) |
| 489 | gv = bb.emit_output((lv17, lv18)) |
| 490 | bb.emit_func_output(gv) |
| 491 | |
| 492 | return bb.get() |
| 493 | |
| 494 | def expected(): |
| 495 | bb = relax.BlockBuilder() |
| 496 | |
| 497 | # Grouped function 1 |
| 498 | x = relax.Var("x", R.Tensor((1, 16, 64, 64), "float32")) |
| 499 | p0 = relax.Var("p0", R.Tensor((), "float32")) |
| 500 | p1 = relax.Var("p1", R.Tensor((), "float32")) |
| 501 | p2 = relax.Var("p2", R.Tensor((), "float32")) |
| 502 | p3 = relax.Var("p3", R.Tensor((), "float32")) |
| 503 | p4 = relax.Var("p4", R.Tensor((), "float32")) |
| 504 | p5 = relax.Var("p5", R.Tensor((), "float32")) |
| 505 | p6 = relax.Var("p6", R.Tensor((), "float32")) |
| 506 | p7 = relax.Var("p7", R.Tensor((), "float32")) |
| 507 | p8 = relax.Var("p8", R.Tensor((), "float32")) |
| 508 | p9 = relax.Var("p9", R.Tensor((), "float32")) |
| 509 | p10 = relax.Var("p10", R.Tensor((), "float32")) |
| 510 | p11 = relax.Var("p11", R.Tensor((), "float32")) |
| 511 | with bb.function( |
| 512 | "fused_add_add_add_concatenate_add1_add_add_add_concatenate_add1_add_add_add_concatenate_add1_concatenate1", |