code: def make_kernel_bias_prior_spike_and_slab(
      kernel_shape,
      bias_shape,
      kernel_initializer=None,  # pylint: disable=unused-argument
      bias_initializer=None,  # pylint: disable=unused-argument
      kernel_batch_ndims=0,  # pylint: disable=unused-argument
      bias_batch_ndims=0,  # pylint: disable=unused-argument
      dtype=tf.float32,
      kernel_name="prior_kernel",
      bias_name="prior_bias",
  ):
      """Create prior for Variational layers with kernel and bias.
  
      Note: Distribution scale is inversely related to regularization strength.
      Consider a "Normal" prior; bigger scale corresponds to less L2 regularization.
      I.e.,
      ```python
      scale    = (2. * l2weight)**-0.5
      l2weight = scale**-2. / 2.
      ```
      have a similar regularizing effect.
  
      The std. deviation of each of the component distributions returned by this
      function is approximately `1415` (or approximately `l2weight = 25e-6`). In
      other words this prior is extremely "weak".
  
      Args:
        kernel_shape: ...
        bias_shape: ...
        kernel_initializer: Ignored.
          Default value: `None` (i.e., `tf_keras.initializers.glorot_uniform()`).
        bias_initializer: Ignored.
          Default value: `None` (i.e., `tf_keras.initializers.zeros()`).
        kernel_batch_ndims: ...
          Default value: `0`.
        bias_batch_ndims: ...
          Default value: `0`.
        dtype: ...
          Default value: `tf.float32`.
        kernel_name: ...
          Default value: `"prior_kernel"`.
        bias_name: ...
          Default value: `"prior_bias"`.
  
      Returns:
        kernel_and_bias_distribution: ...
      """
      w = MixtureSameFamily(
          mixture_distribution=Categorical(probs=[0.5, 0.5]),
          components_distribution=Normal(
              loc=0.0, scale=tf.constant([1.0, 2000.0], dtype=dtype)
          ),
      )
      return JointDistributionSequential(
          [
              Sample(w, kernel_shape, name=kernel_name),
              Sample(w, bias_shape, name=bias_name),
          ]
      )
  
file_path: probability/tensorflow_probability/python/experimental/nn/util/kernel_bias.py
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors.chain import Chain
  from tensorflow_probability.python.bijectors.shift import Shift
  from tensorflow_probability.python.bijectors.softplus import Softplus
  from tensorflow_probability.python.distributions.categorical import Categorical
  from tensorflow_probability.python.distributions.independent import Independent
  from tensorflow_probability.python.distributions.joint_distribution_sequential import JointDistributionSequential
  from tensorflow_probability.python.distributions.mixture_same_family import MixtureSameFamily
  from tensorflow_probability.python.distributions.normal import Normal
  from tensorflow_probability.python.distributions.sample import Sample
  from tensorflow_probability.python.experimental.nn import initializers
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tf_keras
  from tensorflow_probability.python.util.deferred_tensor import TransformedVariable
label_desc: Use image node_id 2 for calling a global function with example usage: make_kernel_bias_prior_spike_and_slab(kernel_shape, bias_shape, kernel_initializer, bias_initializer, kernel_batch_ndims, bias_batch_ndims, dtype, kernel_name, bias_name) and returns: JointDistributionSequential