Hello everyone,
I just imported an array from numpy into pytorch:
import numpy as np
import torch
a = np.array([ 1.07790701e-01, 5.27183563e-02, 1.03966855e-01])
print(a)
# [0.1077907 0.05271836 0.10396685]
b = torch.from_numpy(a)
print(b)
# tensor([0.1078, 0.0527, 0.1040], dtype=torch.float64)
Even though the tensor is float64
type, every value in tensorb
is rounded up to 2 decimals compared with the original array a
.
How can I keep the values of b
unchanged from a
?
Many thanks,