List of Probabilistic Dropout Layers
All dropout layers are nearly identical implementations to their counterparts in Pytorch, based on the work by Gal et al [41].
The difference is these class have a dropping attribute that controls whether or not they are
active, rather than relying on the training attribute as Pytorch’s implementations do.
This allows us to more conveniently call the dropout methods on forward calls of a neural network, which is helpful for various computations in uncertainty quantification.
Probabilistic Dropout
Randomly zero out elements.
The ProbabilisticDropout class is imported using the following command:
>>> from UQpy.scientific_machine_learning import ProbabilisticDropout
- class ProbabilisticDropout(p=0.5, inplace=False, dropping=True, **kwargs)[source]
Randomly zero out some elements of the input tensor with probability \(p\)
- Parameters:
Shape:
Input: Any shape
Output: Any shape (same shape as input)
Example:
>>> dropout = sml.ProbabilisticDropout(p=0.75) >>> input = torch.rand(12, 100) >>> output = dropout(input)
Probabilistic Dropout 1d
Randomly zero out entire 1d feature maps.
The ProbabilisticDropout1d class is imported using the following command:
>>> from UQpy.scientific_machine_learning import ProbabilisticDropout1d
- class ProbabilisticDropout1d(p=0.5, inplace=False, dropping=True, **kwargs)[source]
Randomly zero out entire channels with probability \(p\)
A channel is a 1D feature map
- Parameters:
Shape:
Input: \((N, C, L)\) or \((C, L)\)
Output: \((N, C, L)\) or \((C, L)\) (same shape as input)
Example:
>>> dropout = sml.ProbabilisticDropout1d(p=0.6) >>> input = torch.rand(10, 3, 200) >>> output = dropout(input)
Probabilistic Dropout 2d
Randomly zero out entire 2d feature maps.
The ProbabilisticDropout2d class is imported using the following command:
>>> from UQpy.scientific_machine_learning import ProbabilisticDropout2d
- class ProbabilisticDropout2d(p=0.5, inplace=False, dropping=True, **kwargs)[source]
Randomly zero out entire channels with probability \(p\)
A channel is a 2D feature map.
- Parameters:
Shape:
Input: \((N, C, H, W)\)
Output: \((N, C, H, W)\)
Example:
>>> dropout = sml.ProbabilisticDropout2d(p=0.3) >>> input = torch.rand(10, 5, 30, 40) >>> output = dropout(input)
Probabilistic Dropout 3d
Randomly zero out entire 3d feature maps.
The ProbabilisticDropout3d class is imported using the following command:
>>> from UQpy.scientific_machine_learning import ProbabilisticDropout3d
- class ProbabilisticDropout3d(p=0.5, inplace=False, dropping=True, **kwargs)[source]
Randomly zero out entire channels with probability \(p\)
A channel is a 3D feature map.
- Parameters:
Shape:
Input: \((N, C, D, H, W)\) or \((C, D, H, W)\)
Output: \((N, C, D, H, W)\) or \((C, D, H, W)\) (same shape as input)
Example:
>>> dropout = sml.ProbabilisticDropout3d(p=0.4) >>> input = torch.rand(2, 4, 8, 16, 32) >>> output = dropout(input)