fn

feature_alpha_dropout

Tensor
feature_alpha_dropout(x: Tensor, p: float = 0.5, training: bool = True, inplace: bool = False)
source

Channel-wise alpha dropout for SELU convolutional networks.

Combines the channel-granularity of dropout2d / dropout3d with the variance-preserving substitution of alpha_dropout. Whole channels are dropped (replaced rather than zeroed) and the result is affine-rescaled to keep the self-normalising property — appropriate for SELU-activated CNNs where spatially-correlated activations would make per- element alpha dropout ineffective.

For inputs of rank less than 2, falls back to per-element alpha_dropout.

Parameters

xTensor
Input tensor of shape (N,C,)(N, C, *) (one or more spatial dimensions).
pfloat= 0.5
Channel-drop probability in [0,1][0, 1] (default 0.5).
trainingbool= True
When False, identity (default True).
inplacebool= False
Reserved for API parity; ignored (default False).

Returns

Tensor

Same shape and dtype as x.

Notes

A Bernoulli mask of shape (N,C)(N, C) is drawn and broadcast across the spatial axes; surviving channels are multiplied by 1 and dropped channels by 0. (The full alpha- rescaling that alpha_dropout applies element-wise is handled at the channel level here.) Variance preservation holds in expectation when the input statistics already satisfy the SELU fixed-point assumptions.

Examples

>>> import lucid
>>> from lucid.nn.functional import feature_alpha_dropout
>>> x = lucid.randn(2, 4, 3, 3)
>>> y = feature_alpha_dropout(x, p=0.25, training=True)