()
| 106 | |
| 107 | |
| 108 | def test_match_cast() -> None: |
| 109 | # match_cast([16, 8], [m, n]) |
| 110 | m = tirx.Var("m", dtype="int64") |
| 111 | n = tirx.Var("n", dtype="int64") |
| 112 | shape = rx.const([16, 8], "int32") |
| 113 | var = rx.Var("v0", R.Shape()) |
| 114 | b0 = rx.MatchCast(var, shape, R.Tensor([m, n], "int32")) |
| 115 | assert b0.value == shape |
| 116 | assert b0.pattern[0] == m |
| 117 | assert b0.pattern[1] == n |
| 118 | assert b0.var is not None |
| 119 | |
| 120 | # var1: R.Tensor((m, n), "float32") = |
| 121 | # match_cast(var0: R.Tensor("float32", ndim=-1), R.Tensor((m, n), "float32")) |
| 122 | value = rx.Var("value", R.Tensor("float32", ndim=-1)) |
| 123 | |
| 124 | var = rx.Var("v1", R.Tensor([m, n], "float32")) |
| 125 | b1 = rx.MatchCast(var, value, R.Tensor([m, n], "float32")) |
| 126 | assert b1.value == value |
| 127 | assert b1.pattern[0] == m |
| 128 | assert b1.pattern[1] == n |
| 129 | assert b1.var is not None |
| 130 | |
| 131 | |
| 132 | def test_match_cast() -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…