code: def bayesian_vgg(
      input_shape,
      num_classes=10,
      kernel_posterior_scale_mean=-9.0,
      kernel_posterior_scale_stddev=0.1,
      kernel_posterior_scale_constraint=0.2,
  ):
      """Constructs a VGG16 model.
  
      Args:
        input_shape: A `tuple` indicating the Tensor shape.
        num_classes: `int` representing the number of class labels.
        kernel_posterior_scale_mean: Python `int` number for the kernel
          posterior's scale (log variance) mean. The smaller the mean the closer
          is the initialization to a deterministic network.
        kernel_posterior_scale_stddev: Python `float` number for the initial kernel
          posterior's scale stddev.
          ```
          q(W|x) ~ N(mu, var),
          log_var ~ N(kernel_posterior_scale_mean, kernel_posterior_scale_stddev)
          ````
        kernel_posterior_scale_constraint: Python `float` number for the log value
          to constrain the log variance throughout training.
          i.e. log_var <= log(kernel_posterior_scale_constraint).
  
      Returns:
        tf_keras.Model.
      """
  
      filters = [64, 128, 256, 512, 512]
      kernels = [3, 3, 3, 3, 3]
      strides = [2, 2, 2, 2, 2]
  
      def _untransformed_scale_constraint(t):
          return tf.clip_by_value(
              t, -1000, tf.math.log(kernel_posterior_scale_constraint)
          )
  
      kernel_posterior_fn = tfp.layers.default_mean_field_normal_fn(
          untransformed_scale_initializer=tf.compat.v1.initializers.random_normal(
              mean=kernel_posterior_scale_mean,
              stddev=kernel_posterior_scale_stddev,
          ),
          untransformed_scale_constraint=_untransformed_scale_constraint,
      )
  
      image = tf_keras.layers.Input(shape=input_shape, dtype="float32")
  
      x = image
      for i in range(len(kernels)):
          x = _vggconv_block(
              x, filters[i], kernels[i], strides[i], kernel_posterior_fn
          )
  
      x = tf_keras.layers.Flatten()(x)
      x = tfp.layers.DenseFlipout(
          num_classes, kernel_posterior_fn=kernel_posterior_fn
      )(x)
      model = tf_keras.Model(inputs=image, outputs=x, name="vgg16")
      return model
  
imports: import tensorflow.compat.v1
  import tensorflow_probability
  from tensorflow_probability.python.internal import tf_keras
label_desc: Use image node_id 1 for calling a global function with example usage: bayesian_vgg(input_shape, num_classes, kernel_posterior_scale_mean, kernel_posterior_scale_stddev, kernel_posterior_scale_constraint) and returns: model, tf