RuntimeError: Input type (torch.cuda.HalfTensor) and weight type (torch.cuda.FloatTensor) should be the same


模型输入的数据类型要与模型参数的数据类型一致。

torch.cuda.HalfTensor:对应

 np.array(x, dtype = 'float32')

torch.cuda.FloatTensor:对应

 np.array(x, dtype = 'float16')

参考链接:

https://stackoverflow.com/questions/65029217/runtimeerror-input-type-torch-cuda-floattensor-and-weight-type-torch-cuda-ha

[报错]-RuntimeError: Input type (torch.cuda.HalfTensor) and weight type (torch.cuda.FloatTensor) should be the same的更多相关文章

  1. MyEclipse下Junit报错"The input type of the launch configuration"

    MyEclipse下Junit运行测试用例的时候报错: "The input type of the launch configuration does not exist" 原因 ...

  2. Django报错:提交表单报错---RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have APPEND_SLASH set.

    Django报错:提交表单报错---RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and ...

  3. ssh调用matplotlib绘图报错RuntimeError: Invalid DISPLAY variable

    1.问题:在本地用matplotlib绘图可以,但是在ssh远程绘图的时候会报错 RuntimeError: Invalid DISPLAY variable 2.原因:matplotlib的默认ba ...

  4. 安装tesserocr的步骤和报错RuntimeError: Failed to init API, possibly an invalid tessdata path解决办法

    1,首先下载合适的tesseract-ocr的版本 2,然后安装到这一步注意要勾选这一项来安装OCR识别支持的语言包,这样OCR就可以识别多国语言,然后就可以一直点击下一步完成安装. 3,安装tess ...

  5. Django:提交表单报错:RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have A

    Django:提交表单报错:RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you ...

  6. TP5使用路由模式报错 No input file specified.

    热烈推荐:超多IT资源,尽在798资源网 application/route.php 是设置路由的文件. 将 route.php 代码修改为 <?php use think\Route; Ro ...

  7. 【spring mvc】后台API查询接口,get请求,后台Date字段接收前台String类型的时间,报错default message [Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'createDate';

    后台API查询接口,get请求,后台Date字段接收前台String类型的时间筛选条件 后台接口接收 使用的实体 而createDate字段在后台实体中是Date类型 报错信息: org.spring ...

  8. 【ActiveMQ】消息生产者自动注入报错:Could not autowire. No beans of 'JmsMessagingTemplate' type found

    使用ActiveMQ过程中,定义消息生产者: package com.sxd.jms.producer; import org.springframework.beans.factory.annota ...

  9. SpringBoot项目报错Cannot determine embedded database driver class for database type NONE

    原因: Cannot determine embedded database driver class for database type NONE 这是因为spring boot默认会加载org.s ...

随机推荐

  1. 一文讲明白K8S各核心架构组件

    目录 一.写在前面 二.K8S为我们提供了怎样的能力 三.架构 3.1.MasterNode 3.2.WorkerNode 四.核心组件 4.1.ApiServer 4.1.1.概述 4.1.2.是集 ...

  2. 当在命令行输入"pip install xxx"

    当输入"pip install xxx"时发生了什么 不知道你在下载一些包的时候有没有什么疑惑,输入了"pip install xxx" ,系统是如何找到对应的 ...

  3. 常用Linux音译

    su:Swith user 切换用户,切换到root用户 cat: Concatenate 串联 uname: Unix name 系统名称 df: Disk free 空余硬盘 du: Disk u ...

  4. mvc url重写

    public class newDomainRoute : Route { private Regex domainRegex; private Regex pathRegex; public str ...

  5. [Java学习笔记] Java异常机制(也许是全网最独特视角)

    Java 异常机制(也许是全网最独特视角) 一.Java中的"异常"指什么 什么是异常 一句话简单理解:异常是程序运行中的一些异常或者错误. (纯字面意思) Error类 和 Ex ...

  6. NC20583 [SDOI2016]齿轮

    题目链接 题目 题目描述 现有一个传动系统,包含了N个组合齿轮和M个链条.每一个链条连接了两个组合齿轮u和v,并提供了一个传动比x : y. 即如果只考虑这两个组合齿轮,编号为u的齿轮转动x圈,编号为 ...

  7. windows10:vscode下go语言的适配

    ps:本篇依赖golang的sdk已经安装完成: url:https://www.cnblogs.com/mrwhite2020/p/16475731.html   一.下载vscode,选择wind ...

  8. IDEA快捷键之html篇-1

      前端IDE中Emmet插件快捷输入HTML代码 前端IDE如VSCode.Atom.Sublime Text和Intellij Idea中使用Emmet插件快捷输入HTML代码的介绍 前端IDE中 ...

  9. Linux修改CST时间为UTC时间。

    1.编辑配置文件添加如下内容 [root@Centos8-template ~]# vim /etc/sysconfig/clock ZONE="Etc/UTC" 2.生成链接 [ ...

  10. 基于OpenCV实现对图片及视频中感兴趣区域颜色识别

    基于OpenCV实现图片及视频中选定区域颜色识别 近期,需要实现检测摄像头中指定坐标区域内的主体颜色,通过查阅大量相关的内容,最终实现代码及效果如下,具体的实现步骤在代码中都详细注释,代码还可以进一步 ...