Transposed Convolution
Transposed convolution learns to upsample feature maps, the workhorse of decoders in autoencoders, segmentation networks, and generators.
Upsampling with learned weights
A transposed convolution, sometimes called deconvolution or fractionally strided convolution, increases spatial resolution rather than reducing it. Where a strided convolution maps a large input to a small output, its transpose maps a small input to a larger one, spreading each input value across an output region weighted by a learnable kernel. It is the natural inverse-shaped operation for decoders that must reconstruct full-size output from a compact representation.
How it works
Conceptually, each input pixel is multiplied by the kernel and the results are placed into an output grid with overlap, summing where they overlap. Equivalently, the input is spaced out with zeros (according to the stride) and a normal convolution is applied. The name transposed comes from the fact that the operation uses the transpose of the matrix that the corresponding forward convolution would use.
import torch.nn as nn
# stride 2 roughly doubles height and width
up = nn.ConvTranspose2d(64, 32, kernel_size=4, stride=2, padding=1)
The checkerboard artifact
When kernel size is not divisible by the stride, output positions receive uneven numbers of contributions, producing a checkerboard pattern of light and dark squares common in early generative models. Two fixes are widely used: choose kernel size divisible by stride, or replace transposed convolution with nearest-neighbor or bilinear upsampling followed by an ordinary convolution, which sidesteps the uneven overlap.
Where it appears
Transposed convolutions form the decoder path of autoencoders, the expanding path of U-Net, the upsampling stages of semantic segmentation networks, and the generator of many GANs, which grow a small noise vector into a full image. Anywhere a network must turn a coarse feature map back into a fine-grained one, learnable upsampling is a candidate.
Alternatives
Because of artifact concerns, many recent architectures prefer resize-then-convolve or pixel-shuffle (sub-pixel) upsampling, which rearranges channels into spatial resolution. Transposed convolution remains simple and effective when configured carefully, but the alternatives often give cleaner outputs for image synthesis.
- Learnable upsampling, the shaped inverse of strided convolution.
- Spreads each input value across an output region.
- Checkerboard artifacts arise from uneven overlap.
- Central to decoders, U-Net, and GAN generators.