I have a dataloader that wraps 100 samples of data.
I have a WeightedRandomSampler that returns 1000 samples.
However, when I create a new dataloader with this sampler, the new dataloader also has 100 samples, and not 1000 as I expect - why is this?
from random import randint
from torch.utils.data import WeightedRandomSampler

# dl1 is a dataloader with 100 samples
weights = [randint(1, 10) for _ in range(100)]
nsamples = 1000
sampler = WeightedRandomSampler(weights, nsamples)
dl2 = dl1.new(shuffle=False, sampler=sampler)
print((len(dl1.y), len(dl2.y)))
# outputs 100, 100 (I expect this to be (100, 1000))