Hi, I’m trying to build PyTorch 1.7 in python 3.7 from source. I build it successfully several days ago. But now I find I can’t get the right output from PyTorch. E.g.:
>>> import torch
>>> torch.randn(10)
tensor([ 2., 1., 0., 0., 1., -1., 0., 1., 1., -0.])
>>> 13/54
0.24074074074074073
>>> torch.tensor(13/54)
tensor(0.)
Like the code above, the output decimal has no digits after the decimal point and my deployment code also gets NaN loss. So can anyone help me out? Thanks.
My Environment:
- Jetson AGX Xavier
- Jetpack 5.1
Edit:
I find the output is corret under cuda. E.g.:
>>> import torch
>>> torch.randn(10)
tensor([ 0., -2., -1., 2., -0., -1., 0., -1., -1., -1.])
>>> torch.randn(10).cuda()
tensor([ 1.4657, -0.1883, -1.0067, -2.1090, 0.3517, -0.0147, -0.8071, 0.7974,
0.6983, 1.6613], device='cuda:0')
But I also need PyTorch works well in CPU because some code just use short CPU tensor for convenience. Is there an easy way to sovle this problem? Thanks a lot.