nn.Upsampling is deprecated. Use nn.functional.interpolate instead.
解决方法:
x2_in = nn.functional.interpolate(x2_in, scale_factor=2, mode='bilinear',align_corners=True)
#-*-coding:utf-8-*-
import torch
import torch.nn as nn
import numpy as np
# pool of non-square window
## In the simplest case, the output value of the layer
# with input size (N,C,H,W)(N, C, H, W)(N,C,H,W),
# output (N,C,Hout,Wout)(N, C, H_{out}, W_{out})(N,C,Hout,Wout) and kernel_size (kH,kW)(kH, kW)(kH,kW) can be precisely described as:
data = np.arange(64).reshape((8,8))
A = torch.Tensor(data.reshape(1,1,8,8))
print('A=',A)
## MAX POOL
maxpool = nn.MaxPool2d((2, 2), stride=(2, 2),return_indices=True)
B,indices = maxpool(A)
print('B=',B)
## Upsample
Upsample = nn.Upsample(scale_factor=2, mode='bilinear')
C = Upsample(B)
print('C=',C)
D = nn.functional.interpolate(B,scale_factor=2, mode='bilinear')
print('D=',D)
nn.Upsampling is deprecated. Use nn.functional.interpolate instead.相关推荐
- nn.functional.interpolate
torch.nn.functional.interpolate 官方文档: interpolate Down/up samples the input to either the given size ...
- torch.nn.functional.interpolate函数
torch.nn.functional.interpolate实现插值和上采样 torch.nn.functional.interpolate(input, size=None, scale_fact ...
- [十三]深度学习Pytorch-卷积层(1D/2D/3D卷积、卷积nn.Conv2d、转置卷积nn.ConvTranspose)
0. 往期内容 [一]深度学习Pytorch-张量定义与张量创建 [二]深度学习Pytorch-张量的操作:拼接.切分.索引和变换 [三]深度学习Pytorch-张量数学运算 [四]深度学习Pytor ...
- 正态分布初始化 torch.nn.Embedding.weight()与torch.nn.init.normal()的验证对比
torch.nn.Embedding.weight(num_embeddings, embedding_dim) 随机初始化,生成标准正态分布N(0,1)N(0,1)N(0,1)的张量Tensor t ...
- 关于nn.ReLU(inplace=True)和nn.ReLU(inplace=False)的区别
可以把inplace当作是一个进行relu运算后输入变化与否的开关,True代表输入改变,False输入保持原样.验证代码如下: >>> input = torch.randn(7) ...
- 【 NARX NN回归预测】基于NARX NN实现数据自回归多变量预测附matlab代码
✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信.
- pytorch: MaxUnpool2d 与 Upsampling
Upsampling:上采样,被nn.functional.interpolate代替 nn.Upsampling is deprecated. Use nn.functional.interpola ...
- pytorch MaxUnpool2d
这个函数onnx 12不支持 2021.01.07 Upsampling:上采样,被nn.functional.interpolate代替 nn.Upsampling is deprecated. U ...
- torch.nn.functional
1. 非线性激活函数 torch.nn.functional.threshold(input, threshold, value, inplace=False) torch.nn.functional ...
最新文章
- tcptracerte参数_探究 wireshark 的 tcptrace 时序图
- r语言向量代码如何创建函数c,R中向量基本操作:创建、运算、访问
- 可视化日历(Java实现)
- 二叉搜索树(创建,插入,删除):基础篇,适合新手观看。
- java 分布式rpc框架_分布式RPC框架Apache Dubbo(一)
- 详解java访问修饰符
- 垃圾回收机制和JVM垃圾回收常见算法
- c 如何加函数锁linux,Linux下C语言中fcntl函数用法说明
- 微软Office Live Workspace测试版开放全球注册
- MySql 数据库安装、环境变量配置 以及 本地连接
- 艺术招生考试/艺术职称考试/才艺比赛/艺术特长考试/舞蹈比赛等-评委现场打分公开展示系统的定制
- SUNLORDINC顺络电子LTCC产品推广资料
- 无忧·企业文档2.1.4版本更新清单说明来啦
- 什么叫最少拍计算机控制系统,最少拍无波纹计算机控制系统的一种综合方法.doc...
- adb命令获取设备IMEI
- Hadamard矩阵和Kronecker积
- 2018年什么编程语言最值得学习
- 在Ubuntu手机平台上创建一个HTML 5的应用
- OpenCV从上到下的顺序查找轮廓
- 如何寻找已注册dll的路径
热门文章
- Android 中加载网络资源时的优化 缓存和异步机制
- linux下常用FTP命令 1 连接ftp服务器
- Ubuntu常见命令记录
- eclipse编辑java_15个小type:教你高效使用Eclipse Java IDE
- mysql if value t f_mysql常用函数
- 检察机关计算机涉密案例,三原县检察院:扎实做好新时代检察机关保密工作
- 数字内容交易平台php,Demila数字内容交易系统 v1.0
- android11通知栏按钮,android开发(11) 消息栏通知(Notification)
- 什么样的编程语言,竟然能融资 1.6 亿?
- 皮一皮:有钱人的品味实在不懂...