giagrad.Tensor.elu#

Tensor.elu(alpha=1.0) Tensor[source]#

Creates a new Tensor applying Exponential Linear Unit (ELU) function to data. See ELU.

\[\begin{split}out_i = \begin{cases} data_i \ \ if \ \ data_i > 0 \\ \text{alpha}(\exp(data_i) - 1) \ \ if \ \ x \leq 0 \\ \end{cases}\end{split}\]
Parameters:

alpha (float) – The \(\alpha\) value for the ELU formulation.

Examples

>>> t = Tensor.empty(2, 3).uniform(-100, 100)
>>> t
tensor: [[-49.970577  35.522175 -14.944364]
         [ 32.187164 -66.65264   48.01228 ]]
>>> t.elu()
tensor: [[-1.        35.522175  -0.9999997]
         [32.187164  -1.        48.01228  ]] fn: ELU(alpha=1.0)