comaniac commented on a change in pull request #7175:
URL: https://github.com/apache/tvm/pull/7175#discussion_r549814017
##########
File path: python/tvm/autotvm/task/space.py
##########
@@ -836,7 +836,7 @@ def _add_new_transform(self, space_class, name, axes,
policy, **kwargs):
return [Axis(None, i) for i in range(space_class.get_num_output(axes,
policy, **kwargs))]
def __len__(self):
- if self._length is None:
+ if self._length is None and len(self.space_map.values()) != 0:
self._length = int(np.prod([len(x) for x in
self.space_map.values()]))
return self._length
Review comment:
I found that this change is incorrect. `__len__` has to return an
integer, but in this case it will return `None`.
```suggestion
if not self.space_map:
return 0
if self._length is None:
self._length = int(np.prod([len(x) for x in
self.space_map.values()]))
return self._length
```
----------------------------------------------------------------
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:
[email protected]