Do you have any transformations in __getitem__ or do you just index a single sample of your data?
In the latter case, you could use your slice logic manually so that each call to __getitem__ returns a complete batch. The batch_size of you DataLoader would have to be set to 1 in that case.
However, this would always generate a batch of subsequent samples, if you don’t shuffle the data before.
Another obvious way would be to just work without a DataLoader and create the batches manually.