Skip to contents

Element-wise sign.

Usage

prim_sign(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

  • reverse

StableHLO

Lowers to stablehlo::hlo_sign().

See also

Examples

x <- nv_array(c(-3, 0, 5))
prim_sign(x)
#> AnvlArray
#>  -1
#>   0
#>   1
#> [ CPUf32{3} ]