code: def test_with_hmc(self):
      target_dist = normal.Normal(loc=0.0, scale=1.0)
      hmc_kernel = hmc.HamiltonianMonteCarlo(
          target_log_prob_fn=target_dist.log_prob,
          num_leapfrog_steps=27,
          step_size=0.33,
      )
      reduced_stats, _, _ = sample_fold(
          num_steps=50,
          current_state=tf.zeros((2,)),
          kernel=hmc_kernel,
          reducer=[
              tracing_reducer.TracingReducer(size=50),
              psrr.PotentialScaleReductionReducer(),
          ],
          seed=test_util.test_seed(),
      )
      rhat = reduced_stats[1]
      true_rhat = diagnostic.potential_scale_reduction(
          chains_states=reduced_stats[0][0], independent_chain_ndims=1
      )
      true_rhat, rhat = self.evaluate([true_rhat, rhat])
      self.assertAllClose(true_rhat, rhat, rtol=1e-6)
  
file_path: probability/tensorflow_probability/python/experimental/mcmc/potential_scale_reduction_reducer_test.py
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.experimental.mcmc import potential_scale_reduction_reducer
  from tensorflow_probability.python.experimental.mcmc import tracing_reducer
  from tensorflow_probability.python.experimental.mcmc.internal import test_fixtures
  from tensorflow_probability.python.experimental.mcmc.sample_fold import sample_fold
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.mcmc import diagnostic
  from tensorflow_probability.python.mcmc import hmc
label_desc: Use image node_id 4 for calling the PotentialScaleReductionReducerTest obj's underlying member method code with example usage: obj.test_with_hmc() without return types