IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Mojo function

im2col

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