facebookresearch/mbrl-lib

[Bug] `__len__` method of Model should always return non-negative integer

jettjaniak opened this issue · 0 comments

Steps to reproduce

from mbrl.models import Model
class MyModel(Model):
    def eval_score(self, *args, **kwargs):
        return
    def loss(self, *args, **kwargs):
        return

my_model = MyModel()
len(my_model)

Observed Results

TypeError: 'NoneType' object cannot be interpreted as an integer

Expected Results

Here is __len__ implementation for Model

def __len__(self):
    return None

and desired result is to return None by default, but it is not correct in Python, see https://docs.python.org/3/reference/datamodel.html#object.__len__