Target xxx is out of bounds.
在采用pytorch进行训练时,最后计算cross entropy损失时会报错。
全连接层最终的维度num_classes表示的是类别的个数,但是在进行自定义数据集的标签设置时,不能从1开始,而是从0开始。如一共有四类,则标签类别为0,1,2,3。标注范围为[0, num_classes-1],一旦超出这个范围则会报错。
在pytorch中,输入数据形式时[batch_size, channel, H, W],在lstm模块中如果不设置batch_first=True,则需要将tensor的batch_size和seq_len维度进行交换。
Target xxx is out of bounds.相关推荐
- ROS(kinetic)报错:CMakeFiles/Makefile2:9038: recipe for target ‘XXX‘
环境:windows10+vmware虚拟机ubuntu16.04+knietic 问题描述: catkin_make编译时报错:CMakeFiles/Makefile2:9038: recipe ...
- 解决IndexError: Target 2 is out of bounds.
解决IndexError: Target 2 is out of bounds. 错误代码 # in_feats = 34 # hidden_size = 5 # num_classes = 2 cl ...
- Xcode10 报错 target xxx(project 'xxx')has copy command from ‘xxx/xxx’ to ''xxx/xxx.app/COPYING'解决方案
Xcode10默认使用最新的系统,但运行旧APP时候就会报错 Showing Recent Messages :-1: Multiple commands produce 'xxx/xxx.app/C ...
- iOS-Verify the value of the CODE_SIGN_ENTITLEMENTS build setting for target xxx and build conf
项目中有xxx.Entitlements文件,Entitlements其实是一个配置文件,对于一些要开启的app功能,需要使用Entitlements文件来做配置.Entitlements文件管三个东 ...
- 在Ubuntu下,编译Kernel报错:Makefile:xxx: recipe for target 'xxx' failed
**在Ubuntu下,编译Kernel报如下错误:** Makefile:xxx: recipe for target 'xxx' failed make[2]:***[arch/arm/boot/c ...
- cmake -- No rule to make target xxx.so
catkin build 时出现错误: No rule to make target "xxx.so " 这种情况大概率是so路径不对,或者该路径下没有xxx.so 原cmakel ...
- Qt编译运行提示No rule to make target 'xxx' needed by 'xxx'
窗口添加了自定义控件,后因需求把先相关类删除,报错,把窗口上的控件也删除. 此时编译会提示No rule to make target 'xxx' needed by 'xxx', 重新构建.重启也 ...
- Qt编译运行提示No rule to make target ‘xxx.h‘ needed by ‘xxx.o‘.Stop
Qt编译运行提示No rule to make target 'xxx.h' needed by 'xxx.o'.Stop 今天使用Qt运行程序时突然报错No rule to make target ...
- QT添加lib库后提示 No rule to make target “xxx.lib“ needed by “xxx.exe“
QT添加外部的lib库: 首先右键项目,选择添加库 进行选择: 这里加入的是静态库 添加库后编译一直报错No rule to make target 'xxx.lib' needed by 'xxx' ...
最新文章
- IDEA一直提示 错误: 找不到或无法加载主类
- 美议员提议:总统发微博后即使删除也要记录档案
- 大学电路题目怎么搜_电路(二),中国大学MOOC(慕课)答案公众号搜题
- 实验9 结构程序设计 7-4 查找书籍
- 滑块 组件_组件制作:如何使用链接的输入创建滑块
- 重读经典:《Deep Residual Learning for Image Recognition》
- 传统Web应用案例(采用服务端渲染)
- 安卓 spinner下拉框 做模糊查询_用图表控件做一个简单的员工信息查询系统
- linux内核那些事之buddy(anti-fragment机制)(4)
- 利用MMCM IP核产生用户时钟
- android升级异常,升级AndroidX遇到的问题
- 5分钟内快速上手掌握springtx事务以及注解的使用
- php模仿一个开票系统,一个模仿oso的php论坛程序(之一)
- 手机无线连接到电脑共享文件
- P2P安防摄像头、门禁
- 源码分析 --- Spark如何确定Splits和分区数
- Telegram APIs中文介绍
- (Bit / Byte / KB / MB / GB / TB ) 概念与单位换算
- 锻炼完美腹肌的7条原则
- flash loader下载使用说明