A transposed convolution is a learnable layer that increases the spatial resolution of a feature map by applying the transpose of the matrix that an ordinary convolution would use, so it reverses the shape change of a strided convolution rather than its values. In neural networks, it is the standard trainable upsampling operation in decoders, image generators and segmentation models.
The layer is also called a fractionally strided convolution, and older papers and some frameworks name it a deconvolution layer. That last name is misleading, because the operation does not invert a convolution in the signal-processing sense; it only produces an output with the size that the original input had.
How transposed convolution upsamples a feature map
A transposed convolution works by scattering each input value across a larger output grid. Every input element is multiplied by the whole kernel, and the resulting weighted patch is added to the output at a location set by the stride. Where patches overlap, their contributions are summed.
An equivalent view is useful for intuition. The layer behaves like inserting zeros between input pixels, stride minus one zeros along each axis, then padding the border and running an ordinary convolution with a flipped kernel. This is why the name fractionally strided fits: the effective stride over the original input is a fraction such as one half.
Mathematically, any convolution can be written as a sparse matrix C acting on a flattened input. The transposed convolution multiplies by the transpose of C, which maps the output space back to the input space. The same operation computes the gradient of a convolution with respect to its input during backpropagation, so frameworks reuse that code path.
Because the kernel weights are trained like any other parameters, the layer learns an upsampling filter suited to the task. A transposed convolution with C_in input channels, C_out output channels and a k by k kernel holds C_in × C_out × k² weights plus optional biases, the same count as the forward convolution it mirrors. Its compute cost scales with the larger output grid, so a stride 2 layer typically performs about four times the multiply-accumulate operations of a matching stride 2 convolution in two dimensions.
Key parameters and output size
The output size of a transposed convolution is set by kernel size, stride, padding, dilation and output padding. In one dimension, a common formula is output = (input − 1) × stride − 2 × padding + dilation × (kernel − 1) + output padding + 1. With an input of 16, stride 2, kernel 4 and padding 1, the output is exactly 32.
The parameters below control both the geometry and the visual quality of the result.
| Parameter | Typical values | Effect on output |
|---|---|---|
| Stride | 2 for doubling, 4 for quadrupling | Sets the upsampling factor |
| Kernel size | 2, 3 or 4 | Controls overlap between output patches |
| Padding | 0 to 2 | Trims rows and columns from the border |
| Output padding | 0 or 1 | Resolves ambiguous output sizes |
| Dilation | Usually 1 | Spreads kernel taps further apart |
Output padding exists because several input sizes map to the same strided output. A stride 2 convolution turns both 31 and 32 pixels into 16, so the transposed layer needs one extra hint to know which size to restore.
Comparison with other upsampling methods
Transposed convolution is one of several ways to enlarge feature maps, and the alternatives differ in learnability, cost and artifact risk. The comparison below helps when choosing a decoder design.
| Method | Learnable | Artifact risk | Typical use |
|---|---|---|---|
| Transposed convolution | Yes | Checkerboard patterns | U-Net decoders, GAN generators |
| Resize then convolve | Yes, in the convolution | Low | Image synthesis, super-resolution |
| Nearest-neighbor upsampling | No | Blocky edges | Fast decoders, feature pyramids |
| Bilinear interpolation | No | Slight blur | Segmentation output heads |
| Pixel shuffle | Yes, before rearranging | Low with proper initialization | Real-time super-resolution |
| Max unpooling | No | Sparse outputs | Encoder-decoder segmentation |
Unlike fixed interpolation, a transposed convolution learns how to fill in detail, which is valuable when the decoder must reconstruct fine structure such as object boundaries or textures.
Checkerboard artifacts and how to avoid them
The best-known weakness of transposed convolution is the checkerboard artifact, a grid-like pattern of brighter and darker pixels. It appears when the kernel size is not divisible by the stride, because some output positions then receive contributions from more kernel taps than their neighbors.
With kernel 3 and stride 2, for example, alternating output pixels receive two and one contributions along each axis, and the uneven overlap compounds in two dimensions. Training can in principle learn to compensate, but in practice the pattern often persists, especially in generated images. The table lists common symptoms and fixes.
| Symptom | Likely cause | Fix |
|---|---|---|
| Grid pattern in images | Kernel not divisible by stride | Use kernel 4 with stride 2 |
| Persistent artifacts | Uneven overlap in stacked layers | Switch to resize then convolve |
| Shape mismatch with skip connection | Ambiguous output size | Set output padding or crop |
| Blurred fine detail | Too little decoder capacity | Add convolutions after upsampling |
A widely adopted remedy is resize-convolution: upsample with nearest-neighbor or bilinear interpolation, then apply a normal stride 1 convolution. It removes the uneven overlap by design at a modest extra compute cost.
Where transposed convolutions appear in practice
Transposed convolutions are central to encoder-decoder architectures that must return to full resolution. Typical places include the following.
- U-Net decoders, where each stage doubles resolution before merging skip connections.
- Fully convolutional segmentation networks, which upsample coarse class maps to pixel labels.
- GAN generators such as DCGAN, which grow a small latent tensor into a full image.
- Convolutional autoencoders, which reconstruct inputs from compressed codes.
Many recent image generators replace transposed convolutions with interpolation followed by convolution, but the layer remains common in segmentation, medical imaging and lightweight decoders, where its learned upsampling is efficient and artifacts are easier to control.
The same operation extends to other dimensions. One-dimensional transposed convolutions upsample audio and time series in vocoders, while three-dimensional versions rebuild volumetric data such as CT scans. In each case the design rules are identical: match the kernel size to the stride and verify output shapes before connecting skip paths.
The short version
Many image networks first shrink a picture into a small summary. Later they must grow it back to full size. A transposed convolution is a learned way to enlarge that summary.
Think of stamping a small pattern onto a larger sheet for every input dot. Where stamps overlap, the ink adds up. The network learns the best stamp to use. If the stamps overlap unevenly, a faint grid can appear in the result.
Where it makes a difference
A medical imaging team trains a U-Net to outline tumors in 512 by 512 pixel MRI slices. The encoder reduces each slice to a 32 by 32 feature map, and four decoder stages use transposed convolutions with kernel 3 and stride 2 to return to full size.
Radiologists notice faint grid patterns along the predicted tumor borders, which make edges look jagged. The engineers change every decoder layer to kernel 4 with stride 2, which gives each output pixel even overlap. The grid disappears, and the Dice score on the validation set rises from 0.84 to 0.86, mainly because boundary pixels are now labeled more consistently.