tvm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [incubator-tvm] lixiaoquan commented on pull request #5656: [BYOC] Pattern Language MergeComposite
Date Wed, 27 May 2020 03:47:40 GMT

lixiaoquan commented on pull request #5656:

   Original MergeComposite can apply on any IR, but PatternLang seems can't do that yet.
   I run into a issue that if try to match a pattern on IR containing control flow, it will
hang or crash.
   diff --git a/tests/python/frontend/tensorflow/ b/tests/python/frontend/tensorflow/
   index 9777a8dc4..e80cda65c 100644
   --- a/tests/python/frontend/tensorflow/
   +++ b/tests/python/frontend/tensorflow/
   @@ -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:
        ex = relay.create_executor('vm', mod=mod)

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:

View raw message