Mojo function
transpose
transpose[rank: Int, type: DType, //](output: NDBuffer[type, rank, origin, shape], input: NDBuffer[type, rank, origin, shape], perms: UnsafePointer[SIMD[index, 1]])
Permute the axis of input
based on perms
, and place the result in output
.
Example:
transpose(output, input, [2, 0, 1])
# guarantees output[x, y, z] = input[z, x, y]
transpose(output, input, [2, 0, 1])
# guarantees output[x, y, z] = input[z, x, y]
Parameters:
- rank (
Int
): The rank of input and output buffers. - type (
DType
): The dtype of buffer elements.
Args:
- output (
NDBuffer[type, rank, origin, shape]
): The output buffer. - input (
NDBuffer[type, rank, origin, shape]
): The input buffer. - perms (
UnsafePointer[SIMD[index, 1]]
): Permutation of the input axes.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!