Skip to contents

Element-wise logistic sigmoid: 1 / (1 + exp(-x)).

Usage

prim_logistic(x)

Arguments

x

(arrayish)
One input. Can be any float data type. An R value materializes at its default data type.

Value

(arrayish)
Has the input's shape and data type.

Implemented Rules

  • stablehlo

  • quickr

  • reverse

StableHLO

Lowers to hlo_logistic(), specified under logistic.

See also

Examples

# the input's data type carries through
x <- nv_array(c(-2, 0, 2))
prim_logistic(x)
#> AnvlArray
#>  0.1192
#>  0.5000
#>  0.8808
#> [ CPUf32{3} ] 

# an R value materializes at its default data type
prim_logistic(2)
#> AnvlArray
#>  0.8808
#> [ CPUf32{} ]