当前位置:网站首页>【debug锦集】Expected input batch_size (1) to match target batch_size (0)
【debug锦集】Expected input batch_size (1) to match target batch_size (0)
2022-07-31 04:31:00 【雪天鱼】
我是雪天鱼,一名FPGA技术爱好者,B站账号:https://space.bilibili.com/397002941?spm_id_from=333.1007.0.0
(1)由于输入到 loss函数的label不满足要求格式导致
loss = criterion(output, label)
这里的label是tensor类型,元素个数要与种类个数对应,如四分类,则 label=[1,0,0,0]、[0,1,0,0]、[0,0,1,0]、[0,0,0,1] 这样 ,即与预测的输出是一个样子,size和dtype都要一致:
预测输出:
报错details:
解决方法:
手动调整下label即可
边栏推荐
- 慧通编程第4关 - 魔法学院第6课
- C语言表白代码?
- Musk talks to the "virtual version" of Musk, how far is the brain-computer interaction technology from us
- PCL 计算点云坐标最值及其索引
- Redis uses LIST to cache the latest comments
- MySQL database must add, delete, search and modify operations (CRUD)
- 两个地址池r2负责管地址池r1负责管dhcp中继
- PWN ROP
- 开源社区三十年 | 2022开放原子全球开源峰会开源社区三十年专题活动圆满召开
- idea工程明明有依赖但是文件就是显示没有,Cannot resolve symbol ‘XXX‘
猜你喜欢
微信小程序使用云函数更新和添加云数据库嵌套数组元素
Win10 CUDA CUDNN 安装配置(torch paddlepaddle)
(5) final, abstract class, interface, inner class
Why don't you programmers make a living off your own projects?And have to work for someone else?
Component pass value provide/inject
[Paper reading] Mastering the game of Go with deep neural networks and tree search
已解决(最新版selenium框架元素定位报错)NameError: name ‘By‘ is not defined
论治理与创新 | 2022开放原子全球开源峰会OpenAnolis分论坛圆满召开
MySQL数据库必会的增删查改操作(CRUD)
Postgresql 15 source code analysis (5) - pg_control
随机推荐
MySQL数据库增删改查(基础操作命令详解)
Redis uses LIST to cache the latest comments
binom二项分布,
【论文阅读】Mastering the game of Go with deep neural networks and tree search
MySQL模糊查询可以使用INSTR替代LIKE
Daily practice of LeetCode - 138. Copy a linked list with random pointers
BP神经网络
Safety 20220712
扫雷游戏(c语言写)
Regarding the primary key id in the mysql8.0 database, when the id is inserted using replace to be 0, the actual id is automatically incremented after insertion, resulting in the solution to the repea
IDEA common shortcut keys and plug-ins
(四)递归、可变参数、访问修饰符、理解 main 方法、代码块
VScode+ESP32快速安装ESP-IDF插件
重磅 | 开放原子校源行活动正式启动
Hand in hand to realize the picture preview plug-in (3)
qlib自动化quant
el-image tag doesn't work after binding click event
Fusion Cloud Native, Empowering New Milestones | 2022 Open Atom Global Open Source Summit Cloud Native Sub-Forum Successfully Held
产学研用 共建开源人才生态 | 2022开放原子全球开源峰会教育分论坛圆满召开
WeChat applet uses cloud functions to update and add cloud database nested array elements