报错:RuntimeError: expected scalar type Double but found Float
这个问题是深度学习,用pytorch跑的时候出现的
解决办法:这个是格式问题,希望的格式是double,但得到的是float。字面意思是这个,但是并不是非要把格式改成double,这个时候应该在出错的前面几处代码设个断点debug一下,我得到的结果是image、img_rgb都是tensor.unit8格式的,但程序所需要的是torch.float32格式的,因此在这两行后面加上.float()即可
会出上述的错误,改成:
报错:RuntimeError: expected scalar type Double but found Float相关推荐
- [报错]RuntimeError: expected scalar type Double but found Float(torch)
RuntimeError: expected scalar type Double but found Float 在使用torch训练模型的时候,发现该问题.根据提示,是双精度和float之间的冲突 ...
- RuntimeError: expected scalar type Double but found Float
最近在使用 sequitur库 快速搭建自编码器时遇到 RuntimeError: expected scalar type Double but found Float 涉及代码 import to ...
- 解决pytorch当中RuntimeError: expected scalar type Double but found Float的问题
出现这个问题的原因可能是因为tensor的数据类型不对,有可能是反向传播中输入x的类型不对,也有可能是训练和测试过程中的data类型不对,如果是反向传播过程的话,那就要看是哪一层神经网络出现问题,就在 ...
- expected scalar type Double but found Float
RuntimeError: expected scalar type Double but found Float 原因:tensor的数据类型不正确 解决: 将数据类型转为float32 并不是因为 ...
- 常见报错:RuntimeError: expected scalar type Long but found Float
RuntimeError: expected scalar type Long but found Float 这是一个非常常见的报错,我已经遇到过这个报错很多次了,但是之前没有仔细研究过,今天好好好 ...
- 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 ...
- RuntimeError: expected scalar type Half but found Float
起因:将CCNet的十字交叉注意力模块移植到YOLOv5中. 经过:在注意力模块中,会有较多的矩阵运算,在训练时出现了cuda和cup类型的冲突(另一篇我写的文章):而在验证时出现了上述错误. 出错的 ...
- 解决pytorch RuntimeError: expected scalar type XXXX but found XXXX
比如报错为:RuntimeError: expected scalar type Long but found Float,就是希望输入为torch.Long,结果得到一个torch.Float 解决 ...
- 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 ...
最新文章
- 批量新建文件夹并命名_dos命令实现批量新建文件夹
- java 静态 编译_Java中的动态和静态编译实例详解
- php 随机生成数据表名,php 随机生成姓名
- 简单的问题和复杂的问题
- POJ 3301 三分(最小覆盖正方形)
- k近邻法matlab_机器学习系列(一)K近邻算法(KNN,KNearestNeigh
- Python入门篇-高级数据类型集合(set)和字典(dict)
- 我的世界 文件保存位置
- H264 TS/ES
- .NET MVC运行周期
- python编写自制编译器_编译器构造-编译Python
- 数据分析必备:掌握这个R语言基础包1%的功能,你就很牛了
- 如何远程调试zookeeper集群
- Python基础语法-05-装饰器
- Cannot resolve com.oracle:ojdbc14:11.2.0.1.0
- android支付宝运动修改器,支付宝运动修改器
- 数字地与模拟地解释及PBC底线布局
- 嵌入式开发-Telink芯片-入门介绍
- Matlab 语言基础知识输入命令之ans
- C PRIMER PLUS(第六版编程练习)7.12编程练习_7题
热门文章
- 微信小程序、微信低版本兼容
- 我的linux系统怎么输入pv,如何在Linux系统中使用pv命令
- 苹果cms8整合dplayer播放器
- c语言窗口插入图片,c语言添加图片Word版
- 前端开发——Vue 监听组件生命周期
- 趣图:程序员睡不着数绵羊清单
- Lambertian 反射(也叫理想散射)
- 内网服务器防火墙作用,防火墙内网用户通过公网域名访问内部服务器典型配置案例集...
- 【UE4】蓝图转为C++官方教程部分笔记
- webdav使用mysql_如何设置WebDAV与MySQL认证Apache2(Debian Etch)