Skip to main content

Mojo function

pad_repeat

pad_repeat[output_layout: Layout, input_layout: Layout, type: DType, paddings_type: DType](output: LayoutTensor[type, output_layout, origin, address_space=address_space, element_layout=element_layout, layout_int_type=layout_int_type, linear_idx_type=linear_idx_type, masked=masked, alignment=alignment], input: LayoutTensor[type, input_layout, origin, address_space=address_space, element_layout=element_layout, layout_int_type=layout_int_type, linear_idx_type=linear_idx_type, masked=masked, alignment=alignment], paddings: UnsafePointer[SIMD[paddings_type, 1]])

Fill output with values from input, and edges padded boundary values from the unpadded region.

Example: var input = [[1, 2], [3, 4]] var paddings = [2, 2, 1, 0]

Yields: output = [[1, 1, 2], [1, 1, 2], [1, 1, 2], [3, 3, 4], [3, 3, 4], [3, 3, 4]]

Parameters:

  • output_layout (Layout): Layout of the output buffer.
  • input_layout (Layout): Layout of the input buffer.
  • type (DType): DType of the input/output buffer.
  • paddings_type (DType): DType of the input, output, and padding buffers.

Args:

  • output (LayoutTensor[type, output_layout, origin, address_space=address_space, element_layout=element_layout, layout_int_type=layout_int_type, linear_idx_type=linear_idx_type, masked=masked, alignment=alignment]): The output buffer.
  • input (LayoutTensor[type, input_layout, origin, address_space=address_space, element_layout=element_layout, layout_int_type=layout_int_type, linear_idx_type=linear_idx_type, masked=masked, alignment=alignment]): The input buffer.
  • paddings (UnsafePointer[SIMD[paddings_type, 1]]): Ordered (before, after) padding sizes for each axis.

Was this page helpful?