code: def testMeanGoesInRightDirection(self):
      # As with `testVarGoesInRightDirection`, this makes sure the mean gets
      # closer. Pleasantly, we do not even need that the variance starts very
      # close to the true variance.
      mvn_scale = tf.convert_to_tensor(self.mvn_scale)
      error_factor = 5.0 * mvn_scale
      init_variance = error_factor * mvn_scale**2
      init_mean = tf.convert_to_tensor(self.mvn_mean) + error_factor
      initial_running_variance = (
          sample_stats.RunningVariance.from_stats(
              num_samples=10.0, mean=init_mean, variance=init_variance
          )
      )
      results = self._run_hmc(
          num_results=1000,
          initial_running_variance=initial_running_variance,
      )
  
      # This number started at `error_factor`. Make sure the mean is now at least
      # 50% closer.
      final_mean_diff = tf.abs(results.final_mean - results.true_mean)
      np.testing.assert_array_less(
          self.evaluate(final_mean_diff),
          self.evaluate(0.5 * error_factor),
      )
  
imports: import collections
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import joint_distribution_sequential
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import sample
  from tensorflow_probability.python.experimental.mcmc import diagonal_mass_matrix_adaptation
  from tensorflow_probability.python.experimental.mcmc import preconditioned_hmc
  from tensorflow_probability.python.experimental.mcmc import preconditioning_utils
  from tensorflow_probability.python.experimental.stats import sample_stats
  from tensorflow_probability.python.internal import distribute_lib
  from tensorflow_probability.python.internal import distribute_test_lib
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.mcmc import sample
label_desc: Use image node_id 7 for calling the DiagonalMassMatrixAdaptationTest obj's underlying member method code with example usage: obj.testMeanGoesInRightDirection() without return types