Mojo function
pad_reflect
pad_reflect[output_layout: Layout, input_layout: Layout, type: DType, paddings_type: DType](output: LayoutTensor[type, output_layout, origin, 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, 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 with reflected values from the unpadded region.
Example: var input = [[1, 2], [3, 4]] var paddings = [2, 2, 1, 0]
Yields: output = [[2, 1, 2], [4, 3, 4], [2, 1, 2], [4, 3, 4], [2, 1, 2], [4, 3, 4]]
Args:
- output (
LayoutTensor[type, output_layout, origin, 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, 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?
Thank you! We'll create more content like this.
Thank you for helping us improve!