elu#
- class saiunit.math.elu(x, alpha=1.0, unit_to_scale=None)#
Exponential linear unit activation function.
Computes the element-wise function:
\[\begin{split}\mathrm{elu}(x) = \begin{cases} x, & x > 0\\ \alpha \left(\exp(x) - 1\right), & x \le 0 \end{cases}\end{split}\]- Parameters:
x (
Quantity|Array|ndarray|bool|number|bool|int|float|complex) – Input array. Must be unitless if aQuantity.alpha (
Array|ndarray|bool|number|bool|int|float|complex) – Scale for the negative region. Default is 1.0.unit_to_scale (
Unit|None) – Unit used to convertxto a dimensionless number before applying the activation.
- Returns:
out – An array with the same shape as x.
- Return type:
Array
Examples
>>> import jax.numpy as jnp >>> import saiunit.math as sumath >>> sumath.elu(jnp.array([-2., 0., 2.])) Array([-0.86466473, 0. , 2. ], dtype=float32) >>> sumath.elu(jnp.array([-1., 1.]), alpha=2.0) Array([-1.2642411, 1. ], dtype=float32)