liveBook · Manning

Convolution kernel

As explained in Inside Deep Learning: Math, Algorithms, Models

A learned array of weights applied over local input regions to compute convolution outputs.

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

How Inside Deep Learning: Math, Algorithms, Models covers it

How deep it goes
Defines shapes, sliding arithmetic, channels, padding, and multiple filters, but defers full convolution-layer theory.
Examples
Uses 1D difference detection, 2D numeral images, blur and edge kernels, MNIST, and PyTorch convolution layers.
What it assumes
Assumes basic tensors and image channels, then develops convolution arithmetic from a simpler one-dimensional case.
What you can do after
Build it from scratch with nested loops, choose padding and kernel shapes, and configure multiple filters with PyTorch.
How it connects
Connects kernels to convolution, channels, padding, stride, pooling, spatial priors, and transfer learning.

Also explained in

Compare how 11 books explain convolution kernel →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Inside Deep Learning: Math, Algorithms, Models. The section links point to the parts of the book it draws on.