Infinite Random Sampler

Hi,

I am not sure this would work. You would need to subclass Sampler and give an instance of your custom sampler to the dataloader you’re creating.
The problem is that the length of the sampler cannot be infinite as python does not have infinite integer. So you may have to use a very large number there like int(1e100).
Then the iterator is simply an iterator that return a random valid index every time. You can do that with a function that yeild such a number inside an infinite loop for example.