The sampler returns the indices used to index your Dataset.
Have a look at these implementations 25 or the implemented samplers.
As you can see, the __iter__ method returns an iterator or a generator.
How should your custom sampler generate the indices?