class torch.nn.Dropout(p: float = 0.5, inplace: bool = False)
During training, randomly zeroes some of the elements of the input tensor with probability
p using samples from a Bernoulli distribution. Each channel will be zeroed out independently on every forward call.
This has proven to be an effective technique for regularization and preventing the co-adaptation of neurons as described in the paper Improving neural networks by preventing co-adaptation of feature detectors .
Furthermore, the outputs are scaled by a factor of during training. This means that during evaluation the module simply computes an identity function.
True, will do this operation in-place. Default:
>>> m = nn.Dropout(p=0.2) >>> input = torch.randn(20, 16) >>> output = m(input)
© 2019 Torch Contributors
Licensed under the 3-clause BSD License.