Dropout1d#
- classtorch.nn.modules.dropout.Dropout1d(p=0.5,inplace=False)[source]#
Randomly zero out entire channels.
A channel is a 1D feature map,e.g., the-th channel of the-th sample in thebatched input is a 1D tensor.
Each channel will be zeroed out independently on every forward call withprobability
pusing samples from a Bernoulli distribution.Usually the input comes from
nn.Conv1dmodules.As described in the paperEfficient Object Localization Using Convolutional Networks ,if adjacent pixels within feature maps are strongly correlated(as is normally the case in early convolution layers) then i.i.d. dropoutwill not regularize the activations and will otherwise just resultin an effective learning rate decrease.
In this case,
nn.Dropout1d()will help promote independence betweenfeature maps and should be used instead.- Parameters
- Shape:
Input: or.
Output: or (same shape as input).
Examples:
>>>m=nn.Dropout1d(p=0.2)>>>input=torch.randn(20,16,32)>>>output=m(input)