mlx_rs::opsFunction broadcast_to_device
Source pub fn broadcast_to_device(
a: impl AsRef<Array>,
shape: &[i32],
stream: impl AsRef<Stream>,
) -> 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]);