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/01/27 17:38:06 UTC

[GitHub] [incubator-tvm] wpan11nv opened a new pull request #4779: [AUTOTVM] Fix a bug in generating the search space

wpan11nv opened a new pull request #4779: [AUTOTVM] Fix a bug in generating the search space
URL: https://github.com/apache/incubator-tvm/pull/4779
 
 
   - Do not use numpy.prod which ignores integer (64 bits) overflows.
     This leads to an incorrect number of points in the search space.
   
   Thanks for contributing to TVM!   Please refer to guideline https://docs.tvm.ai/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @ them in the pull request thread.
   

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


With regards,
Apache Git Services

[GitHub] [incubator-tvm] wpan11nv commented on a change in pull request #4779: [AUTOTVM] Fix a bug in generating the search space

Posted by GitBox <gi...@apache.org>.
wpan11nv commented on a change in pull request #4779: [AUTOTVM] Fix a bug in generating the search space
URL: https://github.com/apache/incubator-tvm/pull/4779#discussion_r371417185
 
 

 ##########
 File path: python/tvm/autotvm/task/space.py
 ##########
 @@ -226,7 +226,13 @@ def __init__(self, axes, policy, **kwargs):
     def _generate_space(self, now, tmp_stack, enforce_no_tail=False):
         """Generate space by DFS"""
         if now == self.num_output - 1:
-            prod = np.prod(tmp_stack, dtype=np.int64)
+            prod = 1
 
 Review comment:
   It looks more pythonic. The number of lines will be similar. Here is one debate on this: :) 
   
   https://stackoverflow.com/questions/9474412/python-alternative-to-reduce

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


With regards,
Apache Git Services

[GitHub] [incubator-tvm] wpan11nv commented on issue #4779: [AUTOTVM] Fix a bug in generating the search space

Posted by GitBox <gi...@apache.org>.
wpan11nv commented on issue #4779: [AUTOTVM] Fix a bug in generating the search space
URL: https://github.com/apache/incubator-tvm/pull/4779#issuecomment-579362580
 
 
   Please help review this patch.

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


With regards,
Apache Git Services

[GitHub] [incubator-tvm] merrymercy merged pull request #4779: [AUTOTVM] Fix a bug in generating the search space

Posted by GitBox <gi...@apache.org>.
merrymercy merged pull request #4779: [AUTOTVM] Fix a bug in generating the search space
URL: https://github.com/apache/incubator-tvm/pull/4779
 
 
   

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


With regards,
Apache Git Services

[GitHub] [incubator-tvm] comaniac commented on a change in pull request #4779: [AUTOTVM] Fix a bug in generating the search space

Posted by GitBox <gi...@apache.org>.
comaniac commented on a change in pull request #4779: [AUTOTVM] Fix a bug in generating the search space
URL: https://github.com/apache/incubator-tvm/pull/4779#discussion_r371422539
 
 

 ##########
 File path: python/tvm/autotvm/task/space.py
 ##########
 @@ -226,7 +226,13 @@ def __init__(self, axes, policy, **kwargs):
     def _generate_space(self, now, tmp_stack, enforce_no_tail=False):
         """Generate space by DFS"""
         if now == self.num_output - 1:
-            prod = np.prod(tmp_stack, dtype=np.int64)
+            prod = 1
 
 Review comment:
   Well, I know that some people prevent `reduce` and other patterns like `map` from being used in Python 3, although I personally think not like `map` and `filter`, `reduce` is hard to be replaced by other pythonic representations. I am fine with that if you do not want to introduce `reduce` to the code. In this case I would suggest making this logic a standalone function in `autotvm/util.py`.

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


With regards,
Apache Git Services

[GitHub] [incubator-tvm] comaniac commented on a change in pull request #4779: [AUTOTVM] Fix a bug in generating the search space

Posted by GitBox <gi...@apache.org>.
comaniac commented on a change in pull request #4779: [AUTOTVM] Fix a bug in generating the search space
URL: https://github.com/apache/incubator-tvm/pull/4779#discussion_r371397521
 
 

 ##########
 File path: python/tvm/autotvm/task/space.py
 ##########
 @@ -226,7 +226,13 @@ def __init__(self, axes, policy, **kwargs):
     def _generate_space(self, now, tmp_stack, enforce_no_tail=False):
         """Generate space by DFS"""
         if now == self.num_output - 1:
-            prod = np.prod(tmp_stack, dtype=np.int64)
+            prod = 1
 
 Review comment:
   It seems to me that manually implementing a classic array production is not necessary in any case. Since limited types are only enforced in numpy and Python's types are unlimited, it would be more concise to use Python builtins to calculate the product:
   ```python
   import functools
   import operator
   prod = functools.reduce(operator.mul, tmp_stack, 1)
   ```
   
   Note that the length of `tmp_stack` is always small (currently 4 at most, and I don't think it would be longer than 10), so this won't hurt the performance.

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


With regards,
Apache Git Services

[GitHub] [incubator-tvm] comaniac commented on a change in pull request #4779: [AUTOTVM] Fix a bug in generating the search space

Posted by GitBox <gi...@apache.org>.
comaniac commented on a change in pull request #4779: [AUTOTVM] Fix a bug in generating the search space
URL: https://github.com/apache/incubator-tvm/pull/4779#discussion_r371422539
 
 

 ##########
 File path: python/tvm/autotvm/task/space.py
 ##########
 @@ -226,7 +226,13 @@ def __init__(self, axes, policy, **kwargs):
     def _generate_space(self, now, tmp_stack, enforce_no_tail=False):
         """Generate space by DFS"""
         if now == self.num_output - 1:
-            prod = np.prod(tmp_stack, dtype=np.int64)
+            prod = 1
 
 Review comment:
   Well, I know that some people prevent `reduce` and other patterns like `map` from being used in Python 3, although I personally think not like `map` and `filter`, `reduce` is hard to be replaced by other pythonic representation. I am fine with that if you do not want to introduce `reduce` to the code. In this case I would suggest making this logic a standalone function in `autotvm/util.py`.

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


With regards,
Apache Git Services

[GitHub] [incubator-tvm] wpan11nv commented on a change in pull request #4779: [AUTOTVM] Fix a bug in generating the search space

Posted by GitBox <gi...@apache.org>.
wpan11nv commented on a change in pull request #4779: [AUTOTVM] Fix a bug in generating the search space
URL: https://github.com/apache/incubator-tvm/pull/4779#discussion_r371466338
 
 

 ##########
 File path: python/tvm/autotvm/task/space.py
 ##########
 @@ -226,7 +226,13 @@ def __init__(self, axes, policy, **kwargs):
     def _generate_space(self, now, tmp_stack, enforce_no_tail=False):
         """Generate space by DFS"""
         if now == self.num_output - 1:
-            prod = np.prod(tmp_stack, dtype=np.int64)
+            prod = 1
 
 Review comment:
   Utility function looks like a overkill. A reduce call is fine. Updated. Thanks!

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


With regards,
Apache Git Services