weightedrandomsampler
pytorch/pytorch
WeightedRandomSampler has been added as a custom sampler for the DataLoader. It samples elements from [0,..,len(weights)-1] with the given probabilities and is useful to sample from unbalanced datasets where some classes have many more samples than others. WeightedRandomSampler has been added as a custom sampler for the DataLoader. It samples elements from [0,..,len(weights)-1] with the given probabilities and is useful to sample from unbalanced datasets where some classes have many more samples than others.