code: def testUniformUniformKLFinite(self):
      batch_size = 6
  
      a_low = -1.0 * np.arange(1, batch_size + 1)
      a_high = np.array([1.0] * batch_size)
      b_low = -2.0 * np.arange(1, batch_size + 1)
      b_high = np.array([2.0] * batch_size)
      a = uniform.Uniform(low=a_low, high=a_high, validate_args=True)
      b = uniform.Uniform(low=b_low, high=b_high, validate_args=True)
  
      true_kl = np.log(b_high - b_low) - np.log(a_high - a_low)
  
      kl = kullback_leibler.kl_divergence(a, b)
  
      # This is essentially an approximated integral from the direct definition
      # of KL divergence.
      x = a.sample(int(1e4), seed=test_util.test_seed())
      kl_samples = a.log_prob(x) - b.log_prob(x)
  
      kl_, kl_samples_ = self.evaluate([kl, kl_samples])
      self.assertAllClose(kl_, true_kl, atol=2e-15)
      self.assertAllMeansClose(
          kl_samples_, true_kl, axis=0, atol=0.0, rtol=1e-1
      )
  
      zero_kl = kullback_leibler.kl_divergence(a, a)
      true_zero_kl_, zero_kl_ = self.evaluate(
          [tf.zeros_like(true_kl), zero_kl]
      )
      self.assertAllEqual(true_zero_kl_, zero_kl_)
  
imports: import numpy
  from scipy import stats
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.distributions import uniform
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 20 for calling the UniformTest obj's underlying member method code with example usage: obj.testUniformUniformKLFinite() without return types