Blockquote
https://pytorch.org/tutorials/beginner/data_loading_tutorial.html\ 109

Look this official tutorial. You should rewrite the getitem method for your custom dataset which inherite from torch.utils.data.Dataset module.