Solved by ptrblck in post #6 
              
              
                Thanks for the code and link to the notebook. 
It seems that 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, 255]. 
This line of code will most likely overflow and thus creating the “edge”-like i…