Convert a float number to float tensor with 100% precision

I have an excel file that contains float numbers like the below:
(the length of them is 15 or 17)

But when I want to convert them to tensor, it will be rounded like this:

Is there a way to convert the original numbers into the tensor with their actual precisions?

Hi @jahanifar,

This is most likely due to the print options settings in pytorch (docs here)

Can you set torch.set_printoptions(precision=10) (just after you import torch) and re-run this? You’ll get the correct values. If not, use torch.float64 instead!

1 Like