fn
elu
→Tensorelu(x: Tensor, alpha: float = 1.0, inplace: bool = False)Exponential linear unit activation.
A smooth alternative to relu that saturates to on
the negative side instead of clipping at zero. The exponential branch
pushes the mean activation closer to zero, which speeds up training by
reducing internal covariate shift (Clevert et al. 2015).
Parameters
xTensorInput tensor of any shape; activation is element-wise.
alphafloat= 1.0Saturation value for negative inputs.
Default
1.0.inplacebool= FalseAccepted for API compatibility; currently ignored.
Returns
TensorActivated tensor with the same shape as x.
Notes
Continuous and once-differentiable at the origin (derivative is from above and from below — equal when ). Unlike ReLU it produces negative outputs, which helps push activation means toward zero; unlike Leaky ReLU it bounds the negative tail, providing implicit noise robustness.
Examples
>>> import lucid
>>> from lucid.nn.functional import elu
>>> x = lucid.tensor([-2.0, -1.0, 0.0, 1.0])
>>> elu(x)
Tensor([-0.8647, -0.6321, 0.0000, 1.0000])