Class imbalance with WeightedRandomSampler

The weigths tensor should contain the weight for each sample in your dataset, nor the class weights only.
Have a look at this example which shows a dummy use case.

1 Like