BayesianAlphaDropout#

class torchbayesian.bnn.BayesianAlphaDropout(p: float = 0.5, inplace: bool = False)#

Bases: _DropoutNd

This class is an implementation of ‘torch.nn.AlphaDropout’ that remains active in eval mode.

This is used for Bayesian neural networks (BNN) via Monte Carlo dropout (MCD).

Parameters#

pfloat

The probability of an element to be zeroed. Defaults to 0.5.

inplacebool

If set to ‘True’, will do this operation in-place. Defaults to ‘False’.

forward(input: Tensor) Tensor#

Forward pass.

Parameters#

inputTensor

The input Tensor.

Returns#

outputTensor

The output tensor