Skip to main content

Mojo function

fold

fold[dtype: DType, stride: Tuple[Int, Int], dilation: Tuple[Int, Int], padding: Tuple[Int, Int], target: StringSlice[StaticConstantOrigin]](input: TileTensor[dtype, LayoutType, origin, address_space=address_space, linear_idx_type=linear_idx_type, element_shape_types=element_shape_types], output: TileTensor[dtype, LayoutType, origin, address_space=address_space, linear_idx_type=linear_idx_type, element_shape_types=element_shape_types], output_size: IndexList[2], kernel_size: IndexList[2], ctx: DeviceContextPtr)

Folds array of sliding local blocks into a single output tensor.

Parameters:

  • dtype (DType): The data type for the input and output.
  • stride (Tuple): Stride of the sliding blocks.
  • dilation (Tuple): Dilation of the sliding blocks.
  • padding (Tuple): 0-paddings to be added on both sides of the inputs.
  • target (StringSlice): The target architecture to compile for.

Args:

  • input (TileTensor): Input tensor to fold, shape [N, C x kernel size, num_blocks].
  • output (TileTensor): Output tensor to write to, shape [N, C, H, W].
  • output_size (IndexList): Spatial shape of the output tensor (H, W).
  • kernel_size (IndexList): Size of the sliding blocks.
  • ctx (DeviceContextPtr): DeviceContextPtr.

Was this page helpful?