mlx_rs::ops

Function as_strided

Source
pub fn as_strided<'a>(
    a: impl AsRef<Array>,
    shape: impl IntoOption<&'a [i32]>,
    strides: impl IntoOption<&'a [usize]>,
    offset: impl Into<Option<usize>>,
) -> Result<Array>
Expand description

Create a view into the array with the given shape and strides.

ยงExample

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

let x = Array::from_iter(0..10, &[10]);
let y = as_strided(&x, &[3, 3], &[1, 1], 0);