code: def testCovarianceFromSampling(self):
      alpha = np.array([[1.0, 2, 3], [2.5, 4, 0.01]], dtype=np.float32)
      dist = dirichlet.Dirichlet(
          alpha
      )  # batch_shape=[2], event_shape=[3]
      x = dist.sample(int(250e3), seed=test_util.test_seed())
      sample_mean = tf.reduce_mean(x, axis=0)
      x_centered = x - sample_mean[None, ...]
      sample_cov = tf.reduce_mean(
          tf.matmul(x_centered[..., None], x_centered[..., None, :]),
          axis=0,
      )
      sample_var = tf.linalg.diag_part(sample_cov)
      sample_stddev = tf.sqrt(sample_var)
  
      [
          sample_mean_,
          sample_cov_,
          sample_var_,
          sample_stddev_,
          analytic_mean,
          analytic_cov,
          analytic_var,
          analytic_stddev,
      ] = self.evaluate(
          [
              sample_mean,
              sample_cov,
              sample_var,
              sample_stddev,
              dist.mean(),
              dist.covariance(),
              dist.variance(),
              dist.stddev(),
          ]
      )
  
      self.assertAllClose(
          sample_mean_, analytic_mean, atol=0.04, rtol=0.0
      )
      self.assertAllClose(
          sample_cov_, analytic_cov, atol=0.06, rtol=0.0
      )
      self.assertAllClose(
          sample_var_, analytic_var, atol=0.03, rtol=0.0
      )
      self.assertAllClose(
          sample_stddev_, analytic_stddev, atol=0.02, rtol=0.0
      )
  
imports: import numpy
  from scipy import special
  from scipy import stats
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import exp
  from tensorflow_probability.python.distributions import dirichlet
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
  from tensorflow_probability.python.util import deferred_tensor
label_desc: Use image node_id 15 for calling the DirichletTest obj's underlying member method code with example usage: obj.testCovarianceFromSampling() without return types