mlx_rs::opsFunction broadcast_to
Source pub fn broadcast_to(a: impl AsRef<Array>, shape: &[i32]) -> Result<Array>
Expand description
Broadcast an array to the given shape. Returns an error if the shapes are not broadcastable.
§Params
a
: The input array.
shape
: The shape to broadcast to.
§Example
use mlx_rs::{Array, ops::*};
let x = Array::from_float(2.3);
let result = broadcast_to(&x, &[1, 1]);