logistic

Contents

logistic#

class brainunit.lax.logistic(x, unit_to_scale=None, **kwargs)#

Elementwise logistic (sigmoid) function: \(\frac{1}{1 + e^{-x}}\).

Parameters:
  • x (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Input array. Must be dimensionless or scaled via unit_to_scale.

  • unit_to_scale (saiunit.Unit | None) – If provided, x is scaled by this unit before applying the function.

Returns:

result – Always unitless.

Return type:

Array

Examples

>>> import saiunit as u
>>> import saiunit.lax as sulax
>>> import jax.numpy as jnp
>>> sulax.logistic(jnp.array([0.0, 1.0, -1.0]))
Array([0.5       , 0.7310586 , 0.26894143], dtype=float32)