# Transposed convolutional layer

Can someone define the weights in a transposed conv2D kernel used to perform interpolation (NN or bilinear or whatever)?

The idea is to get "convinced" that one can perform upsampling (interpolation) by the process of transposed convolution (aka. "deconv layers" although this name is not entierly correct)

e.g. take a small image of size 2x2 e.g with grayscale values. (lets forget depth)

How would you defined your "transposed conv2D" kernel (shape, weights) in such as way as to perform this upsampling/interpolation?

1D nearest neighbor interpolation is $$K = \begin{bmatrix}1 & 1 & 0\end{bmatrix}^T$$ or $$K = \begin{bmatrix}0 & 1 & 1\end{bmatrix}^T$$. This depends on whether your library flips the kernel (i.e. cross correlation vs convolution). To increase the sampling frequency just increase the kernel size e.g. $$\begin{bmatrix}0 & 1 & 1 & 1 & 0\end{bmatrix}$$. See also my other answer.
For 2D NN interpolation compute the outer product $$K^TK = \begin{bmatrix}0 & 0 & 0\\0 & 1 & 1\\0 & 1 & 1\end{bmatrix}$$.