Convolution, unfold, stride/padding
Medium FundamentalsImplement 2D convolution from scratch.
• Do NOT use F.conv2d or nn.Conv2d
• Support stride and padding parameters
• F.pad for zero-padding is allowed
Implement the function below. Use only basic PyTorch operations.
Use this code to debug before submitting.
Try solving it yourself first! Click below to reveal the solution.
For interactive practice with auto-grading, run TorchCode locally:pip install torch-judge then use check("conv2d")
Convolution, unfold, stride/padding