这个问题是深度学习,用pytorch跑的时候出现的

解决办法:这个是格式问题,希望的格式是double,但得到的是float。字面意思是这个,但是并不是非要把格式改成double,这个时候应该在出错的前面几处代码设个断点debug一下,我得到的结果是image、img_rgb都是tensor.unit8格式的,但程序所需要的是torch.float32格式的,因此在这两行后面加上.float()即可

会出上述的错误,改成:

报错:RuntimeError: expected scalar type Double but found Float相关推荐

  1. [报错]RuntimeError: expected scalar type Double but found Float(torch)

    RuntimeError: expected scalar type Double but found Float 在使用torch训练模型的时候,发现该问题.根据提示,是双精度和float之间的冲突 ...

  2. RuntimeError: expected scalar type Double but found Float

    最近在使用 sequitur库 快速搭建自编码器时遇到 RuntimeError: expected scalar type Double but found Float 涉及代码 import to ...

  3. 解决pytorch当中RuntimeError: expected scalar type Double but found Float的问题

    出现这个问题的原因可能是因为tensor的数据类型不对,有可能是反向传播中输入x的类型不对,也有可能是训练和测试过程中的data类型不对,如果是反向传播过程的话,那就要看是哪一层神经网络出现问题,就在 ...

  4. expected scalar type Double but found Float

    RuntimeError: expected scalar type Double but found Float 原因:tensor的数据类型不正确 解决: 将数据类型转为float32 并不是因为 ...

  5. 常见报错:RuntimeError: expected scalar type Long but found Float

    RuntimeError: expected scalar type Long but found Float 这是一个非常常见的报错,我已经遇到过这个报错很多次了,但是之前没有仔细研究过,今天好好好 ...

  6. output = input.matmul(weight.t()) RuntimeError: expected scalar type Long but found Float 错误解决

    在使用pytorch的nn.Linear时出现错误 RuntimeError: expected scalar type Long but found Float 这里报错的原因是我的输入是Longt ...

  7. RuntimeError: expected scalar type Half but found Float

    起因:将CCNet的十字交叉注意力模块移植到YOLOv5中. 经过:在注意力模块中,会有较多的矩阵运算,在训练时出现了cuda和cup类型的冲突(另一篇我写的文章):而在验证时出现了上述错误. 出错的 ...

  8. 解决pytorch RuntimeError: expected scalar type XXXX but found XXXX

    比如报错为:RuntimeError: expected scalar type Long but found Float,就是希望输入为torch.Long,结果得到一个torch.Float 解决 ...

  9. DDP报错::RuntimeError: Expected all tensors to be on the same device, but found at least two devic

    DDP报错 RuntimeError: Expected all tensors to be on the same device, but found at least two devices, c ...

最新文章

  1. 批量新建文件夹并命名_dos命令实现批量新建文件夹
  2. java 静态 编译_Java中的动态和静态编译实例详解
  3. php 随机生成数据表名,php 随机生成姓名
  4. 简单的问题和复杂的问题
  5. POJ 3301 三分(最小覆盖正方形)
  6. k近邻法matlab_机器学习系列(一)K近邻算法(KNN,KNearestNeigh
  7. Python入门篇-高级数据类型集合(set)和字典(dict)
  8. 我的世界 文件保存位置
  9. H264 TS/ES
  10. .NET MVC运行周期
  11. python编写自制编译器_编译器构造-编译Python
  12. 数据分析必备:掌握这个R语言基础包1%的功能,你就很牛了
  13. 如何远程调试zookeeper集群
  14. Python基础语法-05-装饰器
  15. Cannot resolve com.oracle:ojdbc14:11.2.0.1.0
  16. android支付宝运动修改器,支付宝运动修改器
  17. 数字地与模拟地解释及PBC底线布局
  18. 嵌入式开发-Telink芯片-入门介绍
  19. Matlab 语言基础知识输入命令之ans
  20. C PRIMER PLUS(第六版编程练习)7.12编程练习_7题

热门文章

  1. 微信小程序、微信低版本兼容
  2. 我的linux系统怎么输入pv,如何在Linux系统中使用pv命令
  3. 苹果cms8整合dplayer播放器
  4. c语言窗口插入图片,c语言添加图片Word版
  5. 前端开发——Vue 监听组件生命周期
  6. 趣图:程序员睡不着数绵羊清单
  7. Lambertian 反射(也叫理想散射)
  8. 内网服务器防火墙作用,防火墙内网用户通过公网域名访问内部服务器典型配置案例集...
  9. 【UE4】蓝图转为C++官方教程部分笔记
  10. webdav使用mysql_如何设置WebDAV与MySQL认证Apache2(Debian Etch)