mlx_broadcast_arrays() mirrors mlx.core.broadcast_arrays(),
returning a list of inputs expanded to a common shape.
Arguments
- ...
One or more arrays (or a single list) convertible via
as_mlx().- device
Execution target: supply
"gpu","cpu", or anmlx_streamcreated viamlx_new_stream(). Defaults to the currentmlx_default_device()unless noted otherwise (helpers that act on an existing array typically reuse that array's device or stream).
Examples
a <- mlx_matrix(1:3, nrow = 1)
b <- mlx_matrix(1:3, ncol = 1)
outs <- mlx_broadcast_arrays(a, b)
lapply(outs, dim)
#> [[1]]
#> [1] 3 3
#>
#> [[2]]
#> [1] 3 3
#>