Skip to content

Commit afa1085

Browse files
committed
Add regression test case: test_data_dependent_reshape_without_decompose_ops_is_skipped
1 parent 888c139 commit afa1085

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎tests/python/relax/test_transform_legalize_ops_manipulate.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,25 @@ def reshape(
759759
tvm.ir.assert_structural_equal(out_mod, Expected)
760760

761761

762+
def test_data_dependent_reshape_without_decompose_ops_is_skipped():
763+
# fmt: off
764+
@tvm.script.ir_module
765+
class DDReshape:
766+
@R.function
767+
def main(
768+
x: R.Tensor([2], dtype="int64"),
769+
y: R.Tensor([16],dtype='float32'),
770+
):
771+
lv: R.Shape(ndim=2) = R.tensor_to_shape(x)
772+
gv = R.reshape(y, lv)
773+
return gv
774+
# fmt: on
775+
776+
relax.analysis.well_formed(DDReshape)
777+
out_mod = relax.transform.LegalizeOps()(DDReshape)
778+
tvm.ir.assert_structural_equal(out_mod, DDReshape)
779+
780+
762781
def test_split_by_indices():
763782
# fmt: off
764783
@tvm.script.ir_module

0 commit comments

Comments
 (0)