Since the WeightedRandomSampler creates the indices using a multinomial distribution (line of code 4), you cannot specify exactly how many samples will be drawn from a certain distribution, if replacement=True.