IndexError:invalid index of a 0-dim tensor
运行从githb上下载下来的人脸表情识别项目时,报出如下错误
Traceback (most recent call last):File "mainpro_CK+.py", line 172, in <module>train(epoch)File "mainpro_CK+.py", line 117, in traintrain_loss += loss.data[0]
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
把 loss.data[0] 改成loss.item() 即可
IndexError:invalid index of a 0-dim tensor相关推荐
- 【Pytorch】【IndexError】:invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim ...
解决方法: #将原语句: train_loss+=loss.data[0] #修改为: train_loss+=loss.item()
- 富文本编辑器图片上传失败的BUG解决:IndexError:list index out of range
富文本编辑器图片上传失败的BUG解决 问题原因 我们将通过Django上传的图片保存到了FastDFS中,而保存在FastDFS中的文件名没有后缀名(.png/.jpg/.jif),而ckeditor ...
- invalid index of a 0-dim tensor. Use `tensor.item()`
使用1.7.1版本的torch框架运行代码时出现问题报错如下: invalid index of a 0-dim tensor. Use tensor.item() in Python or tens ...
- IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python
报错原因分析: train_loss += loss.data[0] 是旧版本的Pytorch版本代码,在Pytorch0.4-0.5中会出现警告,不会报错, 在Pytorch0.5版本以上会报错 I ...
- IndexError: invalid index of a 0-dim tensor. Use `tensor.item()` in Python or `tensor.item<T>()` in
使用python pytorch框架出现问题: IndexError: invalid index of a 0-dim tensor. Use tensor.item() in Python or ...
- 高版本pytorch出现IndexError: invalid index of a 0-dim tensor.问题解决办法
最近使用pytorch1.4版本训练网络,在运用loss.data()时,目的时为了让loss函数的值相加,但出现问题IndexError: invalid index of a 0-dim tens ...
- 【python基础】list操作相关:扩充、条件查找【IndexError: list assignment index out of range】...
参考 [https://blog.csdn.net/qq_44768814/article/details/88614393] [IndexError: list assignment index o ...
- java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
我也出过一样的错,在 查询语句 那边打印一下 你查出来的数据 查出来了没有,查出来了就 看你Activity 里面写的 接受收数据的 哪个方法 接收数据是不是 超过了 你查的 数据,我的是这样的 ...
- 解决IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Pyth
解决IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Pyth ...
最新文章
- 推荐给Android开发者的抢手书单
- margin折叠问题
- mysql创建反弹函数,MySql创建函数
- svn: Can't find a temporary directory 问题解决
- php5.6non thread safe 区别,PHP版本Non Thread Safe和Thread Safe如何选择?区别是什么?
- 《T-SQL性能调优秘笈——基于SQL Server 2012 窗口函数》——1.2 使用窗口函数的解决方案简介...
- 关于__str__和__repr__的用法和区别
- ip_conntrack: table full, dropping packet的问题
- 京东探索研究院 34 篇论文入选 CVPR 2022
- 页面上插入flash文件
- cvSaveImage用法
- Postgresql的character varying = bytea问题
- ubuntu服务器开放端口_Docker服务开放了这个端口,服务器分分钟变肉机
- 网络安全实验四 防火墙技术的具体应用
- 强化学习——Q学习算法
- MATLAB读取图像相关的一些操作
- ASP.NET 教程
- 投影幕布jsp_发现篇:亿立投影幕布真实使用感受诉说不看后悔 | 智能扫地机器人评测...
- python如何读取数据保存为新格式_运维学python之爬虫中级篇(五)数据存储(无数据库版)...
- 物联网 USN架构 和 M2M架构
热门文章
- UnRaid添加镜像源加速应用安装的正确方法
- Python3 爬虫学习笔记 C08【解析库 Beautiful Soup】
- 轨迹预测经典论文之五:MultiPath: Multiple Probabilistic Anchor Trajectory Hypotheses for Behavior Prediction
- 三年级优秀书籍推荐_【强烈推荐】三年级课外推荐阅读书目
- 关于福利院人员定位管理的系统介绍--新导智能
- php发卡8.0源码_老米卡php发卡系统源码
- 飞鱼CDN疑难杂症各类处理
- 2021年10月29日
- 【英语:基础高阶_经典外刊阅读】L6.解题真功夫—阅读理解选择题
- linux内核参数 ati显卡,Ubuntu Linux环境下ATI显卡问题解析