Skip to contents

mlx_swapaxes() mirrors mlx.core.swapaxes(), exchanging two dimensions while leaving others intact.

Usage

mlx_swapaxes(x, axis1, axis2)

Arguments

x

An mlx array.

axis1, axis2

Axes to swap (1-indexed, negatives count from the end).

Value

An mlx array with the specified axes exchanged.

Examples

x <- as_mlx(array(1:24, dim = c(2, 3, 4)))
swapped <- mlx_swapaxes(x, axis1 = 1, axis2 = 3)
dim(swapped)
#> [1] 4 3 2