Solved by ptrblck in post #2 
              
              
                transforms.ToPILImage() takes an argument mode, which defines the PIL.Image.mode of the input data: 

mode (PIL.Image mode) – color space and pixel depth of input data (optional). If mode is None (default) there are some assumptions made about the input data: 1. If the input has 3 channels, the mode…