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/29 20:57:22 UTC

[GitHub] [tvm] codeislife99 opened a new pull request #7373: Add Support for aten::index

codeislife99 opened a new pull request #7373:
URL: https://github.com/apache/tvm/pull/7373


   This PR adds support for aten::index when indices is a boolean. This case was not supported by the current implementation leading to wrong output shapes in infer_type and other downstream issues. 


----------------------------------------------------------------
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 #7373: Add Support for aten::index

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


   cc @kevinthesun 


----------------------------------------------------------------
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] codeislife99 commented on pull request #7373: Add Support for aten::index

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


   I would be working on this PR soon. The current relay index op needs a major refactor to account for boolean indices. 
   


----------------------------------------------------------------
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] tqchen commented on pull request #7373: Add Support for aten::index

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


   @codeislife99 @kevinthesun it would be great if we can followup :)


----------------------------------------------------------------
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] codeislife99 edited a comment on pull request #7373: Add Support for aten::index

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


   The behaviour is much different right from implementation to output shape size and unique to PyTorch. I was initially thinking of adding this into a new operator similar to aten::masked_select. However there are very slight differences in input and output shapes between `aten::masked_select` and `aten::index + boolean indices` as well , so I had to do this. 
   
   Correction: It seems that numpy also follows the same concepts. 


----------------------------------------------------------------
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] codeislife99 commented on pull request #7373: Add Support for aten::index

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


   @masahi @t-vi @zhiics @anijain2305 PTAL. 


----------------------------------------------------------------
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] trevor-m commented on pull request #7373: Add Support for aten::index

Posted by GitBox <gi...@apache.org>.
trevor-m commented on pull request #7373:
URL: https://github.com/apache/tvm/pull/7373#issuecomment-770098829


   Could we instead add support for boolean to adv_index operator itself? Or is the behavior much different in a way that is unique to Pytorch?


----------------------------------------------------------------
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] codeislife99 edited a comment on pull request #7373: Add Support for aten::index

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


   The behaviour is much different right from implementation to output shape size and unique to PyTorch. I was initially thinking of adding this into a new operator similar to aten::masked_select. However there are very slight differences in input and output shapes between `aten::masked_select` and `aten::index + boolean indices` as well , so I had to do this. 


----------------------------------------------------------------
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] tqchen commented on pull request #7373: Add Support for aten::index

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


   gentle ping @codeislife99 @kevinthesun @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] codeislife99 commented on pull request #7373: Add Support for aten::index

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


   The behaviour is much different right from implementation to output shape size and unique to PyTorch. 


----------------------------------------------------------------
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 #7373: Add Support for aten::index

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


   @codeislife99 Any update on this? Otherwise I'll close it.


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

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] kevinthesun commented on a change in pull request #7373: Add Support for aten::index

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



##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -1855,6 +1855,34 @@ def one_hot(self, inputs, input_types):
     def index(self, inputs, input_types):
         data = inputs[0]
         indices = inputs[1]
+        indices_infered = self.infer_type(indices[0])

Review comment:
       I suggest enhancing relay and topi ```adv_index``` to support this, to be consistent with numpy style advanced indexing. It can be useful for other frontend as well.




----------------------------------------------------------------
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] kevinthesun commented on a change in pull request #7373: Add Support for aten::index

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



##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -1855,6 +1855,34 @@ def one_hot(self, inputs, input_types):
     def index(self, inputs, input_types):
         data = inputs[0]
         indices = inputs[1]
+        indices_infered = self.infer_type(indices[0])

Review comment:
       I suggest enhancing relay and topi ```adv_index``` to support this, to be consistent with numpy style advanced indexing since numpy supports indices to be both integer or bool. It can be useful for other frontend as well.




----------------------------------------------------------------
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 closed pull request #7373: Add Support for aten::index

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


   


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

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org