Shortcuts

LPBNNLinear

class torch_uncertainty.layers.bayesian.LPBNNLinear(in_features, out_features, num_estimators, hidden_size=32, std_factor=0.01, bias=True, device=None, dtype=None)[source]

LPBNN-style linear layer.

Parameters:
  • in_features (int) – Number of input features.

  • out_features (int) – Number of output features.

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

  • 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.

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

  • 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.