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


With regards,
Apache Git Services

Reply via email to