That’s a good point, but the results of the PyTorch and numpy subtraction have a huge difference:
a = torch.tensor([ -9.4257e-01, 1.1631e+00, -4.6614e-01, 1.7443e+00, 5.3751e-01,
-5.9480e-01, 2.2457e+00, -1.1146e+171, 2.1892e+00, 8.8797e-01],
dtype=torch.float64)
b = torch.tensor([-0.94256972, 1.59635256, 0.31117838, 1.27669038, -0.32818301,
-0.41886666, 3.0437956, 0.13902091, 1.03149757, 1.16275023],
dtype=torch.float64)
print(a - b)
> tensor([ -2.8000e-07, -4.3325e-01, -7.7732e-01, 4.6761e-01, 8.6569e-01,
-1.7593e-01, -7.9810e-01, -1.1146e+171, 1.1577e+00, -2.7478e-01],
dtype=torch.float64)
Also, the PyTorch output looks a bit strange, as it contains -1.1146e+171
.
@Hiba_Ahsan Could you upload the input tensors somewhere, so that we can have a look?