Concept

Padding in Transposed Convolution

Unlike regular convolution, where padding is added to the borders of the input tensor, padding in transposed convolution is applied directly to the output. Specifying a padding value removes that number of rows and columns from the outer boundaries of the transposed convolution result. For example, if we apply a padding of 11 on all sides, the first and last rows and columns are discarded from the final output tensor. In frameworks like PyTorch and MXNet, this can be implemented using the padding=1 argument in nn.ConvTranspose2d or nn.Conv2DTranspose.

# PyTorch tconv = nn.ConvTranspose2d(1, 1, kernel_size=2, padding=1, bias=False) tconv.weight.data = K tconv(X)
# MXNet tconv = nn.Conv2DTranspose(1, kernel_size=2, padding=1) tconv.initialize(init.Constant(K)) tconv(X)

0

1

Updated 2026-05-21

Contributors are:

Who are from:

Tags

D2L

Dive into Deep Learning @ D2L