Shortcuts

LPBNNConv2d

class torch_uncertainty.layers.bayesian.LPBNNConv2d(in_channels, out_channels, num_estimators, kernel_size, stride=1, padding=0, groups=1, hidden_size=32, std_factor=0.01, gamma=True, bias=True, padding_mode='zeros', device=None, dtype=None)[source]

LPBNN-style 2D convolutional layer.

Parameters:
  • in_channels (int) – Number of input channels.

  • out_channels (int) – Number of output channels.

  • num_estimators (int) – Number of models to sample from.

  • kernel_size (int or tuple) – Size of the convolving kernel.

  • stride (int or tuple, optional) – Stride of the convolution. Default: 1.

  • padding (int or tuple, optional) – Zero-padding added to both sides of the input. Default: 0.

  • groups (int, optional) – Number of blocked connections from input channels to output channels. Default: 1.

  • hidden_size (int) – Size of the hidden layer. Defaults to 32.

  • std_factor (float) – Factor to multiply the standard deviation of the latent noise. Defaults to 1e-2.

  • gamma (bool) – If True, adds a learnable gamma to the output. Defaults to True.

  • bias (bool) – If True, adds a learnable bias to the output. Defaults to True.

  • padding_mode (str) – ‘zeros’, ‘reflect’, ‘replicate’ or ‘circular’. Default: ‘zeros’.

  • device (torch.device) – Device on which the layer is stored. Defaults to None.

  • dtype (torch.dtype) – Data type of the layer. Defaults to None.

Reference:

Encoding the latent posterior of Bayesian Neural Networks for uncertainty quantification.