问题描述

在使用nn.CrossEntropyLoss时出现报错:

loss_id = self.IDLoss(id_preds, id_targets)
Traceback (most recent call last):File "/home/hgx/pycharm-2020.1.3/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_exec2.py", line 3, in Execexec(exp, global_vars, local_vars)File "<input>", line 1, in <module>File "/home/hgx/anaconda3/envs/bytetrack/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_implreturn forward_call(*input, **kwargs)File "/home/hgx/anaconda3/envs/bytetrack/lib/python3.7/site-packages/torch/nn/modules/loss.py", line 1152, in forwardlabel_smoothing=self.label_smoothing)File "/home/hgx/anaconda3/envs/bytetrack/lib/python3.7/site-packages/torch/nn/functional.py", line 2846, in cross_entropyreturn torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)
RuntimeError: "nll_loss_forward_reduce_cuda_kernel_2d_index" not implemented for 'Int'

问题分析

数据类型导致的错误

解决方案

进行数据类型转换

id_targets = id_targets.to(torch.int64)     # TODO: ReID. [matched_anchor], float16 to int

[debug] RuntimeError: “nll_loss_forward_reduce_cuda_kernel_2d_index“ not implemented for ‘Int‘相关推荐

  1. RuntimeError: “unfolded2d_copy“ not implemented for ‘Half‘(实测百分百有效)

    报错 RuntimeError: "unfolded2d_copy" not implemented for 'Half' 原因 模型传入的参数use_half=true,就是利用 ...

  2. [debug] RuntimeError: CUDA error: no kernel image is available for execution on the device

    问题描述 运行程序时出现报错: RuntimeError: CUDA error: no kernel image is available for execution on the device ( ...

  3. RuntimeError: “LayerNormKernelImpl“ not implemented for ‘Long‘

    将GitHUB上下载的模块用于自己的模型,一定要注意输入数据的数据类型(dtype)是否满足模块的要求 第一步:数据类型为张量:train_inputs=torch.tensor(train_inpu ...

  4. YOLOv5+deepsort——报错解决:RuntimeError: “unfolded2d_copy“ not implemented for ‘Half‘

    一.报错原因 CPU不支持半精度训练 二.解决办法 要么采用GPU训练 要么将检测模块中的.half()全部改成.float()(计算时请保证数据类型一致)

  5. python个人bug修炼手册

    文章目录 问题一:python: can't open file 'argparse_learning_1.py': [Errno 2] No such file or directory 问题二:M ...

  6. 64位Fedora运行32位C++程序中int精度溢出处理

    在64-bit机器中编译32-bit的代码出现int(强制转换而至)精度溢出: Debug==> error: cast from 'void*' to 'int' loses precisio ...

  7. 从C#中的枚举获取int值

    我有一堂课,叫做Questions (复数). 在此类中,有一个名为Question (单数)的枚举,它看起来像这样. public enum Question {Role = 2,ProjectFu ...

  8. 区分Debug版还是Relase版

    // test.cpp : 区分Debug版还是Relase版 // #include "stdafx.h" //提示使用Debug环境会定义宏_DEBUG int _tmain( ...

  9. DEBUG命令的应用

    TAG:随笔杂记 下面对一些常用指令进行详细剖析: A (Assemble) 汇编指令 1,输入汇编语句被汇编到内存的指定区段,此区段在开始时用A address 指定. 2,所有语句输入完成后,按E ...

最新文章

  1. RNA-seq分析-数据库
  2. android studio adb
  3. redis数据结构详解之Hash(四)
  4. jquery的ajax向ashx传中文,出现乱码的解决方法
  5. VTK:Cell3D演示用法实战
  6. Tomcat部署时没有项目
  7. Codeforces Round #114 (Div. 1) A. Wizards and Trolleybuses 物理题
  8. 技术员联盟win11系统64位专业版镜像v2021.08
  9. TCP/IP , HTTP Protocol
  10. matlab handle plot
  11. python 获取当前目录,上级目录,上上级目录,N级目录
  12. 深度 | EB级规模大数据平台核心技术揭秘(上)
  13. 正交幅度调制(QAM)
  14. JavaScript基础学习笔记
  15. 链家地产改名链家 转型房产O2O
  16. C#编译时提示未能解析引用的程序(被引用项目编译成功,但引用项目编译时却不能正常引用)
  17. 卷积自编码器(Convolutional Autoencoder)的一个实验
  18. 计算机同一优盘记录,怎么查看电脑插过U盘的记录
  19. HTML、CSS、JS(JAVA Sprict)
  20. web入门 命令执行 web53-web55

热门文章

  1. python和c++哪个好-Scratch和Python与C++选哪个合适
  2. 三星Bixby如此人性 小娜的下一步就是善解人意
  3. 大数据时代的语音识别,方言也不怕?
  4. CSS常用选择器简析(带简单案例)
  5. 给 VS2008 / VS2010 MFC 项目添加启动画面
  6. java 通用组件_写一个通用数据访问组件
  7. it男java_java-学习8
  8. java easyui分页源码_SpringMVC+easyUI中datagrid分页实现_2014.5.1
  9. git stash暂存命令
  10. Linux安装Redis3.2.8