ooodragon:

hm… so it’s getting multiple batches??


If your Dataset.__getitem__ returns multiple tensors, next(iter(loader)) will return a batch for each output.
For the “standard” use case you would thus get a batch of inputs and a batch of targets.



 ooodragon:

In my case I think I specified 8 samples per batch and getitem gave me len() of 3 batches


Are you calling __getitem__ manually or how did you use the len() operation on it?
If next(iter(loader)) returned a batch of shape 3 even though you specified batch_size=5, then your Dataset might not have enough samples.
In that case you should check how the data is loaded and make sure you are able to load more than 3 samples.