fn
celu
→Tensorcelu(x: Tensor, alpha: float = 1.0, inplace: bool = False)Continuously-differentiable Exponential Linear Unit (Barron 2017).
A reparameterisation of elu whose first derivative is
continuous at the origin for every , not only the
specific value . This makes CELU friendlier to
optimisers that exploit smooth gradients.
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
At the origin both branches have derivative regardless of , removing the kink ELU has when . Reduces to ELU when .
Examples
>>> import lucid
>>> from lucid.nn.functional import celu
>>> x = lucid.tensor([-2.0, -1.0, 0.0, 1.0])
>>> celu(x, alpha=1.0)
Tensor([-0.8647, -0.6321, 0.0000, 1.0000])