python - AttributeError:模块“torch.fft”没有属性“fftfreq”
问题描述
我遵循了 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)
并得到了错误
AttributeError:模块“torch.fft”没有属性“fftfreq”
我尝试了 pip torch==1.7.0+cu110 和 pip torch==1.7.1+cu110 以及 conda pytorch==1.7.1 和 cudatoolkit=11.0。其他人也有同样的问题https://discuss.pytorch.org/t/unable-to-use-correctly-the-new-torch-fft-module/104560/6 但是改成torch1.7.0并没有解决问题.
如何正确使用 torch.fft?
解决方案
函数torch.fft.fftfreq
是在PyTorch 版本 1.8.0中引入的。您需要升级到此版本或更高版本才能使用它。
推荐阅读
- typescript - Typescript 如何在类型系统中表达字符串连接
- java - 到目前为止,异常 jdbc 错误尝试了所有解决方案
- bash - 通过 bash 将输出重定向到文件
- git - 获取与特定分支上文件的最后更改相关的标签名称
- java - Tinkerpop 注册自定义类 kryo
- mysql - 如何区分每种类型的最大计数
- reactjs - 尝试在 asp.net core 2 中静态提供 CRA 构建文件夹
- java - Android 上的 Kaldi - 无法解析“:app@debug/compileClasspath”的依赖关系:无法解析项目:speechutils:app。?
- cuda - 对 CUDA 内核中的所有线程求和一个变量并将其返回给主机
- r - 如何计算矩阵列表中特定行的总和