Skip to contents

Broadcasts an array to a target shape using NumPy-style broadcasting rules.

Usage

nv_broadcast_to(operand, shape)

Arguments

operand

(arrayish)
Operand.

shape

(integer())
Target shape. Each existing dimension must either match or be 1.

Value

arrayish
Has the given shape and the same data type as operand.

See also

Examples

x <- nv_array(c(1, 2, 3))
nv_broadcast_to(x, shape = c(2, 3))
#> AnvlArray
#>  1 2 3
#>  1 2 3
#> [ CPUf32{2,3} ]