Skip to contents

Element-wise absolute value.

Usage

prim_abs(operand)

Arguments

operand

(arrayish)
Arrayish value of data type signed integer or floating-point.

Value

arrayish
Has the same shape and data type as the input. It is ambiguous if the input is ambiguous.

Implemented Rules

  • stablehlo

  • quickr

  • reverse

StableHLO

Lowers to stablehlo::hlo_abs().

See also

Examples

x <- nv_array(c(-1, 2, -3))
prim_abs(x)
#> AnvlArray
#>  1
#>  2
#>  3
#> [ CPUf32{3} ]