Function squeeze_axes

Source
pub fn squeeze_axes(a: impl AsRef<Array>, axes: &[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);