it looks like ToPILImage and ToTensor might not be necessary after all…
example from colourjitter, F.adjust_hue(img, hue_factor):
if not isinstance(img, torch.Tensor):
return F_pil.adjust_hue(img, hue_factor)
return F_t.adjust_hue(img, hue_factor)
transforms functions are capable of working with both PIL and tensor types, and they do so inside transforms.functional.
I think we can safely remove transforms.ToPILImage() and transforms.ToTensor() in case batch of images are already in tensor format, and we can directly apply transforms.ToTensor() on them.