How to use smapler

i know how to make and use a custom dataset. but i am not sure how to make and sue a custom sampler.
can someone pls tell me how a sampler works

for example when i make a custom dataset, i simple write custom_dataset[index] and it outputs the data present at that index. ,and further when i pass this custom_dataset into a batch loader it creates batches of those data. its clear and simple

but in case of a custom sample, how to i get a sample data out of the sampler ?

it would be great if you could me the working of a sampler. Thanks in advance :slight_smile:

The sampler returns the indices used to index your Dataset.
Have a look at these implementations 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?

i was going through and i was not able to figure out whats the use of a batch sampler that has been written in

So i wanted to know how and where are these batch samplers are used.

I am still clueless