Is WeightedSampler really useful?

The weight should provide a weight for each sample, while in your code it looks like you are trying to pass class weights.
Have a look at this example on how to use the WeightedRandomSampler.

3 Likes