Skip to contents

Multiplies two tensors element-wise. You can also use the * operator.

Usage

nv_mul(lhs, rhs)

Arguments

lhs, rhs

(tensorish)
Left and right operand. Operands are promoted to a common data type. Scalars are broadcast to the shape of the other operand.

Value

tensorish
Has the same shape and the promoted common data type of the inputs.

See also

nvl_mul() for the underlying primitive.

Examples

jit_eval({
  x <- nv_tensor(c(1, 2, 3))
  y <- nv_tensor(c(4, 5, 6))
  x * y
})
#> AnvilTensor
#>   4
#>  10
#>  18
#> [ CPUf32{3} ]