Skip to contents

Element-wise check if values are finite (not Inf, -Inf, or NaN).

Usage

prim_is_finite(operand)

Arguments

operand

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

Value

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

Implemented Rules

  • stablehlo

  • reverse

StableHLO

Lowers to stablehlo::hlo_is_finite().

See also

Examples

x <- nv_array(c(1, Inf, NaN, -Inf, 0))
prim_is_finite(x)
#> AnvlArray
#>  1
#>  0
#>  0
#>  0
#>  1
#> [ CPUbool{5} ]