log_sigmoid

Contents

log_sigmoid#

class brainunit.math.log_sigmoid(x, unit_to_scale=None)#

Log-sigmoid activation function.

Computes the element-wise function:

\[\mathrm{log\_sigmoid}(x) = \log(\mathrm{sigmoid}(x)) = -\log(1 + e^{-x})\]
Parameters:
  • x (Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Input array. Must be unitless if a Quantity.

  • unit_to_scale (Unit | None) – Unit used to convert x to a dimensionless number before applying the activation.

Returns:

out – An array with non-positive values.

Return type:

Array

Examples

>>> import jax.numpy as jnp
>>> import saiunit.math as sumath
>>> sumath.log_sigmoid(jnp.array([-2., 0., 2.]))
Array([-2.126928  , -0.6931472 , -0.12692805], dtype=float32)