# Small config bug in autotvm

**URL:** <https://discuss.tvm.apache.org/t/small-config-bug-in-autotvm/8285>\
**Category:** Development\
**Created:** [October 26, 2020, 1:58pm UTC](https://discuss.tvm.apache.org/t/small-config-bug-in-autotvm/8285 "2020-10-26T13:58:15Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![comaniac](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/comaniac/32/899_2.png) [@comaniac](https://discuss.tvm.apache.org/u/comaniac)\
**Post date:** [October 27, 2020, 4:17am UTC](https://discuss.tvm.apache.org/t/small-config-bug-in-autotvm/8285/2 "2020-10-27T04:17:43Z")

</div>

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:

```python
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:

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

```

---

_[View the full topic](https://discuss.tvm.apache.org/t/small-config-bug-in-autotvm/8285)._
