class_docstr: Abstract densely-connected class (private, used as implementation base).
  
  This layer implements the Bayesian variational inference analogue to
  a dense layer by assuming the `kernel` and/or the `bias` are drawn
  from distributions. By default, the layer implements a stochastic
  forward pass via sampling from the kernel and bias posteriors,
  
  ```none
  kernel, bias ~ posterior
  outputs = activation(matmul(inputs, kernel) + bias)
  ```
  
  The arguments permit separate specification of the surrogate posterior
  (`q(W|x)`), prior (`p(W)`), and divergence for both the `kernel` and `bias`
  distributions.
code: def build(self, input_shape):
      input_shape = tf.TensorShape(input_shape)
      in_size = tf.compat.dimension_value(
          input_shape.with_rank_at_least(2)[-1]
      )
      if in_size is None:
          raise ValueError(
              "The last dimension of the inputs to `Dense` "
              "should be defined. Found `None`."
          )
      self._input_spec = tf_keras.layers.InputSpec(
          min_ndim=2, axes={-1: in_size}
      )
  
      # If self.dtype is None, build weights using the default dtype.
      dtype = tf.as_dtype(self.dtype or tf_keras.backend.floatx())
  
      # Must have a posterior kernel.
      self.kernel_posterior = self.kernel_posterior_fn(
          dtype,
          [in_size, self.units],
          "kernel_posterior",
          self.trainable,
          self.add_variable,
      )
  
      if self.kernel_prior_fn is None:
          self.kernel_prior = None
      else:
          self.kernel_prior = self.kernel_prior_fn(
              dtype,
              [in_size, self.units],
              "kernel_prior",
              self.trainable,
              self.add_variable,
          )
  
      if self.bias_posterior_fn is None:
          self.bias_posterior = None
      else:
          self.bias_posterior = self.bias_posterior_fn(
              dtype,
              [self.units],
              "bias_posterior",
              self.trainable,
              self.add_variable,
          )
  
      if self.bias_prior_fn is None:
          self.bias_prior = None
      else:
          self.bias_prior = self.bias_prior_fn(
              dtype,
              [self.units],
              "bias_prior",
              self.trainable,
              self.add_variable,
          )
  
      self.built = True
  
imports: import tensorflow.compat.v2
  from tensorflow_probability.python import random
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import docstring_util
  from tensorflow_probability.python.internal import tf_keras
  from tensorflow_probability.python.layers import util
  from tensorflow_probability.python.util import SeedStream
label_desc: Use image node_id 2 for calling the _DenseVariational obj's underlying member method code with example usage: obj.build(input_shape) without return types