How to control what goes in single batch

Hi,I wanted to control each batch data according to distribution of labels in it and current epoch.
More specifically I wanted first few batches to have more number of images which are less in training set,and then gradually decrease their number in later batches.
I have tried custom dataset and custom sampler,and what I understand is Dataset just provide a way to read individual item,and Sampler control indices for whole epoch.
So to control each batch do i need custom DataLoader?
If yes could you provide toy example for it,I could not find in documentation.

You’re close to the solution! Since the sampler gives indices for the whole epoch, you can disable shuffling in the DataLoader and decide on the indices you want in advance. By knowing the batch size, you can then know every index in every batch.

1 Like