A convolution kernel is a small array of weights that scans local regions of an input tensor. At each position, it multiplies corresponding values, sums them, and writes one output value. The same weights are reused at every position, allowing the kernel to recognize a spatial pattern wherever it appears. section 3.2.1 section 3.2
For a one-dimensional input shaped (C, W), a kernel shaped (C, K) must match every input channel and span K positions. A two-dimensional image uses a matching (C, K, K) kernel. One kernel produces one output channel; a layer with several kernels produces several output channels. section 3.2.1 section 3.4 section 3.4.2
Practical properties to track when implementing kernels:
- Kernel size controls the local neighborhood. Without padding, a size-K kernel reduces each spatial dimension by 2⋅⌊K/2⌋ when centered over the input. section 3.2.2
- Padding adds values around the input; zero padding of ⌊K/2⌋ usually preserves height and width, simplifying deeper architectures. section 3.2.3
- Channels let one kernel combine distinct input signals, such as color channels, while separate kernels can detect different patterns. section 3.4
- Learned kernels can detect edges, colors, sharpening, or blurring; pretraining gives such filters a useful starting point for image tasks. section 3.3 section 13.2.1
A three-value 1D kernel
Applying [1, 0, −1] to each consecutive three-value region computes a weighted difference between local endpoints. The raw Python procedure loops over positions, multiplies input[i+j] by kernel[j], sums the products, and appends each result. The same operation extends to 2D by adding loops for rows and columns. section 3.2.1










