code: def testSampleAgainstMeanAndVariance(self):
      seed_stream = test_util.test_seed_stream()
  
      n = self.evaluate(
          tf.cast(
              tf.random.uniform(
                  shape=[3, 1],
                  minval=1,
                  maxval=8193,
                  dtype=tf.int32,
                  seed=seed_stream(),
              ),
              tf.float32,
          )
      )
      c1 = self.evaluate(
          1.0
          + 2.0
          * tf.random.uniform(
              shape=[4, 3, 2], dtype=tf.float32, seed=seed_stream()
          )
      )
      c0 = self.evaluate(
          1.0
          + 2.0
          * tf.random.uniform(
              shape=[4, 3, 1], dtype=tf.float32, seed=seed_stream()
          )
      )
  
      dist = beta_binomial.BetaBinomial(n, c1, c0, validate_args=True)
  
      num_samples = int(1e4)
      x = dist.sample(num_samples, seed=seed_stream())
      sample_mean, sample_variance = self.evaluate(
          tf.nn.moments(x=x, axes=0)
      )
  
      self.assertAllEqual([4, 3, 2], sample_mean.shape)
      self.assertAllClose(
          self.evaluate(dist.mean()), sample_mean, atol=0.0, rtol=0.10
      )
      self.assertAllEqual([4, 3, 2], sample_variance.shape)
      self.assertAllClose(
          dist.variance(), sample_variance, atol=0.0, rtol=0.10
      )
  
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 4 for calling the BetaBinomialTest obj's underlying member method code with example usage: obj.testSampleAgainstMeanAndVariance() without return types