()
| 144 | |
| 145 | |
| 146 | def test_function_pattern(): |
| 147 | wc1 = wildcard() |
| 148 | wc2 = wildcard() |
| 149 | f = FunctionPattern([wc1, wc2], is_op("relax.add")(wc1, wc2)) |
| 150 | assert isinstance(f, FunctionPattern) |
| 151 | assert isinstance(f.params[0], WildcardPattern) |
| 152 | assert isinstance(f.params[1], WildcardPattern) |
| 153 | assert isinstance(f.body, CallPattern) |
| 154 | assert isinstance(f.body.args[0], WildcardPattern) |
| 155 | assert isinstance(f.body.args[1], WildcardPattern) |
| 156 | x = rx.Var("x", R.Tensor("float32")) |
| 157 | y = rx.Var("y", R.Tensor("float32")) |
| 158 | assert f.match(rx.Function([x, y], rx.op.add(x, y), ret_struct_info=R.Tensor("float32"))) |
| 159 | assert not f.match( |
| 160 | rx.Function([x, y], rx.op.multiply(x, y), ret_struct_info=R.Tensor("float32")) |
| 161 | ) |
| 162 | |
| 163 | |
| 164 | def test_tuple_pattern(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…