Solved by Nikronic in post #2 
              
              
                Hi, 
If you want to convert any tensor into PIL images, PyTorch already has a function that supports all modes defined in PIL and automatically converts to proper mode. Here is a snippet that simulates your case: 
from torchvision.transforms import ToPILImage  # built-in function

x = torch.FloatTen…