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/17 03:49:14 UTC

[GitHub] [incubator-tvm] masahi opened a new pull request #6504: [Torch] Clean up usage of try ... infer value() ... except

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


   This is a follow up to https://github.com/apache/incubator-tvm/pull/6449 where some usage of exception-throwing `infer_value` is introduced. Following the discussion there, I attempted to clean up that usage with a new wrapper API. I think this is a reasonable change to add. 
   
   The following API is added. If this looks good, I'll add a doc string.
   ```
   def try_infer_value(val, on_success, on_failure):
       try:
           ret = infer_value(val, {}).asnumpy()
           return on_success(ret), True
       except Exception:
           return on_failure(), False
   ```
   
   please review @kevinthesun @t-vi @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 pull request #6504: [Torch] Clean up usage of try ... infer_value() ... except

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


   @tqchen I got a build error from utvm crt https://ci.tvm.ai/blue/organizations/jenkins/tvm/detail/PR-6504/2/pipeline


----------------------------------------------------------------
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 merged pull request #6504: [Torch] Clean up usage of try ... infer_value() ... except

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


   


----------------------------------------------------------------
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 edited a comment on pull request #6504: [Torch] Clean up usage of try ... infer_value() ... except

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


   @tqchen I got a build error from utvm crt https://ci.tvm.ai/blue/organizations/jenkins/tvm/detail/PR-6504/2/pipeline 
   
   I don't understand why I'm getting an error from a file like `crcccitt.c` that doesn't exist. Maybe a build cache problem?


----------------------------------------------------------------
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] tqchen edited a comment on pull request #6504: [Torch] Clean up usage of try ... infer_value() ... except

Posted by GitBox <gi...@apache.org>.
tqchen edited a comment on pull request #6504:
URL: https://github.com/apache/incubator-tvm/pull/6504#issuecomment-694295666


   @masahi was due to a cmake cache problem that PR has been merged, please retrigger.


----------------------------------------------------------------
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 pull request #6504: [Torch] Clean up usage of try ... infer_value() ... except

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


   Thanks @kevinthesun @yongwww 


----------------------------------------------------------------
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] yongwww commented on a change in pull request #6504: [Torch] Clean up usage of try ... infer_value() ... except

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



##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -36,6 +36,7 @@
 from .common import AttrCvt, get_relay_op
 from .common import infer_shape as _infer_shape
 from .common import infer_value as _infer_value

Review comment:
       ```suggestion
   ```




----------------------------------------------------------------
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 #6504: [Torch] Clean up usage of try ... infer_value() ... except

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



##########
File path: python/tvm/relay/frontend/common.py
##########
@@ -563,6 +563,21 @@ def infer_value_simulated(input_val, params):
     return output_value
 
 
+def try_infer_value(val, on_success, on_failure=None):

Review comment:
       Also made `on_success` optional.




----------------------------------------------------------------
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 #6504: [Torch] Clean up usage of try ... infer_value() ... except

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



##########
File path: python/tvm/relay/frontend/common.py
##########
@@ -563,6 +563,14 @@ def infer_value_simulated(input_val, params):
     return output_value
 
 
+def try_infer_value(val, on_success, on_failure):

Review comment:
       Thanks for the suggestion, I also like this change. Updated.

##########
File path: python/tvm/relay/frontend/common.py
##########
@@ -563,6 +563,21 @@ def infer_value_simulated(input_val, params):
     return output_value
 
 
+def try_infer_value(val, on_success, on_failure=None):

Review comment:
       Also made `on_success` optional.




----------------------------------------------------------------
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] kevinthesun commented on a change in pull request #6504: [Torch] Clean up usage of try ... infer_value() ... except

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



##########
File path: python/tvm/relay/frontend/common.py
##########
@@ -563,6 +563,14 @@ def infer_value_simulated(input_val, params):
     return output_value
 
 
+def try_infer_value(val, on_success, on_failure):

Review comment:
       Can we make these callback to be optional, and just return original value of fail?

##########
File path: python/tvm/relay/frontend/common.py
##########
@@ -563,6 +563,14 @@ def infer_value_simulated(input_val, params):
     return output_value
 
 
+def try_infer_value(val, on_success, on_failure):

Review comment:
       Can we make these callback to be optional, and just return original value if fail?

##########
File path: python/tvm/relay/frontend/common.py
##########
@@ -563,6 +563,21 @@ def infer_value_simulated(input_val, params):
     return output_value
 
 
+def try_infer_value(val, on_success, on_failure=None):

Review comment:
       Similar for ```on_success```?




----------------------------------------------------------------
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] tqchen commented on pull request #6504: [Torch] Clean up usage of try ... infer_value() ... except

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


   @masahi that PR has been merged, please retrigger.


----------------------------------------------------------------
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 #6504: [Torch] Clean up usage of try ... infer_value() ... except

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



##########
File path: python/tvm/relay/frontend/common.py
##########
@@ -563,6 +563,14 @@ def infer_value_simulated(input_val, params):
     return output_value
 
 
+def try_infer_value(val, on_success, on_failure):

Review comment:
       Thanks for the suggestion, I also like this change. Updated.




----------------------------------------------------------------
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] kevinthesun commented on a change in pull request #6504: [Torch] Clean up usage of try ... infer_value() ... except

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



##########
File path: python/tvm/relay/frontend/common.py
##########
@@ -563,6 +563,21 @@ def infer_value_simulated(input_val, params):
     return output_value
 
 
+def try_infer_value(val, on_success, on_failure=None):

Review comment:
       Similar for ```on_success```?




----------------------------------------------------------------
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 #6504: [Torch] Clean up usage of try ... infer_value() ... except

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



##########
File path: python/tvm/relay/frontend/common.py
##########
@@ -563,6 +563,21 @@ def infer_value_simulated(input_val, params):
     return output_value
 
 
+def try_infer_value(val, on_success, on_failure=None):

Review comment:
       Also made `on_success` optional.




----------------------------------------------------------------
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 pull request #6504: [Torch] Clean up usage of try ... infer_value() ... except

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


   Thanks @kevinthesun @yongwww 


----------------------------------------------------------------
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 edited a comment on pull request #6504: [Torch] Clean up usage of try ... infer_value() ... except

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


   @tqchen I got a build error from utvm crt https://ci.tvm.ai/blue/organizations/jenkins/tvm/detail/PR-6504/2/pipeline 
   
   I don't understand why I'm getting an error from a file like `crcccitt.c` that doesn't exist


----------------------------------------------------------------
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] kevinthesun commented on a change in pull request #6504: [Torch] Clean up usage of try ... infer_value() ... except

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



##########
File path: python/tvm/relay/frontend/common.py
##########
@@ -563,6 +563,14 @@ def infer_value_simulated(input_val, params):
     return output_value
 
 
+def try_infer_value(val, on_success, on_failure):

Review comment:
       Can we make these callback to be optional, and just return original value of fail?




----------------------------------------------------------------
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] kevinthesun commented on a change in pull request #6504: [Torch] Clean up usage of try ... infer_value() ... except

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



##########
File path: python/tvm/relay/frontend/common.py
##########
@@ -563,6 +563,21 @@ def infer_value_simulated(input_val, params):
     return output_value
 
 
+def try_infer_value(val, on_success, on_failure=None):

Review comment:
       Similar for ```on_success```?




----------------------------------------------------------------
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] kevinthesun commented on a change in pull request #6504: [Torch] Clean up usage of try ... infer_value() ... except

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



##########
File path: python/tvm/relay/frontend/common.py
##########
@@ -563,6 +563,14 @@ def infer_value_simulated(input_val, params):
     return output_value
 
 
+def try_infer_value(val, on_success, on_failure):

Review comment:
       Can we make these callback to be optional, and just return original value if fail?




----------------------------------------------------------------
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] leandron commented on pull request #6504: [Torch] Clean up usage of try ... infer_value() ... except

Posted by GitBox <gi...@apache.org>.
leandron commented on pull request #6504:
URL: https://github.com/apache/incubator-tvm/pull/6504#issuecomment-694159395


   > @tqchen I got a build error from utvm crt https://ci.tvm.ai/blue/organizations/jenkins/tvm/detail/PR-6504/2/pipeline
   > 
   > I don't understand why I'm getting an error from a file like `crcccitt.c` that doesn't exist. Maybe a build cache problem?
   
   Yeah, I'm seeing the same on my PR 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] [incubator-tvm] masahi merged pull request #6504: [Torch] Clean up usage of try ... infer_value() ... except

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


   


----------------------------------------------------------------
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 #6504: [Torch] Clean up usage of try ... infer_value() ... except

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



##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -36,6 +36,7 @@
 from .common import AttrCvt, get_relay_op
 from .common import infer_shape as _infer_shape
 from .common import infer_value as _infer_value

Review comment:
       this is still used in other places




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