Training with a random fraction data from data loader every epoch

Hi,

I have a very large dataset to train my model. I would like to get n different random batches from the DataLoader at every different epoch. How can I do it?

Thanks,

You could create an iterator via loader_iter = iter(loader) and get the next batch via batch = next(iter). If you’ve set shuffle=True in the DataLoader, these batches will contain random samples.