Skip to main content

Mojo function

im2col

im2col[dtype: DType](output: TileTensor[dtype, output.LayoutType, output.origin, address_space=output.address_space, linear_idx_type=output.linear_idx_type, element_size=output.element_size], activation: TileTensor[dtype, activation.LayoutType, activation.origin, address_space=activation.address_space, linear_idx_type=activation.linear_idx_type, element_size=activation.element_size], 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:

Was this page helpful?