code: def test_hmc_fitting_gaussian(self):
      if tf.executing_eagerly() and not JAX_MODE:
          self.skipTest("Eager test is slow.")
      # See docstring to _gen_gaussian_updating_example
      x_dim = 3
      y_dim = 12
  
      stream = test_util.test_seed_stream()
  
      # Compute everything in a function so it is consistent in graph mode
      @tf.function
      def do_sample():
          jd_model, true_var = _gen_gaussian_updating_example(
              x_dim, y_dim, stream()
          )
          y_val = jd_model.sample(seed=stream()).y
          _, trace = windowed_sampling.windowed_adaptive_hmc(
              1,
              jd_model,
              n_chains=1,
              num_adaptation_steps=10000,
              num_leapfrog_steps=16,
              discard_tuning=False,
              y=y_val,
              seed=stream(),
          )
  
          # Get the final scaling used for the mass matrix - this is a measure
          # of how well the windowed adaptation recovered the true variance
          final_scaling = 1.0 / trace["variance_scaling"][0][-1, 0, :]
          return final_scaling, true_var
  
      final_scaling, true_var = do_sample()
      self.assertAllClose(true_var, final_scaling, rtol=0.15)
  
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import identity
  from tensorflow_probability.python.bijectors import pad
  from tensorflow_probability.python.distributions import autoregressive
  from tensorflow_probability.python.distributions import beta_binomial
  from tensorflow_probability.python.distributions import dirichlet
  from tensorflow_probability.python.distributions import half_normal
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import joint_distribution_auto_batched
  from tensorflow_probability.python.distributions import joint_distribution_coroutine
  from tensorflow_probability.python.distributions import joint_distribution_named
  from tensorflow_probability.python.distributions import joint_distribution_sequential
  from tensorflow_probability.python.distributions import multinomial
  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.distributions import sample
  from tensorflow_probability.python.distributions import uniform
  from tensorflow_probability.python.experimental import distribute
  from tensorflow_probability.python.experimental.mcmc import windowed_sampling
  from tensorflow_probability.python.internal import callable_util
  from tensorflow_probability.python.internal import distribute_test_lib
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.internal import unnest
  from tensorflow_probability.python.mcmc import diagnostic
label_desc: Use image node_id 10 for calling the WindowedSamplingTest obj's underlying member method code with example usage: obj.test_hmc_fitting_gaussian() and returns: final_scaling,  true_var