mbrookhart commented on issue #5231: [POC] Pattern Language, Matcher, and 
Rewriter V0
URL: https://github.com/apache/incubator-tvm/pull/5231#issuecomment-614321103
 
 
   Yes! Fuzzy diamond matching as long as all of the nodes between the parent 
and the child all match the path pattern.
   
   Just added this unit test, will upstream it with the refactor:
   ```
       # Fuzzy path/nested Diamond
       is_conv2d = is_op('nn.conv2d')(wildcard(), wildcard())
       is_unary_elemwise = (wildcard().has_attr("TOpPattern", 
K_ELEMWISE))(wildcard()) | is_op('add')(wildcard(), wildcard())
       reduction = is_op('add')(wildcard(), wildcard())
       diamond = dominates(is_conv2d, is_unary_elemwise, reduction)
   
       inp = relay.var('input')
       weight = relay.var('weight')
       conv2d = relay.op.nn.conv2d(inp, weight)
       relu = relay.op.nn.relu(conv2d)
       relu = relu + relu
       tanh = relay.op.tanh(relu)
       leaky_relu = relay.op.nn.leaky_relu(conv2d, alpha=0)
       out = tanh + leaky_relu
   
       assert diamond.match(out)
   ```
   Any patterns in particular you want to see tested?
   
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to