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:
- βinput (
ManagedTensorSlice[IOSpec[_, _].Input, static_spec=input.static_spec]): Three-dimensional input tensor of shape(C, H * W, ...)representing the unfolded feature map. - βoutput_size (
ManagedTensorSlice[IOSpec[_, _].Input, static_spec=output_size.static_spec]): One-dimensional tensor holding the output(height, width)pair. - βkernel_size (
ManagedTensorSlice[IOSpec[_, _].Input, static_spec=kernel_size.static_spec]): One-dimensional tensor holding the kernel(height, width)pair.
Returns:
IndexList[Int(4)]: The four-dimensional output shape of the folded tensor.