When try to apply a pattern on a control flow IR, it crashes
Is it expected? Should I get data flow block before using rewrite or partition or is pattern language supposed to work in each data flow block? This is the patch to reproduce ``` diff --git a/tests/python/frontend/tensorflow/test_control_flow.py b/tests/python/frontend/tensorflow/test_control_flow.py index 9777a8dc4..e80cda65c 100644 --- a/tests/python/frontend/tensorflow/test_control_flow.py +++ b/tests/python/frontend/tensorflow/test_control_flow.py @@ -25,10 +25,22 @@ import numpy as np from tvm import nd from tvm import relay from tvm.relay.frontend.tensorflow import from_tensorflow +from tvm.relay.dataflow_pattern import * +add_pattern = is_op('add')(wildcard(), wildcard()) +sub_pattern = is_op('subtract')(wildcard(), wildcard()) +class TestRewrite(DFPatternCallback): + def __init__(self): + self.pattern = add_pattern + def callback(self, pre, post, node_map): + return post.args[0] - post.args[1] + def check_equal(graph, tf_out, input_map=None): mod, params = from_tensorflow(graph.as_graph_def(add_shapes=True)) + + partition(TestRewrite().pattern, mod['main'].body) + if input_map is not None: params.update(input_map) ex = relay.create_executor('vm', mod=mod) ``` Thanks --- [Visit Topic](https://discuss.tvm.ai/t/rfc-relay-program-matching-for-relay-pt-1-a-pattern-language/5833/29) to respond. You are receiving this because you enabled mailing list mode. To unsubscribe from these emails, [click here](https://discuss.tvm.ai/email/unsubscribe/bd9c7169d4ab5d8c2be53f895a93eda85d3a8596347056c5381c5fd28be4ed48).