code: def test_with_kernel_results(self):
      def kernel_average(sample, kr):
          del sample
          return kr.value
  
      def inner_average(sample, kr):
          del sample
          return kr.inner_results.value
  
      mean_reducer = expectations_reducer.ExpectationsReducer(
          transform_fn=[kernel_average, inner_average]
      )
      kernel_results = FakeKernelResults(0, FakeInnerResults(0))
      state = mean_reducer.initialize(0, kernel_results)
      for sample in range(6):
          kernel_results = FakeKernelResults(
              sample, FakeInnerResults(sample + 1)
          )
          state = mean_reducer.one_step(sample, state, kernel_results)
      mean = self.evaluate(mean_reducer.finalize(state))
      self.assertEqual([2.5, 3.5], mean)
  
file_path: probability/tensorflow_probability/python/experimental/mcmc/expectations_reducer_test.py
imports: import collections
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.experimental.mcmc import expectations_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
label_desc: Use image node_id 1 for calling the ExpectationsReducerTest obj's underlying member method code with example usage: obj.test_with_kernel_results() and returns: kr, kr