[英]ModuleNotFoundError: No module named 'torch.utils.benchmark'
I have been trying to use the torch benchmark module for profiling the code.我一直在尝试使用火炬基准模块来分析代码。 Verified that all required imports are in place:验证所有必需的导入都已到位:
import torch
import torchvision
import torch.utils.benchmark
Also, these are the versions installed:此外,这些是安装的版本:
torch -> 1.4.0
torchvision -> 0.2.1
tensorflow -> 1.12.0
tensorflow-gpu -> 1.12.0
tensorboard -> 2.5.0
But I still get error: ModuleNotFoundError: No module named 'torch.utils.benchmark'
while importing torch.utils.benchmark
.但我仍然收到错误: ModuleNotFoundError: No module named 'torch.utils.benchmark'
while importing torch.utils.benchmark
。 What could be the root cause?根本原因可能是什么?
Have you tried to upgrade torch?你试过升级手电筒吗? I see you are using 1.4.0 but currently 1.9.0 is available.我看到您使用的是 1.4.0,但目前可以使用 1.9.0。
pip install torch --upgrade
I have tested import of modules as you describe with 1.9.0 and receive no errors.我已经按照您在 1.9.0 中描述的那样测试了模块的导入,并且没有收到任何错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.