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 (
Union[int,tuple[int,int]]) – Size of the convolving kernel.stride (
Union[int,tuple[int,int]]) – Stride of the convolution. Default:1.padding (
Union[str,int,tuple[int,int]]) – Zero-padding added to both sides of the input. Default:0.groups (
int) – Number of blocked connections from input channels to output channels. Default:1.hidden_size (
int) – Size of the hidden layer. Defaults to32.std_factor (
float) – Factor to multiply the standard deviation of the latent noise. Defaults to1e-2.gamma (
bool) – IfTrue, adds a learnable gamma to the output. Defaults toTrue.bias (
bool) – IfTrue, adds a learnable bias to the output. Defaults toTrue.padding_mode (
Literal['circular','reflect','replicate','zeros']) – ‘zeros’, ‘reflect’, ‘replicate’ or ‘circular’. Default: ‘zeros’.device – Device on which the layer is stored. Defaults to
None.dtype – Data type of the layer. Defaults to
None.
References
[1] Encoding the latent posterior of Bayesian Neural Networks for uncertainty quantification.