code: def test_nested_in_step_size_adaptation(self):
      target_dist = mvn_diag.MultivariateNormalDiag(
          loc=[0.0, 0.0], scale_diag=[1.0, 10.0]
      )
      hmc_kernel = hmc.HamiltonianMonteCarlo(
          target_log_prob_fn=target_dist.log_prob,
          num_leapfrog_steps=27,
          step_size=10,
      )
      cov_reducer = covariance_reducer.CovarianceReducer()
      reducer_kernel = with_reductions.WithReductions(
          inner_kernel=hmc_kernel, reducer=cov_reducer
      )
      step_adapted_kernel = sssa.SimpleStepSizeAdaptation(
          inner_kernel=reducer_kernel,
          adaptation_rate=0.8,
          num_adaptation_steps=9,
      )
      samples, _, kernel_results = sample.sample_chain(
          num_results=10,
          current_state=tf.convert_to_tensor([0.0, 0.0]),
          kernel=step_adapted_kernel,
          trace_fn=None,
          return_final_kernel_results=True,
          seed=test_util.test_seed(),
      )
      mean = (
          kernel_results.inner_results.reduction_results.cov_state.mean
      )
      samples, mean, final_cov = self.evaluate(
          [
              samples,
              mean,
              cov_reducer.finalize(
                  kernel_results.inner_results.reduction_results
              ),
          ]
      )
  
      self.assertEqual((2,), mean.shape)
      self.assertAllClose(np.mean(samples, axis=0), mean, rtol=1e-6)
      self.assertEqual((2, 2), final_cov.shape)
      self.assertAllClose(
          np.cov(samples.T, ddof=0), final_cov, rtol=1e-6
      )
  
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import exp
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import mvn_tril
  from tensorflow_probability.python.experimental.mcmc import covariance_reducer
  from tensorflow_probability.python.experimental.mcmc import step
  from tensorflow_probability.python.experimental.mcmc import with_reductions
  from tensorflow_probability.python.experimental.mcmc.internal import test_fixtures
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.mcmc import hmc
  from tensorflow_probability.python.mcmc import sample
  from tensorflow_probability.python.mcmc import simple_step_size_adaptation
  from tensorflow_probability.python.mcmc import transformed_kernel
label_desc: Use image node_id 8 for calling the CovarianceWithReductionsTest obj's underlying member method code with example usage: obj.test_nested_in_step_size_adaptation() without return types