@avinash_m
I think you need to implement a size() as well. See here:
‘https://github.com/pytorch/pytorch/blob/master/torch/csrc/api/include/torch/data/datasets/base.h#L53 47’
Dataset inherited from BatchDataset and it has a pure virtual function size() which is not overridden.
As the comment said, if you don’t need it, just return an empty c10::optional