Solved by ptrblck in post #4 
              
              
                Do you know these lengths beforehand? 
If so, you could use these indices to slice your data, set batch_size=1 and view your data to fake your batch size: 
class MyDataset(Dataset):
    def __init__(self):
        self.data = torch.randn(250, 1)
        self.batch_indices = [0, 100, 129, 150, 200, 2…