Small config bug in autotvm

It’s an interesting finding. Could you elaborate a case that __repr__ is invoked before config collection?

On the other hand, your suggested change will make the caching useless, because ConfigSpace._collect is always true. A more safer solution could be like:

def _add_new_transform(self, space_class, name, axes, policy, **kwargs):
    self._length = None
    # do the rest process.

In this way, we “invalid” any existing length when a new knob is added.

Another solution is maintaining the length on the fly:

def __init__(self):
      self._length = 1

def _add_new_transform(self, space_class, name, axes, policy, **kwargs):
      # do the rest process.
     self._length *= len(self._entity_map[name])

def __len__(self):
    return self._length