mlx_rs::ops

Function squeeze

Source
pub fn squeeze<'a>(
    a: impl AsRef<Array>,
    axes: impl IntoOption<&'a [i32]>,
) -> Result<Array>
Expand description

Remove length one axes from an array. Returns an error if the axes are invalid.

§Params

  • a: The input array.
  • axes: Axes to remove. If None, all length one axes will be removed.

§Example

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

let x = Array::zeros::<i32>(&[1, 2, 1, 3]).unwrap();
let result = squeeze(&x, None);