fn
silu
→Tensorsilu(x: Tensor, inplace: bool = False)Sigmoid Linear Unit (a.k.a. Swish-1) activation.
Smooth, non-monotonic activation popularised by Ramachandran et al. (2017) as the result of a neural architecture search over activation functions. Equivalent to Swish with .
Parameters
xTensorInput tensor of any shape; activation is element-wise.
inplacebool= FalseAccepted for API compatibility; currently ignored.
Returns
TensorActivated tensor with the same shape as x.
Notes
Has a small negative bump near (minimum value ); approaches 0 from below for large negative input and approaches the identity for large positive input. The derivative is
which is smooth and unbounded above. Often outperforms ReLU in deep CNNs and is the default in EfficientNet and many MoE blocks.
Examples
>>> import lucid
>>> from lucid.nn.functional import silu
>>> x = lucid.tensor([-2.0, -1.0, 0.0, 1.0, 2.0])
>>> silu(x)
Tensor([-0.2384, -0.2689, 0.0000, 0.7311, 1.7616])