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[dtype: DType, stride_h: Int, stride_w: Int, dilation_h: Int, dilation_w: Int, padding_h: Int, padding_w: Int](input: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=input.static_spec], output_size: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=output_size.static_spec], kernel_size: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=kernel_size.static_spec]) -> IndexList[Int(4)]

Computes the output shape for the fold graph op.

Parameters:

  • ​dtype (DType): Element type of the input tensor.
  • ​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:

Returns:

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