()
| 284 | |
| 285 | |
| 286 | def test_match_call_attr(): |
| 287 | x = rx.Var("x", R.Tensor("float32")) |
| 288 | y = rx.Var("y", R.Tensor("float32")) |
| 289 | fn = rx.Function([x, y], rx.op.add(x, y), ret_struct_info=R.Tensor("float32")) |
| 290 | annotated_fn = fn.with_attr({"Codegen": "test-codegen", "global_symbol": "test-symbol"}) |
| 291 | xp = is_var("x") |
| 292 | yp = is_var("y") |
| 293 | root_pattern = FunctionPattern([xp, yp], is_op("relax.add")(xp, yp)) |
| 294 | assert root_pattern.has_attr({"Codegen": "test-codegen", "global_symbol": "test-symbol"}).match( |
| 295 | annotated_fn |
| 296 | ) |
| 297 | |
| 298 | assert root_pattern.has_attr({"Codegen": "test-codegen"}).match(annotated_fn) |
| 299 | assert not root_pattern.has_attr({"ping": "pong"}).match(annotated_fn) |
| 300 | assert root_pattern.has_attr({}).match(annotated_fn) |
| 301 | |
| 302 | |
| 303 | def test_is_call_tir(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…