Skip to content

Commit

Permalink
[AutoTVM-FIX] avoid unexpected value(1) of search space when get leng…
Browse files Browse the repository at this point in the history
…th for uninitiated search space (#7175)

* [AutoTVM-FIX] avoid unexpected value(1) of search space when get length for uninitiated search space

* Update python/tvm/autotvm/task/space.py

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

Co-authored-by: ZhaoYanjie <roger.zhao@montage-tech.com>
Co-authored-by: Cody Yu <comaniac0422@gmail.com>
  • Loading branch information
3 people authored Dec 30, 2020
1 parent 466383a commit f2ab977
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/tvm/autotvm/task/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,8 @@ 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 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
Expand Down

0 comments on commit f2ab977

Please sign in to comment.