Reading data from dataloader with offset index

Can we read data from dataloader with offset index like a list? For example, if I have data_list, I can read data like

for i in range(offset, something):
    x, y = data_list[i]

I’m wondering if this can be done with dataloader, thanks.

Yes, you could implement a custom sampler, which is responsible to create the indices and pass them to the Dataset.__getitem__.
Alternatively, you could also add an offset in the __getitem__ method directly, if this would fit your use case.

1 Like