pytorch 查看cuda 版本方式
作者:峰峰晶晶 时间:2022-07-16 23:43:05
由于pytorch的whl 安装包名字都一样,所以我们很难区分到底是基于cuda 的哪个版本。
有一条指令可以查看
import torch
print(torch.version.cuda)
补充知识:pytorch:网络定义参数的时候后面不能加".cuda()"
pytorch定义网络__init__()的时候,参数不能加“cuda()", 不然参数不包含在state_dict()中,比如下面这种写法是错误的
self.W1 = nn.Parameter(torch.FloatTensor(3,3), requires_grad=True).cuda()
应该去掉".cuda()"
self.W1 = nn.Parameter(torch.FloatTensor(3,3), requires_grad=True)
来源:https://blog.csdn.net/ewqapple/article/details/95067814
标签:pytorch,cuda
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
php多任务程序实例解析
2023-11-18 00:22:09
tensorflow 模型权重导出实例
2022-10-14 06:25:25
python实现远程控制电脑
2022-12-07 21:00:16
全面理解javascript的caller,callee,call,apply概念
2007-12-02 17:44:00
Python在字符串中处理html和xml的方法
2023-09-01 21:19:08
Python实现基于权重的随机数2种方法
2022-10-13 03:25:40
Python3利用SMTP协议发送E-mail电子邮件的方法
2023-10-12 17:39:32
![](https://img.aspxhome.com/file/2023/2/63202_0s.jpg)
Python微信公众号开发平台
2021-11-25 20:50:12
![](https://img.aspxhome.com/file/2023/7/81707_0s.jpg)
Python中用pyinstaller打包时的图标问题及解决方法
2021-11-10 01:41:33
![](https://img.aspxhome.com/file/2023/7/120407_0s.jpg)
用来武装Firefox的24款Web开发插件
2010-02-28 12:40:00
int在python中的含义以及用法
2023-07-28 08:48:21
基于python实现百度翻译功能
2023-09-06 15:14:18
![](https://img.aspxhome.com/file/2023/3/70883_0s.jpg)
python下setuptools的安装详解及No module named setuptools的解决方法
2022-12-21 00:56:46
Python 错误和异常代码详解
2022-02-12 15:14:08
XMLHTTP错误The server name or address could not be resolved 的解决过程
2009-12-26 18:33:00
asp 得到动态数组中元素的个数
2011-03-30 10:55:00
adodb.stream对象的方法/属性
2008-06-07 08:14:00
python 重定向获取真实url的方法
2022-10-25 03:24:46
Python实现利用最大公约数求三个正整数的最小公倍数示例
2022-12-30 09:04:16
django迁移文件migrations的实现
2022-10-27 02:48:44
![](https://img.aspxhome.com/file/2023/5/133195_0s.jpg)