public class Dropout<T extends AbstractFloat = Float> extends Layer<T>
Random element-wise dropout during training, identity during inference. Kept values are multiplied by 1/(1-rate). Each training call advances a layer-local seed; equal seeds reproduce the same sequence of masks. A layer is not safe for concurrent training. Saved masks belong to individual passes, so a second forward call does not overwrite the first backward context.
model = Sequential<Float>([Dense<Float>(64), Dropout<Float>(0.25), Dense<Float>(10)])
| Modifier and Type | Member | Description |
|---|---|---|
| public override readonly property | displayNamedisplayName as String |
Summary label. |
| public override readonly property | parameterCountparameterCount as ULong |
No trainable parameters. |
| public readonly property | randomStaterandomState as Long |
Current random state; restoring it reproduces the next mask. |
| public readonly property | raterate as Double |
Drop probability in [0, 1). |
| Modifier and Type | Member | Description |
|---|---|---|
| public | Dropout | Configures independent, reproducible dropout without touching global randomness. |
| Modifier and Type | Member | Description |
|---|---|---|
| public override | backwardTrainingbackwardTraining(context as LayerPass<T>, upstream as NDArray<T>) as LayerGradients<T> |
Reuses exactly the keep flags of the corresponding forward pass. |
| public override | buildShape | Preserves any positive sample shape. |
| public override | differentiatedifferentiate(inputs as NDArray<T>, upstream as NDArray<T>) as LayerGradients<T> |
Differentiates inference, where dropout is the identity. |
| public override | forward | Returns inputs unchanged during inference, with no allocation or random draw. |
| public override | forwardTraining | Samples a fresh mask and retains it only in the returned context. |
| public override | parameter | Rejects parameter access. |