解决pytorch报错:AssertionError: Invalid device id的问题
作者:学EE的粒粒 时间:2021-05-15 16:13:42
在服务器上训练的网络放到本地台式机进行infer,结果出现报错:
AssertionError: Invalid device id
仔细检查后发现原来服务器有多个GPU,当时开启了两个进行加速运算。
net1 = nn.DataParallel(net1, device_ids=[0, 1])
而本地台式机只有一个GPU,调用数量超出所以报错。
改为
net1 = nn.DataParallel(net1, device_ids=[0])
问题解决。
来源:https://blog.csdn.net/baoyongshuai1509/article/details/85254298
标签:pytorch,AssertionError
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
又一个php 分页类实现代码
2023-11-15 13:04:56
python用分数表示矩阵的方法实例
2023-12-22 21:58:11
![](https://img.aspxhome.com/file/2023/2/90542_0s.png)
Python爬虫框架scrapy实现的文件下载功能示例
2023-09-23 09:41:56
js实现圆形菜单选择器
2023-09-23 19:50:54
![](https://img.aspxhome.com/file/2023/8/56308_0s.jpg)
python列表去重的二种方法
2022-06-02 05:21:41
如何在网页显示英语音标(附实例)
2010-01-12 17:07:00
![](https://img.aspxhome.com/file/UploadPic/20101/12/ipa_logo-93s.jpg)
解决python 虚拟环境删除包无法加载的问题
2023-09-15 14:43:57
使用Python的Django和layim实现即时通讯的方法
2022-05-29 00:41:33
![](https://img.aspxhome.com/file/2023/0/77570_0s.jpg)
拖拽翻页(ThrowPage)详解 cool
2009-12-02 09:54:00
![](https://img.aspxhome.com/file/UploadPic/200912/2/01-46s.jpg)
支持png透明图片的php生成缩略图类分享
2023-11-18 07:26:13
![](https://img.aspxhome.com/file/2023/5/104175_0s.jpg)
讲解MySQL数据库的数据类型和建库策略
2008-12-17 14:39:00
Python素数检测实例分析
2021-05-22 02:11:41
python math模块使用方法介绍
2021-06-20 23:44:01
深入浅出SQL嵌套SELECT语句
2009-02-06 14:25:00
判断字段是否被更新 新旧数据写入Audit Log表中
2012-01-29 17:56:33
python boto和boto3操作bucket的示例
2022-08-05 03:22:49
ASP Application 对象用户手册
2008-10-23 13:59:00
Python Matplotlib通过plt.subplots创建子绘图
2022-06-03 08:23:16
![](https://img.aspxhome.com/file/2023/5/98905_0s.png)
SQL Server 2000安装图解教程
2009-09-09 19:59:00
![](https://img.aspxhome.com/file/UploadPic/up/2009090920263675.gif)
python 中yaml文件用法大全
2021-11-30 08:02:29
![](https://img.aspxhome.com/file/2023/4/65964_0s.png)