Hi,
So I was working with a code when I realized this issue:
Suppose,
import torch
import numpy as np

mu1 = torch.Tensor([0.51])
mu2 = torch.Tensor([0.52])
sigma1 = torch.Tensor([0.10])
sigma2 = torch.Tensor([0.11])
output = torch.log(sigma2/sigma1) + (sigma1**2 + (mu1 - mu2)**2)/(2*sigma2**2) - torch.Tensor([0.5])

print(output)

mu1 = torch.Tensor([0.51])
mu2 = torch.Tensor([0.52])
sigma1 = torch.Tensor([0.10])
sigma2 = torch.Tensor([0.11])
output = np.log(sigma2.item()/sigma1.item()) + (sigma1.item()**2 + (mu1.item() - mu2.item())**2)/(2*sigma2.item()**2) - 0.5

print(output)

The results are: tensor([0.0127])
0.012665540341760373, pretty good!
But if,
import torch
import numpy as np

mu1 = torch.Tensor([0.4651])
mu2 = torch.Tensor([0.4652])
sigma1 = torch.Tensor([0.7910])
sigma2 = torch.Tensor([0.7911])
output = torch.log(sigma2/sigma1) + (sigma1**2 + (mu1 - mu2)**2)/(2*sigma2**2) - torch.Tensor([0.5])

print(output)

mu1 = torch.Tensor([0.4651])
mu2 = torch.Tensor([0.4652])
sigma1 = torch.Tensor([0.7910])
sigma2 = torch.Tensor([0.7911])
output = np.log(sigma2.item()/sigma1.item()) + (sigma1.item()**2 + (mu1.item() - mu2.item())**2)/(2*sigma2.item()**2) - 0.5

print(output)

gives results: tensor([5.9605e-08])
2.3976444829543198e-08
What is going on? Why such weird behaviour?