Mojo function
im2col
im2col[dtype: DType](output: NDBuffer[dtype, 2, origin, shape, strides, alignment2=alignment2, address_space=address_space, exclusive=exclusive], activation: NDBuffer[dtype, 4, origin, shape, strides, alignment2=alignment2, address_space=address_space, exclusive=exclusive], problem: Conv2dProblemShape)
Explicit im2col transformation for convolution.
Transforms a 4D activation tensor [N, H, W, C] into a 2D matrix [M, K] for GEMM-based convolution.
M = batch * out_h * out_w K = in_channels * filter_h * filter_w
Note: This is a CPU reference implementation. For production use, the implicit im2col in the kernel is preferred.
Args:
- โoutput (
NDBuffer): Output 2D buffer [M, K]. - โactivation (
NDBuffer): Input 4D buffer [N, H, W, C]. - โproblem (
Conv2dProblemShape): Convolution problem shape.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!