WeightedRandomSampler Not Random

The weights should be passed as sample weights (a weight is assigned to each sample), not class weights.
Here is an example on how to use the WeightedRandomSampler.