code: def testMeanAndVarianceAgainstDirichletMultinomial(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
      )
  
      beta_binomial_mean = self.evaluate(dist.mean())
      dirichlet_multinomial_mean = self.evaluate(dm.mean())
  
      self.assertEqual((4, 3), beta_binomial_mean.shape)
      self.assertEqual((4, 3, 2), dirichlet_multinomial_mean.shape)
      self.assertAllClose(
          beta_binomial_mean,
          np.squeeze(dirichlet_multinomial_mean[..., 0]),
      )
      self.assertAllClose(
          n - beta_binomial_mean,
          np.squeeze(dirichlet_multinomial_mean[..., 1]),
      )
  
      beta_binomial_variance = self.evaluate(dist.variance())
      dirichlet_multinomial_variance = self.evaluate(dm.variance())
      self.assertEqual((4, 3), beta_binomial_variance.shape)
      self.assertEqual((4, 3, 2), dirichlet_multinomial_variance.shape)
      self.assertAllClose(
          beta_binomial_variance,
          np.squeeze(dirichlet_multinomial_variance[..., 0]),
      )
  
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 5 for calling the BetaBinomialTest obj's underlying member method code with example usage: obj.testMeanAndVarianceAgainstDirichletMultinomial() without return types