简体   繁体   English

导入 torch.fx ModuleNotFoundError:没有名为“torch.fx”的模块

[英]import torch.fx ModuleNotFoundError: No module named 'torch.fx'

After enabling torch and Cuda for my system according to my system GPU compatibility, whenever I am trying to run any program which needs to be run on GPU to enable the system, this error is coming.根据我的系统 GPU 兼容性为我的系统启用 torch 和 Cuda 后,每当我尝试运行任何需要在 GPU 上运行以启用系统的程序时,都会出现此错误。 I could not able to find any solution for this.我无法找到任何解决方案。 though I read about this that create another environment and this error will be solved but did not work for me.虽然我读到了这个创建另一个环境的信息,这个错误将得到解决,但对我不起作用。 Please find the details of my system.请找到我的系统的详细信息。 for reference, I am using Python 3.7.2.作为参考,我使用的是 Python 3.7.2。

image include torch and Cuda version and device name图像包括手电筒和 Cuda 版本和设备名称

Details of NVIDIA Cuda compiler driver NVIDIA Cuda 编译驱动详情

nvidia-smi output英伟达-smi output

Can anyone help to solve this problem?任何人都可以帮助解决这个问题吗? Thank you谢谢

Instead of using而不是使用

import torch.fx

You have to import from torch.fx as below:您必须从 torch.fx 导入如下:

from torch.fx import symbolic_trace

You can view more in the official documentations .您可以在官方文档中查看更多内容。

torch.fx was added in PyTorch 1.8.0.torch.fx 1.8.0 中添加了 torch.fx。 Check release post .检查发布帖子 You're probably using an older version.您可能使用的是旧版本。 Upgrade pytorch from website .网站升级 pytorch。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM