Skip to contents

Broadcast scalar arrays to match the shape of non-scalar arrays. All non-scalar arrays must have the same shape.

Usage

nv_broadcast_scalars(...)

Arguments

...

(arrayish)
Arrays to broadcast. Scalars will be broadcast to the common non-scalar shape.

Value

(list() of arrayish)
List of broadcasted arrays.

Examples

x <- nv_array(c(1, 2, 3))
# scalar 1 is broadcast to shape [3]
nv_broadcast_scalars(x, nv_scalar(1))
#> [[1]]
#> AnvlArray
#>  1
#>  2
#>  3
#> [ CPUf32{3} ] 
#> 
#> [[2]]
#> AnvlArray
#>  1
#>  1
#>  1
#> [ CPUf32{3} ] 
#>