Math.abs(Integer.MIN_VALUE) in Java very seriously returns -2147483648, as there is no int for 2147483648.
It throws an OverflowException: ("Negating the minimum value of a twos complement number is invalid.")
a = torch.tensor(-2*31, dtype=torch.int32) assert a == a.abs()