Skip to contents

Element-wise sign.

Usage

nvl_sign(operand)

Arguments

operand

(tensorish)
Tensorish value of data type signed integer or floating-point.

Value

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

Implemented Rules

  • stablehlo

  • backward

StableHLO

Lowers to stablehlo::hlo_sign().

See also

Examples

jit_eval({
  x <- nv_tensor(c(-3, 0, 5))
  nvl_sign(x)
})
#> AnvilTensor
#>  -1
#>   0
#>   1
#> [ CPUf32{3} ]