Skip to content
fn

alpha_dropout

→Tensor
alpha_dropout(input: Tensor, p: float = 0.5, training: bool = False, inplace: bool = False)

Implementing kernel

C++ engine symbols that back this Python API.

Alpha dropout — variance-preserving dropout for SELU networks.

Designed to be paired with the SELU activation (Klambauer et al. 2017 "Self-Normalizing Neural Networks"). Standard dropout breaks the carefully-tuned zero-mean / unit-variance propagation that makes SELU networks self-normalising; alpha dropout fixes this by replacing dropped activations with the SELU saturation value α′=−α⋅scale\alpha' = -\alpha \cdot \text{scale} (rather than zero), then applying an affine rescaling chosen so that the post-dropout activations again have zero mean and unit variance.

Parameters

inputTensor
Input tensor, any shape.
pfloat= 0.5
Element-drop probability in [0,1][0, 1] (default 0.5).
trainingbool= False
When False, identity (default False).
inplacebool= False
If True, write the result into input and return input (default False).

Returns

Tensor

Same shape and dtype as input.

Notes

With keep probability q=1−pq = 1 - p, each element is independently set to its original value (with probability qq) or to α′\alpha' (with probability pp). The result is then affine-transformed:

y=a⋅mix(x,α′)+b,a=(q+p (α′)2 q)−1/2,b=−a α′ p,y = a \cdot \mathrm{mix}(x, \alpha') + b, \quad a = \big(q + p\,(\alpha')^2\,q\big)^{-1/2}, \quad b = -a\,\alpha'\,p,

chosen so that E[y]=0\mathbb{E}[y] = 0 and Var(y)=1\mathrm{Var}(y) = 1 when the input has zero mean and unit variance.

Examples

>>> import lucid
>>> from lucid.nn.functional import alpha_dropout
>>> x = lucid.randn(8)
>>> y = alpha_dropout(x, p=0.1, training=True)

Used by 2