In short, to create a dataloader, you need to define your data in init(), how you want it to return a single datapoint given an index idx in getitem(), and the range the idx should go ( between 0 and the len()). The dataloader will handle the rest on its own.