code: def testLogProbAgainstDirichletMultinomial(self):
      seed_stream = test_util.test_seed_stream()
  
      n = tf.constant([10.0, 20.0, 30.0])
      c1 = self.evaluate(
          1.0
          + 2.0
          * tf.random.uniform(
              shape=[4, 3], dtype=tf.float32, seed=seed_stream()
          )
      )
      c0 = self.evaluate(
          1.0
          + 2.0
          * tf.random.uniform(
              shape=[4, 3], dtype=tf.float32, seed=seed_stream()
          )
      )
  
      dist = beta_binomial.BetaBinomial(n, c1, c0, validate_args=True)
      dm = dirichlet_multinomial.DirichletMultinomial(
          n, tf.stack([c1, c0], axis=-1), validate_args=True
      )
  
      num_samples = 3
  
      beta_binomial_sample = self.evaluate(
          dist.sample(num_samples, seed=seed_stream())
      )
      beta_binomial_log_prob = dist.log_prob(beta_binomial_sample)
      dirichlet_multinomial_log_prob = dm.log_prob(
          tf.stack(
              [beta_binomial_sample, n - beta_binomial_sample], axis=-1
          )
      )
      self.assertAllClose(
          self.evaluate(beta_binomial_log_prob),
          self.evaluate(dirichlet_multinomial_log_prob),
          rtol=1e-4,
          atol=1e-4,
      )
  
      dirichlet_multinomial_sample = self.evaluate(
          dm.sample(num_samples, seed=seed_stream())
      )
      dirichlet_multinomial_log_prob = dm.log_prob(
          dirichlet_multinomial_sample
      )
      beta_binomial_log_prob = dist.log_prob(
          tf.squeeze(dirichlet_multinomial_sample[..., 0])
      )
      self.assertAllClose(
          self.evaluate(dirichlet_multinomial_log_prob),
          self.evaluate(beta_binomial_log_prob),
          rtol=1e-4,
          atol=1e-4,
      )
  
imports: import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import bernoulli
  from tensorflow_probability.python.distributions import beta_binomial
  from tensorflow_probability.python.distributions import dirichlet_multinomial
  from tensorflow_probability.python.distributions.internal import statistical_testing
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 11 for calling the BetaBinomialTest obj's underlying member method code with example usage: obj.testLogProbAgainstDirichletMultinomial() without return types