I converted viceversa  as
pil_img = Image.open(img)
print(pil_img.size)  
 
pil_to_tensor = transforms.ToTensor()(img).unsqueeze_(0)
print(pil_to_tensor.shape) 

tensor_to_pil = transforms.ToPILImage()(pil_to_tensor.squeeze_(0))
print(tensor_to_pil.size)



(1200, 1200)
torch.Size([1, 3, 1200, 1200])
(1200, 1200)

thanks to ptrblk.