I am trying to find out if there is any way to force the distribution of classes in each batch that is produced when using the pytorch Dataset and Dataloader functionality.  For example, I am doing binary classification and (because my class sizes are imbalanced) during training I would like each batch to be 50% positive examples and 50% negative.  Is there any way to achieve this with Dataloader?
Thanks!