Skip to contents

Adds two arrays element-wise.

Usage

prim_add(lhs, rhs)

Arguments

lhs, rhs

(arrayish)
Arrayish values of any data type. 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_add().

See also

Examples

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