module 'torch' has no attribute 'nan_to_num'
I am using 1.7.1 version of Pytorch on Ubuntu, and I try to do the following :
x = torch.tensor([float('nan'), float('inf'), -float('inf'), 3.14])
torch.nan_to_num(x)

but I am getting this error :
AttributeError: module 'torch' has no attribute 'nan_to_num'
But it does exist in the documentation since I just copied those 2 lines from it. Can someone help me ?

nan_to_num was introduced in PyTorch 1.8. You will need to update your torch package to access it:
pip install --upgrade torch

