liveBook · Manning

Transposed convolution

As explained in Math and Architectures of Deep Learning

A convolution-like operation often described via the transpose of the convolution matrix, used here as a motivation for understanding the matrix form of convolution.

Transposed convolution is a convolution-like operation formed by multiplying with the transpose of a convolution matrix. It performs a kind of upsampling: a lower-dimensional output is distributed back across a larger array in the same proportions used during forward convolution. It is not an inverse, because the forward convolution may discard information when a non-invertible matrix maps more independent inputs to fewer outputs. section 10.5

The operation connects mathematical structure with neural-network reconstruction:

  • For a 1D convolution, multiplying by the transposed weight matrix distributes output values back to input positions, resembling proportional blame distribution in backpropagation. section 10.5
  • In an autoencoder, convolution and pooling layers encode a high-resolution input into a smaller embedding; decoder layers use transposed convolutions to reconstruct an output with the original scale. section 10.5.1 section 10.5.3
  • Unlike nearest-neighbor, bilinear, or bicubic interpolation, transposed convolution learns the mapping during training, distributing values to minimize reconstruction error. section 10.5.3

Output size and a 2D implementation

The transposed-convolution output size follows o′ = (n′ − 1)s + k − 2p. With input size n′ = 3, stride s = 1, kernel size k = 3, and valid padding p = 0, the output size is 5. In two dimensions, a 1 × 1 × 2 × 2 input, a 1 × 1 × 2 × 2 kernel, and stride 2 produce a 1 × 1 × 4 × 4 output. PyTorch implements this with ConvTranspose2d; the demonstrated code fixes the kernel weights and applies it without gradient tracking. section 10.5.2 section 10.5.3

Figure 10.16 1D convolution and its transpose

Use the 1D comparison to inspect how convolution and its transpose distribute values. section 10.5

How Math and Architectures of Deep Learning covers it

How deep it goes
Derives the matrix intuition, output-size formula, tensor shapes, and PyTorch use, but defers autoencoder training details.
Examples
Demonstrates one-dimensional matrix transposition, a 3-to-5 output calculation, and 2D PyTorch upsampling from 2 × 2 to 4 × 4.
What it assumes
Assumes forward convolution as context, then develops the transpose operation through matrices, embeddings, and reconstruction.
What you can do after
Apply transposed convolution via PyTorch ConvTranspose2d and calculate its output dimensions from stride, kernel, and padding.
How it connects
Ties transposed convolution to convolution, backpropagation, autoencoders, embeddings, pooling, and upsampling.

Also explained in

Compare how 5 books explain transposed convolution →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Math and Architectures of Deep Learning. The section links point to the parts of the book it draws on.