mlx_rs::ops

Function split

Source
pub fn split(
    a: impl AsRef<Array>,
    indices: &[i32],
    axis: impl Into<Option<i32>>,
) -> Result<Vec<Array>>
Expand description

Split an array along a given axis. Returns an error if the indices are invalid.

§Params

  • a: The input array.
  • indices: The indices to split at.
  • axis: The axis to split along. Default is 0 if not provided.

§Example

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

let a = Array::from_iter(0..10, &[10]);
let result = split(&a, &[3, 7], 0);