pytorch 反卷积

1. condtranspose2d

import torch
from torch import nn
from torch.nn import init
from torch.autograd import Variable
import torchvision

dconv = nn.ConvTranspose2d(in_channels=1, out_channels= 1,  kernel_size=4, stride=1, padding=0,output_padding=0, bias= False)
init.constant(dconv.weight, 1)
print(dconv.weight)
#
input1 = Variable(torch.ones(1, 1, 3, 3))
print(input1)
print(dconv(input1))

这里的当p=0时,p=1时会补0,p=2不补

2. pixel shuffle

先通道扩张,再reshape

参考链接:1. https://blog.csdn.net/g11d111/article/details/82855946 介绍了子像素卷积

2. http://www.mamicode.com/info-detail-2294256.html 介绍了pytorch文档里的反卷积过程

3. https://www.cnblogs.com/kk17/p/10111768.html 介绍了验证方法

 

 

相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页