Hy there, I guess it’s about precision, the error is due to float 32 which causes this round off error.
import torch
a = torch.rand([1000,1000],device='cuda',dtype=torch.float64)
torch.set_printoptions(7)
b = torch.mm(a,a)
print(b)
a = a.cpu().numpy()
c = a.dot(a)
print(c)
print(torch.sum(torch.abs((b.cpu()-c))))