Convolution as a constrained matrix: a fully connected layer, with zeros and ties

A convolution layer is a linear layer y = Mx whose matrix is not free: most entries are forced to zero, and the rest are forced to be equal along diagonals. Press Play to impose the two constraints one at a time. Point at any entry to see which entries share its weight; drag a number to change it.

A weight matrix going from dense, to banded, to banded with constant diagonals An input vector drawn as a row above a grid of weights, one grid row per output, and the output vector as a column to its right. In the first stage every weight is different; in the second, everything outside a band around the diagonal is zero; in the third, each diagonal of the band is one repeated weight, colored by which kernel weight it is. On the right, bars comparing the number of free parameters, and the kernel itself.
kernel size K