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, input.LayoutType, input.origin, address_space=input.address_space, linear_idx_type=input.linear_idx_type, element_size=input.element_size], output: TileTensor[dtype, output.LayoutType, output.origin, address_space=output.address_space, linear_idx_type=output.linear_idx_type, element_size=output.element_size], 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?