class_docstr: Layer of our BNN.
class_docstr_tok: ["Layer","of","our","BNN","."]
docstr: Initialization of our layer : our prior is a normal distribution
  centered in 0 and of variance 20.
docstr_tok: ["Initialization","of","our","layer",":","our","prior","is","a","normal","distribution","centered","in","0","and","of","variance","20","."]
code: def __init__(
      self,
      input_dim,
      output_dim,
      activation,
      orthogonal_init: bool = False,
      min_std: float = 0.0,
      prior_var: float = 1.0,
  ) -> None:
      """
      Initialization of our layer : our prior is a normal distribution
      centered in 0 and of variance 20.
      """
      # initialize layers
      super().__init__()
      # set input and output dimensions
      self.input_dim = input_dim
      self.output_dim = output_dim
  
      # initialize mu and rho parameters for the weights of the layer
      self.w_mu = nn.Parameter(torch.zeros(output_dim, input_dim))
      self.w_rho = nn.Parameter(torch.zeros(output_dim, input_dim))
  
      gain = torch.nn.init.calculate_gain(activation)
      if orthogonal_init:
          # provably better https://openreview.net/forum?id=rkgqN1SYvr
          nn.init.orthogonal_(self.w_mu.data, gain=gain)
          nn.init.orthogonal_(self.w_rho.data, gain=gain)
      else:
          # gaussian init
          gaussian_fill_w_gain(
              self.w_mu, gain=gain, dim_in=input_dim, min_std=min_std
          )
          gaussian_fill_w_gain(
              self.w_rho, gain=gain, dim_in=input_dim, min_std=min_std
          )
  
      # initialize mu and rho parameters for the layer's bias
      self.b_mu = nn.Parameter(torch.zeros(output_dim))
      self.b_rho = nn.Parameter(torch.zeros(output_dim))
  
      # initialize weight samples (these will be calculated whenever the layer makes a prediction)
      self.w = None
      self.b = None
      self.log_prior = None
      self.w_post = None
      self.b_post = None
      self.log_post = None
  
      # initialize prior distribution for all of the weights and biases
      self.prior = torch.distributions.Normal(0, prior_var)
  
imports: import logging
  from typing import List
  import torch
  import torch.nn
  import torch.nn.functional
  from reagent.models.base import ModelBase
  from reagent.models.fully_connected_network import ACTIVATION_MAP, gaussian_fill_w_gain, SlateBatchNorm1d
  from torch.distributions import Normal
label_desc: Use image node_id 1 to create a new LinearBBB object from inherited base classes: ModelBase with example: obj = LinearBBB(input_dim, output_dim, activation, orthogonal_init, min_std, prior_var)