RuntimeError: expected a Variable argument, but got torch.FloatTensor
从字面的意思来看是
RuntimeError:期望有一个变量参数,但是得到了torch.FloatTensor
这个解决方法是升级pytorch的版本就可以了,我之前用的是pytorch0.3,现在升级了就不会出现这个问题了。
出现问题的代码
import torch
from torch import nnm = nn.AdaptiveMaxPool2d(1)
input = torch.randn(1, 64, 8, 9)
output = m(input)
print(output.size())
想要做一下关于nn.AdaptiveMaxPool2d()的测试,这个方法一般使用的是在神经网络里面,所以输入参数都是变量。然后我使用固定值,所以会出现问题。然后pytorch将这个函数做了升级,现在可以了
RuntimeError: expected a Variable argument, but got torch.FloatTensor相关推荐
- 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 ...
- 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 ...
- RuntimeError: Expected tensor for argument #1 ‘indices‘ to have scalar type Long; but got CUDAFloatT
使用torchsummary 中的 summary函数时,模型中有Embedding层的时候,会报错.原因是Embedding 需要整型的Tensor. pip install 的torchsumma ...
- 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 ...
- 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 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 type torch.cuda.LongTensor but found type torch.cuda.IntTensor
问题: anchor_label = np.array(self.id_dict[int(anchor_id)])identity_loss = criterion_identity(predicte ...
- 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 ...
最新文章
- 16DOM之事件基础
- NM-1A-OC3MM和NM-CIDS-K9模块的苦恼
- android消除app卡顿,为什么你的app会出现卡顿?Android开发:关于性能需要考虑的...
- Excel—SUMPRODUCT用法指南
- Python进阶之一
- java key值_java-必须为此操作提供PartitionKey值
- python错误怎么处理_python报的错误怎么处理
- boost库下的deadline_timer和steady_timer 区别
- java 按钮怎么透视_【手把手教你Eclipse插件开发】之Eclipse透视图开发
- Android 生成keystore,两种方式
- 也来对比一下segmentfault、开源中国、简书
- jpa报错:Provided id of the wrong type for class
- 明星代言的商品一般都不便宜,为何还那么受青睐?
- MATLAB 基础与通信系统仿真
- 在Windows和macOS上更新Node.js到最新版本
- Springboot Could not resolve placeholder ‘spring.data.mongodb.database’ in value “${spring.data.mong
- SN74LS148优先编码器的级联使用
- 程序员应该避开的20个低级不良用户体验
- php显示文件内容,php读取文件内容_PHP读取文件内容并输出显示
- 如何修改CentOS6、CentOS7内核支持安装锐速的内核
热门文章
- Python3 GUI:PyQt5环境搭建
- kettle组件-应用
- Import declarations are not supported by current JavaScript version
- React Native组件的结构和生命周期
- 在整个数据库搜索某个字符串在哪个表的哪个字段中
- PowerShell 在 SharePoint 2010 自动化部署中的应用(2)-编译打包
- 社会对IT 从业人员综合素质的需求
- python和云计算_云计算和python区别
- Web前端和后端的区别是什么?如何区分?
- 行进位,超前进位 ,行波进位 ,并行进位有什么区别