AttributeError: 'builtin_function_or_method' object has no attribute 'fftn'

Hi, I am using torch version ‘1.7.1+cu110’ but fftn appears to be missing at torch.fft.fftn.

According to torch.fft — PyTorch 1.7.0 documentation this should exist.

Any advice? Thanks

I guess you might be missing the import torch.fft statement and thus torch.fft.fftn will raise an error.

>>> import torch
tor>>> torch.__version__
'1.7.1'
>>> torch.fft.fftn
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'builtin_function_or_method' object has no attribute 'fftn'

>>> import torch.fft
>>> torch.fft.fftn
<built-in function fft_fftn>
1 Like

Thanks @ptrblck, that fixed it. I didn’t see this line in the docs:

“To use these functions the torch.fft module must be imported since its name conflicts with the torch.fft() function”