上采样的几种方式

1.插值

import torch.nn.functional as F
//init中
self.up = nn.Upsample(size = (256, 2), mode = "nearest")
//forward中
F.interpolate(input, size=None, scale_factor=None, mode='nearest', align_corners=None, recompute_scale_factor=None)   //size为输出尺寸

2.转置卷积

nn.ConvTranspose2d(kernel_size = 4,stride = 2,padding = 1) //将 8 * 8卷积成 16 * 16

你可能感兴趣的:(深度学习,深度学习,神经网络,pytorch)