Skip to content
class

AlphaDropoutBackward

AlphaDropoutBackward

Python wrappers

Public Python APIs implemented by this engine symbols.

Autograd node for alpha-dropout — element-wise dropout that preserves the self-normalising statistics required by SELU activations.

Dropped elements are not zeroed but replaced with the SELU saturation value α′=−λα≈−1.7581\alpha' = -\lambda\alpha \approx -1.7581; an affine rescaling y↦a⋅y+by \mapsto a \cdot y + b is then applied so that the mean and variance of the post-dropout distribution match those of the input. The chain rule therefore collapses to ∂y/∂x=a⋅mask\partial y / \partial x = a \cdot \text{mask}, which is what apply evaluates using the saved raw mask.

Attributes

schema_v1OpSchema
Registered schema (name "alpha_dropout", version 1, AmpPolicy::KeepInput).
p_double
Drop probability used by the forward.
a_coef_double
Affine scale factor a=(keep (1+p α′2))−1/2a = \bigl(\text{keep}\,(1 + p\,\alpha'^2)\bigr)^{-1/2} saved for the backward.
mask_Storage
Raw {0,1}\{0, 1\} Bernoulli mask before any scaling.

Static methods

1
static

forward

→TensorImplPtr
int forward(const int & a, double p, bool training, Generator * gen)

Apply alpha dropout with SELU-preserving affine correction.

Math

\quad m_i \sim \text{Bernoulli}(1 - p),$$ with $a = \bigl(\text{keep}\,(1 + p\,\alpha'^2)\bigr)^{-1/2}$ and $b = -a\,p\,\alpha'$.

Parameters

aTensorImplPtr
Input tensor of any shape. Expected to follow a SELU activation; other activations break the statistical invariant the affine correction restores.
pdouble
Drop probability in [0,1)[0, 1).
trainingbool
If false, the forward is a pass-through.
Optional RNG (see DropoutBackward).

Returns

TensorImplPtr

Output tensor with the same shape and dtype as a.

Methods

3
fn

apply

int apply(int grad_out)

Backward: ∇xℓ=a⋅m⋅grad_out\nabla_x \ell = a \cdot m \cdot \text{grad\_out}.

Returns {grad_out * (mask_ * a_coef_)} when a mask is stored; otherwise (pass-through case) returns {clone(grad_out)}.

fn

apply_for_graph

int apply_for_graph(const int & grad_out)
fn

release_own_saved

void release_own_saved()