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 2020/09/01 09:46:56 UTC

[GitHub] [incubator-tvm] masahi opened a new pull request #6372: [Torch] Fix aten::max and aten::min conversion

masahi opened a new pull request #6372:
URL: https://github.com/apache/incubator-tvm/pull/6372


   This is a fix for the issue found by hummingbird project
   https://github.com/microsoft/hummingbird/issues/232#issuecomment-684142388
   
   torch.max and min have 3 cases to handle, but we have conversion only for one of the cases. 
   https://pytorch.org/docs/stable/generated/torch.max.html
   
   Also added a conversion for `leaky_relu_`
   
   please review @siju-samuel  


----------------------------------------------------------------
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] [incubator-tvm] masahi commented on a change in pull request #6372: [Torch] Fix aten::max and aten::min conversion

Posted by GitBox <gi...@apache.org>.
masahi commented on a change in pull request #6372:
URL: https://github.com/apache/incubator-tvm/pull/6372#discussion_r481023537



##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -132,6 +132,32 @@ def _impl(inputs, input_types):
     return _impl
 
 
+def _min_max_common(name_elemwise, name_reduce):
+    def _impl(inputs, input_types):
+        if len(inputs) == 1:
+            data = _pytorch_promote_types(inputs[:1], input_types[:1])
+            return get_relay_op(name_reduce)(data[0])
+        elif len(inputs) >= 2 and isinstance(inputs[1], int):
+            data = _pytorch_promote_types(inputs[:1], input_types[:1])
+            dim = inputs[1]
+            keepdims = inputs[2] if len(inputs) > 2 else False
+            print(dim, keepdims)

Review comment:
       oops, thanks. fixed




----------------------------------------------------------------
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] [incubator-tvm] t-vi commented on a change in pull request #6372: [Torch] Fix aten::max and aten::min conversion

Posted by GitBox <gi...@apache.org>.
t-vi commented on a change in pull request #6372:
URL: https://github.com/apache/incubator-tvm/pull/6372#discussion_r481018683



##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -132,6 +132,32 @@ def _impl(inputs, input_types):
     return _impl
 
 
+def _min_max_common(name_elemwise, name_reduce):
+    def _impl(inputs, input_types):
+        if len(inputs) == 1:
+            data = _pytorch_promote_types(inputs[:1], input_types[:1])
+            return get_relay_op(name_reduce)(data[0])
+        elif len(inputs) >= 2 and isinstance(inputs[1], int):
+            data = _pytorch_promote_types(inputs[:1], input_types[:1])
+            dim = inputs[1]
+            keepdims = inputs[2] if len(inputs) > 2 else False
+            print(dim, keepdims)

Review comment:
       I don't think we want to keep this print.




----------------------------------------------------------------
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] [incubator-tvm] siju-samuel commented on pull request #6372: [Torch] Fix aten::max and aten::min conversion

Posted by GitBox <gi...@apache.org>.
siju-samuel commented on pull request #6372:
URL: https://github.com/apache/incubator-tvm/pull/6372#issuecomment-684861788


   Thanks @masahi @t-vi . This is now merged.


----------------------------------------------------------------
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