Convolution Kernels

A kernel is a small set of weights reused across positions.

In one dimension, a kernel can slide over a sequence:

input:  [1, 2, 3, 4]
kernel: [1, 0, -1]

At the first position, it reads [1, 2, 3]:

1*1 + 2*0 + 3*(-1) = -2

At the next position, the same kernel reads [2, 3, 4]:

2*1 + 3*0 + 4*(-1) = -2
kernel slides over local input windows123456-101outputsame weights are reused at each position
A convolution applies the same small kernel to local windows of the input.

The same weights are reused. That reuse is what makes convolution different from giving every position its own separate weights.

DL-C14-T02-001Exercise: One convolution output

Input window [2, 5, 1] uses kernel [1, 0, -1]. What is the output?

Compute it first, then check your number.

DL-C14-T02-002Exercise: Kernel size

A 1D kernel has weights [0.5, -1, 2, 1]. What is its size?

Compute it first, then check your number.