WeightedRandomSampler slow with replacement=False

import torch,torchvision
list(torch.utils.data.WeightedRandomSampler([0.1, 0.9, 0.4, 0.7, 3.0, 0.6]*10000000, 500, replacement=False))

takes very long to run, whereas with replacement=True this is more or less instantaneous.
Anyone an idea why the first option takes so long?

1 Like

Any fix for this? I have the same problem.

No fix yet. A bugreport has been filed at: