Learn Before
Code
Two-Dimensional Cross-Correlation Code Implementation
The two-dimensional cross-correlation operation can be implemented programmatically by iterating over the valid spatial positions of the output tensor. For an input tensor X and a kernel tensor K, the output dimensions are first initialized based on the formula . A nested loop then systematically slides the kernel across the input, performing an elementwise multiplication and summation for each local window to yield the final output tensor.
0
1
Updated 2026-05-12
Tags
D2L
Dive into Deep Learning @ D2L