Skip to contents

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

Usage

nv_broadcast_to(operand, shape)

Arguments

operand

(tensorish)
Operand.

shape

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

Value

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

See also

Examples

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