Solved by ptrblck in post #4 
              
              
                Ah OK. 
I guess you want to use the same data in your Dataset? 
If so, you could just fake a new length and use a modulo operation in index to avoid an out of range error: 
class BarDataset(Dataset):
    def __init__(self):
        self.data = list(np.random.rand(9))
        pass

    def __getitem_…