Solved by Azerus in post #3 
              
              
                Or an other idea would be to, at least, round the result when converting it to int. When you do tensor.to(int) or numpy.astype(int), the value is floored, witch can actually be the source of your problem. So I suggest this alternative: 
from PIL import Image
from torchvision import transforms
import…