I did this normalization process because the ToPILImage is creating the different output, as you are passing a FloatTensor , which is assumed to be in the range [0, 1] , while yours has the range [0, 4*] . Pixel values changes when apply transform.ToTensor - #6 by ptrblck 1
When I did not normalize, the ToPILImage set 0 to 0, and 1,2, and 3 to 1.