you are awesome Nik, Thank you for the snippet. The problem I had with PIL transform was that I was using it with a dataloader like so:
        p = transforms.Compose([\
                                torchvision.transforms.Resize((512,512)),\
                                torchvision.transforms.ToTensor(),\
                                ])
        trainingds = torchvision.datasets.ImageFolder(  root=train_data_path,transform=p   )

but when I added PIL to this list, I still could see floats. I did not give it much thought as to why it wouldn’t work (I use this trainingds to perform tensor operations and I noticed that the other solution (when I used PILTransform in get_item), so I went for this instead.
Also, I think keeping the PIlTransform in def __getitem__(self, index): seems a cleaner solution.
Well, once again, thanks a tonne.