RuntimeError: Expected tensor for argument #1 ‘indices‘ to have scalar type Long; but got CUDAFloatT
使用torchsummary 中的 summary函数时,模型中有Embedding层的时候,会报错。原因是Embedding 需要整型的Tensor。
pip install 的torchsummary 不行,没有dtypes这个参数。
所以你下载这里提供的 torchsummary.py 放在你的代码一个目录里即可。
链接: https://pan.baidu.com/s/1HKUZi7Eps1KaA0KvPWfO6A
密码: vku4
这么使用即可:
from torchsummary import summary
summary(model, (1, 100, 8), dtypes=[torch.LongTensor], device='cpu')
RuntimeError: Expected tensor for argument #1 ‘indices‘ to have scalar type Long; but got CUDAFloatT相关推荐
- RuntimeError: Expected tensor for argument #1 ‘indices‘ to have scalar type Long; but got CUDAType
RuntimeError: Expected tensor for argument #1 'indices' to have scalar type Long; but got torch.cuda ...
- Expected tensor for argument #1 ‘indices‘ to have one of the following scalar types: Long, Int; but
RuntimeError: Expected tensor for argument #1 'indices' to have one of the following scalar types: L ...
- torchserve 错误:RuntimeError: Expected tensor for argument #1 ‘input’ to have the same device as tenso
RuntimeError: Expected tensor for argument #1 'input' to have the same device as tensor for argument ...
- Expected tensor for argument #1 'input' to have the same device as tensor for argument #2 'weight';
解决了题目所述问题. 报错完整信息为: RuntimeError: Expected tensor for argument #1 'input' to have the same device as ...
- RuntimeError: expected a Variable argument, but got torch.FloatTensor
从字面的意思来看是 RuntimeError:期望有一个变量参数,但是得到了torch.FloatTensor 这个解决方法是升级pytorch的版本就可以了,我之前用的是pytorch0.3,现在升 ...
- Expected tensor for argument #1 ‘input‘ to have the same device as tensor for argument #2 ‘weight‘;
这种情况出现的原因之一是创建网络的语句没有放进train函数里 比如主文件中有train(),test(),eval()......等各个函数,但是创建网络的语句:net=createnet()放在各 ...
- RuntimeError: Expected object of device type cuda but got device type cpu for argument pytorch数据位置
RuntimeError: Expected object of device type cuda but got device type cpu for argument #2 'target' i ...
- RuntimeError: Expected object of device type cuda but got device type cpu for argument #2 'target'
RuntimeError: Expected object of device type cuda but got device type cpu for argument #2 'target' i ...
- RuntimeError: Expected object of backend CUDA but got backend CPU for argument
RuntimeError: Expected object of backend CUDA but got backend CPU for argument #4 'mat1' 原因:变量没有加cud ...
最新文章
- apache优化管理
- 【设计模式】软件设计七大原则 ( 依赖倒置原则 | 代码示例 )
- Too many fragmentation in LMT?
- 一个农场有头母牛,现在母牛才一岁,要到四岁才能生小牛,四岁之后,每年生一头小牛,n年后有多少头小牛
- p2p-如何拯救k8s镜像分发的阿喀琉斯之踵?
- 蛋疼的strtok函数
- Sharding-JDBC(操作公共表)_Sharding-Sphere,Sharding-JDBC分布式_分库分表工作笔记013
- 项目管理综述(需要完善)
- Tornado部署时那些奇怪的错误
- Unity 3D下载安装教程
- UrlRewrite 的配置和使用总结
- oracle会计工作总结,EBS 创建会计科目 小结
- 数学建模python实现基础编程练习4
- 怎样用C语言sinx的曲线长度,Javascript 绘制 sin 曲线过程附图
- 产品定位的方法与案例,遵循 大而全不如小而精 理念
- OE分布式智能云生态
- 观察者模式(结合C#,Unity)
- Web前端期末大作业---响应式美女健身教练瑜伽馆网页设计(HTML+CSS+JavaScript+)实现
- 2022年重庆最新建筑施工焊工(建筑特种作业)模拟考试题库及答案解析
- 抖音短视频零基础能做到百万粉丝吗?国仁楠哥
热门文章
- 睿停车系统车场服务器,睿停车后台管理中心系统-用户手册-前台版本
- dubbo源码-服务发现
- git更新pull报错Pulling 1 repository Remote does not have refs/heads/rel5.1 available for fetch
- LOCK - 明确地锁定一个表
- 简单的跑马灯效果(轮播图)
- ContentLoadingProgressBar不显示问题
- redmine 和 gitolite 的整合
- [转]linux常用命令学习总结(超详细)
- 量化策略回测DCCV2
- 备受青睐的在线报表工具有哪些?在线报表怎么做?