You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/01/23 00:06:40 UTC

[GitHub] [tvm] mbrookhart opened a new pull request #7332: [PatternLang] Add a relay LetPattern

mbrookhart opened a new pull request #7332:
URL: https://github.com/apache/tvm/pull/7332


   I found myself needing a Let pattern for some object detection work. Thanks for taking a look!
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [tvm] masahi commented on pull request #7332: [PatternLang] Add a relay LetPattern

Posted by GitBox <gi...@apache.org>.
masahi commented on pull request #7332:
URL: https://github.com/apache/tvm/pull/7332#issuecomment-765798515


   I wonder, do we need to match against the let bound variable? Isn't it always `Var`?


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [tvm] masahi edited a comment on pull request #7332: [PatternLang] Add a relay LetPattern

Posted by GitBox <gi...@apache.org>.
masahi edited a comment on pull request #7332:
URL: https://github.com/apache/tvm/pull/7332#issuecomment-765798515


   I wonder, do we need to match against the let bound variable? Isn't it always `Var`? Not sure if relay Let supports pattern destructing on let lhs, like `let (x, y) = ... in body`


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [tvm] masahi commented on pull request #7332: [PatternLang] Add a relay LetPattern

Posted by GitBox <gi...@apache.org>.
masahi commented on pull request #7332:
URL: https://github.com/apache/tvm/pull/7332#issuecomment-765889637


   Thanks @mbrookhart @comaniac 


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [tvm] masahi edited a comment on pull request #7332: [PatternLang] Add a relay LetPattern

Posted by GitBox <gi...@apache.org>.
masahi edited a comment on pull request #7332:
URL: https://github.com/apache/tvm/pull/7332#issuecomment-765798515


   I wonder, do we need to match against the let bound variable? Isn't it always `Var`? Not sure if relay Let supports pattern destructing on let lhs, like `let (x, y) = ... in body` (using OCaml syntax)


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [tvm] mbrookhart edited a comment on pull request #7332: [PatternLang] Add a relay LetPattern

Posted by GitBox <gi...@apache.org>.
mbrookhart edited a comment on pull request #7332:
URL: https://github.com/apache/tvm/pull/7332#issuecomment-765811021


   @masahi I agree the Expr will always be a var, but I wanted to let users match on more complicated attributes like name/dtype/shape/etc, so I left it a general in pattern


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [tvm] comaniac commented on a change in pull request #7332: [PatternLang] Add a relay LetPattern

Posted by GitBox <gi...@apache.org>.
comaniac commented on a change in pull request #7332:
URL: https://github.com/apache/tvm/pull/7332#discussion_r562983099



##########
File path: python/tvm/relay/dataflow_pattern/__init__.py
##########
@@ -579,6 +602,27 @@ def __init__(self, cond: "DFPattern", true_branch: "DFPattern", false_branch: "D
         self.__init_handle_by_constructor__(ffi.IfPattern, cond, true_branch, false_branch)
 
 
+@register_df_node
+class LetPattern(DFPattern):
+    """A patern matching a Relay If.

Review comment:
       ```suggestion
       """A patern matching a Relay Let.
   ```

##########
File path: python/tvm/relay/dataflow_pattern/__init__.py
##########
@@ -337,6 +337,29 @@ def is_if(cond, true_branch, false_branch):
     return IfPattern(cond, true_branch, false_branch)
 
 
+def is_let(var, value, body):
+    """
+    Syntatic sugar for creating an IfPattern.

Review comment:
       ```suggestion
       Syntatic sugar for creating a LetPattern.
   ```




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [tvm] mbrookhart commented on pull request #7332: [PatternLang] Add a relay LetPattern

Posted by GitBox <gi...@apache.org>.
mbrookhart commented on pull request #7332:
URL: https://github.com/apache/tvm/pull/7332#issuecomment-765811021


   @masahi I agree the Expr will always be a var, but I wanted to let users match on more complicated attributes like name/style/shape/etc, so I left it a general in pattern


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [tvm] masahi merged pull request #7332: [PatternLang] Add a relay LetPattern

Posted by GitBox <gi...@apache.org>.
masahi merged pull request #7332:
URL: https://github.com/apache/tvm/pull/7332


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [tvm] masahi edited a comment on pull request #7332: [PatternLang] Add a relay LetPattern

Posted by GitBox <gi...@apache.org>.
masahi edited a comment on pull request #7332:
URL: https://github.com/apache/tvm/pull/7332#issuecomment-765798515


   I wonder, do we need to match against the let bound variable? Isn't it always `Var`? Not sure if relay Let supports pattern destructing on let lhs, like `let (x, y) = ... in body` 


----------------------------------------------------------------
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:
users@infra.apache.org