Solved by Xiaoyu_Song in post #2 
              
              
                The problem is solved, the default algorithm for torch.transforms.resize() is BILINEAR 
SO just set 
transforms.Resize((128,128),interpolation=Image.NEAREST) 
Then the value range won’t change!