Is it known that if you do torch.sum(y_hat == y), if the sum is larger than 255, the sum will be whatever - 255? I am seeing this behavior with the conda version of PyTorch. If you do torch.sum((y_hat == y).float()) then it is fine.