code: def testSampleConsistentStats(self):
      loc = np.float32([[-1.0, 1], [1, -1]])
      scale = np.float32([[1.0, 1.0], [0.5, 0.5]])
      n_samp = 1e4
      ind = independent.Independent(
          distribution=mvn_diag.MultivariateNormalDiag(
              loc=loc, scale_diag=scale
          ),
          reinterpreted_batch_ndims=1,
          validate_args=True,
      )
  
      x = ind.sample(
          int(n_samp), seed=test_util.test_seed(hardcoded_seed=42)
      )
      sample_mean = tf.reduce_mean(x, axis=0)
      sample_var = tf.reduce_mean(
          tf.math.squared_difference(x, sample_mean), axis=0
      )
      sample_std = tf.sqrt(sample_var)
      entropy_samples = -ind.log_prob(x)
  
      [
          samples_,
          sample_var_,
          sample_std_,
          entropy_samples_,
          actual_mean_,
          actual_var_,
          actual_std_,
          actual_entropy_,
          actual_mode_,
      ] = self.evaluate(
          [
              x,
              sample_var,
              sample_std,
              entropy_samples,
              ind.mean(),
              ind.variance(),
              ind.stddev(),
              ind.entropy(),
              ind.mode(),
          ]
      )
  
      # Bounds chosen so that the probability of each sample mean/variance/stddev
      # differing by more than the given tolerance is roughly 1e-6.
      self.assertAllMeansClose(
          samples_, actual_mean_, axis=0, rtol=0.049, atol=0.0
      )
      self.assertAllClose(sample_var_, actual_var_, rtol=0.07, atol=0.0)
      self.assertAllClose(
          sample_std_, actual_std_, rtol=0.035, atol=0.0
      )
  
      self.assertAllMeansClose(
          entropy_samples_,
          actual_entropy_,
          axis=0,
          rtol=0.015,
          atol=0.0,
      )
      self.assertAllClose(loc, actual_mode_, rtol=1e-6, atol=0.0)
  
imports: import functools
  import os
  from absl.testing import parameterized
  import numpy
  from scipy import stats
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import bernoulli
  from tensorflow_probability.python.distributions import exponential
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.distributions import log_prob_ratio
  from tensorflow_probability.python.distributions import logistic
  from tensorflow_probability.python.distributions import lognormal
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import poisson
  from tensorflow_probability.python.internal import hypothesis_testlib
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
label_desc: Use image node_id 5 for calling the IndependentDistributionTest obj's underlying member method code with example usage: obj.testSampleConsistentStats() without return types