Python wrappers
Public Python APIs implemented by this engine symbols.Autograd node for channel-wise Dropout.
A single Bernoulli value is drawn per (batch, channel) pair on a
compact mask, then expanded by the backend
to the full input shape so that entire feature-map channels are
zeroed together. This is the C++ kernel behind the Python
Dropout1d / Dropout2d / Dropout3d modules — input rank
must be at least 2 and the layout is assumed to be
.
Attributes
schema_v1OpSchemaRegistered schema (name
"dropoutnd", version 1, AmpPolicy::KeepInput).p_doubleDrop probability used by the forward; stored for the backward.
mask_StorageFull-resolution mask after the broadcast — same shape as the input. Saved so the backward is a single multiply.
Static methods
1static
forward
→TensorImplPtrint forward(const int & a, double p, bool training, Generator * gen)Sample a channel mask and broadcast-multiply with the input.
Math
\dfrac{x_{n,c,\ldots}}{1 - p} & \text{with probability } 1 - p\\[4pt] \mathbf{0} & \text{with probability } p \end{cases}$$Parameters
aTensorImplPtrInput tensor of rank in layout .
pdoubleChannel drop probability in .
trainingboolIf
false, the forward is a pass-through.genGenerator*Optional RNG (see
DropoutBackward).Returns
TensorImplPtrOutput tensor with the same shape and dtype as a.
Raises
LucidErrorIf
a has fewer than 2 dimensions, p is outside , or deterministic mode is on without a Generator.