code: def test_basic_hmc_example(self):
      batch_shape = [2, 3]
      num_timesteps = 5
      observed_time_series = self._build_tensor(
          np.random.randn(*(batch_shape + [num_timesteps]))
      )
      model = self._build_model(observed_time_series)
      samples, kernel_results = fitting.fit_with_hmc(
          model,
          observed_time_series,
          num_results=4,
          num_warmup_steps=2,
          num_variational_steps=2,
      )
  
      self.evaluate(tf1.global_variables_initializer())
      samples_, kernel_results_ = self.evaluate(
          (samples, kernel_results)
      )
  
      acceptance_rate = np.mean(
          kernel_results_.inner_results.inner_results.is_accepted,
          axis=0,
      )
  
      posterior_means = {
          param.name: np.mean(param_draws, axis=0)
          for (param, param_draws) in zip(model.parameters, samples_)
      }
  
      # Perfunctory checks to ensure the code executed and we got results
      # of the expected shape.
      self.assertAllEqual(acceptance_rate.shape, batch_shape)
      for parameter in model.parameters:
          self.assertAllEqual(
              posterior_means[parameter.name].shape,
              self._batch_shape_as_list(parameter.prior)
              + self._event_shape_as_list(parameter.prior),
          )
  
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.sts import fitting
  from tensorflow_probability.python.sts.components import local_linear_trend
  from tensorflow_probability.python.sts.components import seasonal
  from tensorflow_probability.python.sts.components import sum
  from tensorflow_probability.python.sts.internal import missing_values_util
  from tensorflow_probability.python.vi import csiszar_divergence
  from tensorflow_probability.python.vi import optimization
label_desc: Use image node_id 2 for calling the _HMCTests obj's underlying member method code with example usage: obj.test_basic_hmc_example() without return types