Skip to contents

Subtracts two arrays element-wise.

Usage

prim_sub(lhs, rhs)

Arguments

lhs, rhs

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

Value

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

Implemented Rules

  • stablehlo

  • quickr

  • reverse

StableHLO

Lowers to stablehlo::hlo_subtract().

See also

Examples

x <- nv_array(c(1, 2, 3))
y <- nv_array(c(4, 5, 6))
prim_sub(x, y)
#> AnvlArray
#>  -3
#>  -3
#>  -3
#> [ CPUf32{3} ]