the source code of ImageFolder  465  is simple and easy to understand, I would strongly like to advice you to have a look at it .
here is what you want:
class MyImageFolder(ImageFolder):
    def __getitem__(self, index):
        return super(MyImageFolder, self).__getitem__(index), self.imgs[index]#return image path

val_dataloader=t.utils.data.DataLoader(val_dataset)
for ii,data in enumerate(val_dataloader):
        (input,label),(path,_) = data
         .....