Solved by ptrblck in post #4 
              
              
                If your tensor doesn’t contain a color channel dimension the colormap is undefined and matplotlib will use its default one. 
In case the tensor represents a real grayscale image, it would have a color channel size of 3 where all channels are equal. 
This code shows the behavior: 
x = torch.randint(0…