mlx_rs::ops

Function move_axis

Source
pub fn move_axis(a: impl AsRef<Array>, src: i32, dst: i32) -> Result<Array>
Expand description

Move an axis to a new position. Returns an error if the axes are invalid.

§Params

  • a: The input array.
  • src: Specifies the source axis.
  • dst: Specifies the destination axis.

§Example

use mlx_rs::{Array, ops::*};

let a = Array::zeros::<i32>(&[2, 3, 4]).unwrap();
let result = move_axis(&a, 0, 2);