IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /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. /get-started.md).

Mojo function

fold_kernel_shape

def fold_kernel_shape[stride_h: Int, stride_w: Int, dilation_h: Int, dilation_w: Int, padding_h: Int, padding_w: Int](input: T, output_size: T, kernel_size: T) -> IndexList[Int(4)]

Computes the output shape for the fold graph op.

Parameters:

  • ​stride_h (Int): Vertical stride of the sliding window, in elements.
  • ​stride_w (Int): Horizontal stride of the sliding window, in elements.
  • ​dilation_h (Int): Vertical dilation factor applied to the kernel.
  • ​dilation_w (Int): Horizontal dilation factor applied to the kernel.
  • ​padding_h (Int): Vertical padding applied to the output, in elements.
  • ​padding_w (Int): Horizontal padding applied to the output, in elements.

Args:

  • ​input (T): Three-dimensional input tensor of shape (C, H * W, ...) representing the unfolded feature map.
  • ​output_size (T): One-dimensional tensor holding the output (height, width) pair.
  • ​kernel_size (T): One-dimensional tensor holding the kernel (height, width) pair.

Returns:

IndexList[Int(4)]: The four-dimensional output shape of the folded tensor.

Was this page helpful?