code: def testBernoulliBernoulliKLWhenProbOneIsOne(self):
      # KL[a || b] = Pa * Log[Pa / Pb] + (1 - Pa) * Log[(1 - Pa) / (1 - Pb)]
      # This is defined iff (Pb = 0 ==> Pa = 0) AND (Pb = 1 ==> Pa = 1).
      a = bernoulli.Bernoulli(probs=[1.0, 1.0, 1.0])
      b = bernoulli.Bernoulli(probs=[0.5, 1.0, 0.0])
      kl_expected = [
          # The (1 - Pa) term kills the entire second term.
          1 * np.log(1 / 0.5) + 0,
          # P[b = 0] = 0, and P[a = 0] = 0, so absolute continuity holds.
          1 * np.log(1 / 1) + 0,
          # P[b = 1] = 0, but P[a = 1] != 0, so not absolutely continuous.
          # Some would argue that NaN would be more correct...
          np.inf,
      ]
      self.assertAllClose(
          self.evaluate(kullback_leibler.kl_divergence(a, b)),
          kl_expected,
      )
  
imports: import numpy
  from scipy import special
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import bernoulli
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 23 for calling the BernoulliTest obj's underlying member method code with example usage: obj.testBernoulliBernoulliKLWhenProbOneIsOne() without return types