Skip to contents

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

Usage

nv_broadcast_to(x, shape)

Arguments

x

(arrayish)
Input array.

shape

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

Value

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

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} ]