A transposed convolutional layer is a learned convolution-like operation that upsamples feature maps, fills gaps, and usually produces a larger spatial output than its input. Unlike ordinary convolution, it increases resolution rather than reducing it. section 6.2.3
Its role in a U-Net follows a practical sequence:
- Start with compressed features produced by the contracting path and bottleneck. section 6.2.2
- Apply a transposed convolution to increase spatial resolution; choose the stride to control the amount of upsampling. section 6.2.3
- Combine the upsampled features with matching features from the contracting path through skip connections, preserving fine-grained spatial details. section 6.5
- Process the result with additional convolutional or residual blocks to continue reconstructing the image. section 6.3.1
A 2 × 2 PyTorch operation
Create a one-channel ConvTranspose2d layer with a 2 × 2 kernel and stride 2. For input [[0, 1], [1, 2]] and weights [[1, 2], [2, 3]], the operation produces a 4 × 4 output: [[0, 0, 1, 2], [0, 0, 2, 3], [1, 2, 2, 4], [2, 3, 4, 6]]. section 6.2.3
class UnetUp(nn.Module):
def __init__(self, in_channels, out_channels):
super().__init__()
layers = [nn.ConvTranspose2d(in_channels,
out_channels, 2, 2),
ResidualConvBlock(out_channels, out_channels),
ResidualConvBlock(out_channels,
out_channels),] #1
self.model = nn.Sequential(*layers)
def forward(self, x, skip):
x = torch.cat((x, skip), 1)
x = self.model(x)
return x
The UnetUp implementation concatenates skip features, applies ConvTranspose2d with kernel size 2 and stride 2, then runs two residual convolutional blocks. section 6.3.1




