Slide one kernel, keep its orientation
numeric▲△△Exact integers and fractions where possible; six decimals otherwise.
STATEMENT
Compute every output of a small valid cross-correlation.
GIVEN
One input channel and one output channel, stride one, no padding, dilation one and zero bias:
FIND
The output shape, four output values, parameter count with a trainable bias, and main-product multiply-accumulates.
STRATEGY
Place the stored kernel on each complete window. Do not flip it. Use (I.11.4) for shape and (I.11.2) for the count.
SOLUTION
Each axis has outputs. The four sums are
Thus . There are four kernel weights and one bias, or five parameters. Four output windows use four weights each, giving 16 multiply-accumulates. A zero current bias is still a parameter if it is trainable.
Answer
Output shape , values , five parameters and 16 main-product multiply-accumulates.
Check — sanity
The lower windows contain nonzero inputs but have zero output because positive and negative contributions cancel. A zero response need not mean an empty patch.
Check — numeric · i-11-convolution-checks.py
The reproduction script uses only Python’s standard library. From a repository checkout, run:
python3 scripts/snippets/i-11-convolution-checks.pyIt checks the forward values, every input and kernel derivative, and all worked-problem and exercise calculations.
Executed in CI. The digits above are the digits it printed.
Where this breaks
Flipping the kernel changes the operation. Adding channels requires summing their responses before adding the output channel’s bias once.
Variation
Set the bias to one. Every output increases by one, producing , while the parameter count remains five.