in addition to what @dhpollack said: Depending on your use case you’d maybe reinstantiate the dataloader because it might have an old value for your dataset length and this might cause wrong behavior in the sampler.