code: def testCovarianceFromSampling(self):
      alpha = np.array([[1.0, 2, 3], [2.5, 4, 0.01]], dtype=np.float32)
      dist = dirichlet_lib.Dirichlet(
          alpha
      )  # batch_shape=[2], event_shape=[3]
      x = dist.sample(int(250e3), seed=1)
      sample_mean = math_ops.reduce_mean(x, 0)
      x_centered = x - sample_mean[None, ...]
      sample_cov = math_ops.reduce_mean(
          math_ops.matmul(
              x_centered[..., None], x_centered[..., None, :]
          ),
          0,
      )
      sample_var = array_ops.matrix_diag_part(sample_cov)
      sample_stddev = math_ops.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.04, rtol=0.0
      )
      self.assertAllClose(
          sample_stddev_, analytic_stddev, atol=0.02, rtol=0.0
      )
  
imports: import importlib
  import numpy
  from tensorflow.python.eager import backprop
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops.distributions import dirichlet
  from tensorflow.python.ops.distributions import kullback_leibler
  from tensorflow.python.platform import test
  from tensorflow.python.platform import tf_logging
label_desc: Use image node_id 14 for calling the DirichletTest obj's underlying member method code with example usage: obj.testCovarianceFromSampling() without return types