2D Convolution
2026/3/9小于 1 分钟
2D Convolution
题面
Write a program that performs a 2D convolution operation on the GPU with "valid" 边界条件:kernel 仅在与输入完全重叠的区域应用。输入与 kernel 以行优先一维数组表示,输出同样为行优先存储。输出尺寸:output_rows = input_rows - kernel_rows + 1output_cols = input_cols - kernel_cols + 1
Implementation Requirements
- Use only native features (external libraries are not permitted)
- The solve function signature must remain unchanged
- The final result must be stored in the array output
Examples
Example 1 与 Example 2 见站点页面示例。
Constraints
- 1 ≤ input_rows, input_cols ≤ 3072
- 1 ≤ kernel_rows, kernel_cols ≤ 31
- kernel_rows ≤ input_rows
- kernel_cols ≤ input_cols
- Performance is measured with input_cols = 3,072, input_rows = 3,072, kernel_cols = 15, kernel_rows = 15