Example

Example of Two-Dimensional Cross-Correlation

To illustrate a two-dimensional cross-correlation operation, consider an input tensor with a shape of 3×33 \times 3 and a kernel tensor with a shape of 2×22 \times 2. The convolution window begins at the upper-left corner of the input. The input subtensor within this window and the kernel are multiplied elementwise, and the products are summed to yield a single scalar value: 0×0+1×1+3×2+4×3=190\times0+1\times1+3\times2+4\times3=19. As the window slides across the input tensor from left to right and top to bottom, this process is repeated. The resulting output tensor has a shape of 2×22 \times 2 and contains the four derived scalar values: 1919, 2525, 3737, and 4343.

Image 0

0

1

Updated 2026-05-09

Contributors are:

Who are from:

Tags

D2L

Dive into Deep Learning @ D2L