"GradScaler" is not exported from module "torch.cuda.amp" Import from "torch.cuda.amp.grad_scaler"
时间: 2023-09-15 21:20:02 浏览: 50
这个错误提示意味着你正在尝试从 `torch.cuda.amp` 模块中导入 `GradScaler` 类,但是该模块中并没有导出这个类。相反,你应该从 `torch.cuda.amp.grad_scaler` 中导入它。
你可以尝试修改你的导入语句,如下所示:
```
from torch.cuda.amp.grad_scaler import GradScaler
```
这样应该可以解决你遇到的问题。
相关问题
Attempted import error: 'Prompt' is not exported from 'react-router-dom'.
This error occurs when you try to import the `Prompt` component from the `react-router-dom` package, but it is not found in the package.
To fix this error, you may need to check your import statement and make sure you are importing the correct component from the correct package. Alternatively, you can try updating your `react-router-dom` package to the latest version to see if the `Prompt` component has been added in a recent update.
import error: 'IconActivity' is not exported from '@arco-design/web-react'.
这个错误通常是因为 "@arco-design/web-react" 包中没有导出名为 "IconActivity" 的组件。你可以检查一下 "@arco-design/web-react" 的文档,看看是否有类似的组件可以使用。或者你可以尝试更新 "@arco-design/web-react" 包的版本,以查看是否已经修复了此问题。如果问题仍然存在,你可以尝试联系 "@arco-design/web-react" 的维护者或提交一个 issue,以获得更多的帮助。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)