mlx_rs::opsFunction reshape
Source pub fn reshape(a: impl AsRef<Array>, shape: &[i32]) -> Result<Array>
Expand description
Reshape an array while preserving the size. Returns an error if the new shape is invalid.
§Params
a
: The input array.
shape
: New shape.
§Example
use mlx_rs::{Array, ops::*};
let x = Array::zeros::<i32>(&[2, 2]).unwrap();
let result = reshape(&x, &[4]);