Skip to contents

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

Usage

nv_sub(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_sub() for the underlying primitive.

Examples

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