Dropout#
- class brainstate.nn.Dropout(prob=0.5, broadcast_dims=(), name=None)#
A layer that stochastically ignores a subset of inputs each training step.
In training, to compensate for the fraction of input values dropped (rate), all surviving values are multiplied by 1 / (1 - rate).
This layer is active only during training (
mode=brainstate.mixin.Training). In other circumstances it is a no-op.- Parameters:
References
Examples
>>> import brainstate >>> layer = brainstate.nn.Dropout(prob=0.8) >>> x = brainstate.random.randn(10, 20) >>> with brainstate.environ.context(fit=True): ... output = layer(x) >>> output.shape (10, 20)