What is the difference between nn.Dropout2d and nn.Dropout?

Hi all,

Can someone please explain to me the difference between nn.Dropout2d and nn.Dropout

Thanks for your help

2 Likes

nn.Dropout - Input can be of any shape.

nn.Dropout2d - Input (N, C, H, W).

Usually the input comes from nn.Conv2d modules.
If adjacent pixels within feature maps are strongly correlated (as is normally the case in early convolution layers) then i.i.d. dropout will not regularize the activations and will otherwise just result in an effective learning rate decrease.

In this case, nn.Dropout2d() will help promote independence between feature maps and should be used instead.

7 Likes

Thanks a lot @1chimaruGin for this explanation. Now I understand better.