Mojo function
pad_reflect
pad_reflect[dtype: DType, paddings_type: DType](output: TileTensor[dtype, output.LayoutType, output.origin, linear_idx_type=output.linear_idx_type, element_size=output.element_size], input: TileTensor[dtype, input.LayoutType, input.origin, linear_idx_type=input.linear_idx_type, element_size=input.element_size], paddings: UnsafePointer[Scalar[paddings_type], paddings.origin])
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 (
TileTensor): The output buffer. - โinput (
TileTensor): The input buffer. - โpaddings (
UnsafePointer): 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!