The index is specific to a Dataset and you can return it in the __getitem__ function.
The DataLoader just calls the __getitem__ function from its Dataset and iterates it using the specified batch size.
I don’t think there is an easy way to modify a DataLoader to return the index. At least, I don’t have an idea, sorry.