How could I generate sequential data batch with dataloader

Hi,

Thanks for your contributions to this wonderful framework. I am working on a program with pytorch, and I come to this problem:

I need my dataloader to return tensor in batch, and I need the batch is returned in order and without replacement. That is to say, I hope my dataloader can give me data batch with index 1, 2, 3, … 32 (suppose batch size is 32) for the first batch, and for the second batch it is expected to return 33, 34, 35, … 64, and so on. Until the last sample is returned, the epoch ends.

How could I do this ?

Hi coincheung, what you have described is the default setting of the data loader.

For help with Dataloaders, you can refer to this tutorial. Just set the shuffle argument to False for your use.

1 Like

Got it, Thanks a great deal