Skip to contents

Subtracts two tensors element-wise.

Usage

nvl_sub(lhs, rhs)

Arguments

lhs, rhs

(tensorish)
Tensorish values of data type integer, unsigned integer, or floating-point. Must have the same shape.

Value

tensorish
Has the same shape and data type as the inputs. It is ambiguous if both inputs are ambiguous.

Implemented Rules

  • stablehlo

  • backward

StableHLO

Lowers to stablehlo::hlo_subtract().

See also

Examples

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