AlphaDropout#
- classtorch.nn.AlphaDropout(p=0.5,inplace=False)[source]#
Applies Alpha Dropout over the input.
Alpha Dropout is a type of Dropout that maintains the self-normalizingproperty.For an input with zero mean and unit standard deviation, the output ofAlpha Dropout maintains the original mean and standard deviation of theinput.Alpha Dropout goes hand-in-hand with SELU activation function, which ensuresthat the outputs have zero mean and unit standard deviation.
During training, it randomly masks some of the elements of the inputtensor with probabilityp using samples from a bernoulli distribution.The elements to masked are randomized on every forward call, and scaledand shifted to maintain zero mean and unit standard deviation.
During evaluation the module simply computes an identity function.
More details can be found in the paperSelf-Normalizing Neural Networks .
- Parameters
- Shape:
Input:. Input can be of any shape
Output:. Output is of the same shape as input
Examples:
>>>m=nn.AlphaDropout(p=0.2)>>>input=torch.randn(20,16)>>>output=m(input)