code: def testDenseLocalReparameterization(self):
      batch_size, in_size, out_size = 2, 3, 4
      with self.cached_session() as sess:
          tf.random.set_seed(9068)
          (
              kernel_posterior,
              kernel_prior,
              kernel_divergence,
              bias_posterior,
              bias_prior,
              bias_divergence,
              layer,
              inputs,
              outputs,
              kl_penalty,
          ) = self._testDenseSetUp(
              dense_variational.DenseLocalReparameterization,
              batch_size,
              in_size,
              out_size,
          )
  
          tf.random.set_seed(9068)
          expected_kernel_posterior_affine = normal.Normal(
              loc=tf.matmul(inputs, kernel_posterior.result_loc),
              scale=tf.matmul(
                  inputs**2.0, kernel_posterior.result_scale**2
              )
              ** 0.5,
          )
          expected_kernel_posterior_affine_tensor = (
              expected_kernel_posterior_affine.sample(seed=42)
          )
          expected_outputs = (
              expected_kernel_posterior_affine_tensor
              + bias_posterior.result_sample
          )
  
          [
              expected_outputs_,
              actual_outputs_,
              expected_kernel_divergence_,
              actual_kernel_divergence_,
              expected_bias_,
              actual_bias_,
              expected_bias_divergence_,
              actual_bias_divergence_,
          ] = sess.run(
              [
                  expected_outputs,
                  outputs,
                  kernel_divergence.result,
                  kl_penalty[0],
                  bias_posterior.result_sample,
                  layer.bias_posterior_tensor,
                  bias_divergence.result,
                  kl_penalty[1],
              ]
          )
  
          self.assertAllClose(
              expected_bias_, actual_bias_, rtol=1e-6, atol=0.0
          )
          self.assertAllClose(
              expected_outputs_, actual_outputs_, rtol=1e-6, atol=0.0
          )
          self.assertAllClose(
              expected_kernel_divergence_,
              actual_kernel_divergence_,
              rtol=1e-6,
              atol=0.0,
          )
          self.assertAllClose(
              expected_bias_divergence_,
              actual_bias_divergence_,
              rtol=1e-6,
              atol=0.0,
          )
  
          expected_args = [kernel_posterior, kernel_prior, None]
          # We expect that there was one call to kernel_divergence, with the above
          # args; MockKLDivergence appends the list of args to a list, so the above
          # args should be in the 0th position of that list.
          actual_args = kernel_divergence.args[0]
          # Test for identity with 'is'. TensorFlowTestCase.assertAllEqual actually
          # coerces the inputs to numpy arrays, so we can't use that to assert that
          # the arguments (which are a mixture of Distributions and Tensors) are
          # equal.
          for a, b in zip(expected_args, actual_args):
              self.assertIs(a, b)
  
          # Same story as above.
          expected_args = [
              bias_posterior,
              bias_prior,
              bias_posterior.result_sample,
          ]
          actual_args = bias_divergence.args[0]
          for a, b in zip(expected_args, actual_args):
              self.assertIs(a, b)
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.internal import tf_keras
  from tensorflow_probability.python.layers import dense_variational
  from tensorflow_probability.python.layers import util
  from tensorflow_probability.python.random import random_ops
  from tensorflow_probability.python.util import seed_stream
label_desc: Use image node_id 15 for calling the DenseVariational obj's underlying member method code with example usage: obj.testDenseLocalReparameterization() without return types