Below is an example of matrix multiplication that incurs precision loss in float32. Any idea why the result is different when I run it on Mac vs Linux?
import torch
x = torch.tensor([[11041., 13359, 15023, 18177], [13359, 16165, 18177, 21995], [15023, 18177, 20453, 24747], [18177, 21995, 24747, 29945]])
y = torch.tensor([[29945., -24747, -21995, 18177], [-24747, 20453, 18177, -15023], [-21995, 18177, 16165, -13359], [18177, -15023, -13359, 11041]])
print(x@y)
On Linux I’m seeing the following result, both GPU and CPU (colab)
[[ 33. 17. 1. 1.]
[ 11. 27. -5. -5.]
[ 11. -5. 27. -21.]
[ -7. 9. 9. 25.]]
Whereas on mac laptop, I see the following
[[28., 0., -4., 0.],
[ 0., 28., 0., -4.],
[20., 0., 20., 0.],
[ 0., 20., 0., 20.]]