A convolution slides a small kernel across an image and records a dot product at every stop. That single operation is what lets a CNN detect the same edge in the top-left corner and the bottom-right one using the same handful of weights.
Task: write conv2d(image, kernel) for a single channel, stride 1, no padding. Return the output map with every value rounded to 4 decimal places.
(H - kh + 1) × (W - kw + 1).Notice how the output shrinks. Stack twenty of these and the map has shrunk by twenty pixels in each direction, which is the entire reason padding exists as an option.