NumPy allowed · plain Python earns 10 bonus points
Compute the core 3D tensor inner product across all input channels for a convolutional filter.
Implement conv2d_multi_channel(x, kernel, bias=0.0, stride=1, padding=0): pad each of the C input channels with padding zeros. Then slide the 3D filter (C, kH, kW) over the spatial dimensions with stride stride. At each location, sum the element-wise products across all channels and spatial kernel coordinates, add bias, and round to 4 decimal places.
conv2d_multi_channel(x: list[list[list[float]]], kernel: list[list[list[float]]], bias: float = 0.0, stride: int = 1, padding: int = 0) -> list[list[float]]