当前位置:网站首页>【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即可
边栏推荐
猜你喜欢

Component pass value provide/inject

开源社区三十年 | 2022开放原子全球开源峰会开源社区三十年专题活动圆满召开

论治理与创新 | 2022开放原子全球开源峰会OpenAnolis分论坛圆满召开

WeChat applet uses cloud functions to update and add cloud database nested array elements

mysql数据库安装(详细)

"A daily practice, happy water problem" 1331. Array serial number conversion

ERROR 2003 (HY000) Can‘t connect to MySQL server on ‘localhost3306‘ (10061)解决办法

【小土堆补充】Pytorch学习笔记_Anaconda虚拟环境使用

Win10 CUDA CUDNN installation configuration (torch paddlepaddle)

VScode+ESP32快速安装ESP-IDF插件
随机推荐
[shell basics] determine whether the directory is empty
WPF WPF 】 【 the depth resolution of the template
VScode+ESP32 quickly install ESP-IDF plugin
IDEA common shortcut keys and plug-ins
扫雷游戏(c语言写)
STM32HAL库修改Hal_Delay为us级延时
"DeepJIT: An End-To-End Deep Learning Framework for Just-In-Time Defect Prediction" paper notes
HCIP第十天_BGP路由汇总实验
论治理与创新 | 2022开放原子全球开源峰会OpenAnolis分论坛圆满召开
Pytest e-commerce project combat (on)
BUG消灭者!!实用调试技巧超全整理
【论文阅读】Mastering the game of Go with deep neural networks and tree search
No qualifying bean of type question
prompt.ml/15中<svg>标签使用解释
(五)final、抽象类、接口、内部类
Explanation of
ERROR 1064 (42000) You have an error in your SQL syntax; check the manual that corresponds to your
binom二项分布,
已解决:不小心卸载pip后(手动安装pip的两种方式)
[Paper reading] Mastering the game of Go with deep neural networks and tree search