I followed the example from https://pytorch.org/docs/stable/generated/torch.fft.fftshift.html#torch.fft.fftshift
import torch.fft
f = torch.fft.fftfreq(4)
a = torch.fft.fftshift(f)
print(a)
and got the error
AttributeError: module 'torch.fft' has no attribute 'fftfreq'
I tried pip torch==1.7.0+cu110 and pip torch==1.7.1+cu110 and also conda pytorch==1.7.1 with cudatoolkit=11.0. Others have the same problem https://discuss.pytorch.org/t/unable-to-use-correctly-the-new-torch-fft-module/104560/6 But changing to torch1.7.0 didn't solve the problem.
How to use torch.fft correctly?
torch.__version__ == '1.8.1+cu111'