softplus — SciPy v1.15.2 Manual (original) (raw)
scipy.special.
scipy.special.softplus(x, **kwargs)[source]#
Compute the softplus function element-wise.
The softplus function is defined as: softplus(x) = log(1 + exp(x))
. It is a smooth approximation of the rectifier function (ReLU).
Parameters:
xarray_like
Input value.
**kwargs
For other keyword-only arguments, see theufunc docs.
Returns:
softplusndarray
Logarithm of exp(0) + exp(x)
.
Examples
from scipy import special
special.softplus(0) 0.6931471805599453
special.softplus([-1, 0, 1]) array([0.31326169, 0.69314718, 1.31326169])