Why torch.dot(a,b) == torch.sum(a * b) returns False?

Hi, why torch.dot(a,b) == torch.sum(a * b) returns False?
e.g.:
a = torch.rand(1000)
b = torch.rand(1000)
print(torch.dot(a,b) == torch.sum(a * b)),

Thanks!

Welcome to the community!

The values of both those expression are not equal after a certain decimal point. Please run the following to understand:

a = torch.rand(1000)
b = torch.rand(1000)

x1 = torch.dot(a,b)
x2 = torch.sum(a*b)

torch.set_printoptions(precision=10)

print(x1.item())
print(x2.item())