Probabilistic Dropout Layer Baseclass

This is the parent class to all Probabilistic Dropout methods as laid out by Gal et al [41]. The ProbabilisticDropoutLayer is an abstract baseclass and a subclass of torch.nn.Module.

The documentation in the forward() and extra_repr() on this page may be inherited from PyTorch docstrings.

Methods

class ProbabilisticDropoutLayer(p=0.5, inplace=False, dropping=True, **kwargs)[source]

Randomly zero out some elements of a tensor

Parameters:
  • p (float) – Probability of an element to be zeroed. Default: 0.5

  • inplace (bool) – If True, will do this operation in-place. Default: False

  • dropping (bool) – If True, will perform dropout, otherwise acts as identity function. Default: True

abstract forward(x)[source]

Define the computation performed at every call.

Should be overridden by all subclasses. :rtype: Tensor

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

extra_repr()[source]

Return the extra representation of the module.

To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.

Return type:

str