Skip to content
ML Academy

Introduced on day 36

Convolution (filter, kernel)

A small grid of weights slid over an input; at each position it multiplies the patch under it by the weights and sums, producing one number per position.

In detail

In deep-learning libraries the operation is cross-correlation (the kernel is not flipped), which makes no difference because the weights are learned. Output length per axis is ⌊(n+2p−d(k−1)−1)/s⌋+1\lfloor (n + 2p - d(k-1) - 1)/s \rfloor + 1 for input nn, kernel kk, padding pp, stride ss and dilation dd. A layer with ff filters over cinc_{in} channels has f(k2cin)+ff(k^2 c_{in}) + f weights in 2-D.