mlx_rs::ops

Function stack_device

Source
pub fn stack_device(
    arrays: &[impl AsRef<Array>],
    axis: i32,
    stream: impl AsRef<Stream>,
) -> Result<Array>
Expand description

Stacks the arrays along a new axis. Returns an error if the arguments are invalid.

§Params

  • arrays: The input arrays.
  • axis: The axis in the result array along which the input arrays are stacked.

§Example

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

let a = Array::from_iter(0..4, &[2, 2]);
let b = Array::from_iter(4..8, &[2, 2]);
let result = stack(&[&a, &b], 0);