code: def testReplicaContextEager(self, distribution, use_function):
      if not use_function and strategy_test_lib.is_tpu_strategy(
          distribution
      ):
          self.skipTest(
              "TPUStrategy doesn't support pure eager execution."
          )
      with distribution.scope():
          w = variables.Variable(
              [1.0],
              name="w",
              aggregation=variables.VariableAggregation.MEAN,
          )
          ema = moving_averages.ExponentialMovingAverage(0.8)
  
          def fn():
              def _ema_replica_fn_eager():
                  ema.apply([w])
                  w.assign_sub([0.5])
                  ema.apply([w])
                  return ema.average(w)
  
              return distribution.run(_ema_replica_fn_eager)
  
          if use_function:
              fn = def_function.function(fn)
          ema_w = fn()
      self.assertAllClose(
          self.evaluate(distribution.experimental_local_results(ema_w))[
              0
          ],
          [0.89999998],
      )
  
imports: from absl.testing import parameterized
  from tensorflow.python.distribute import combinations
  from tensorflow.python.distribute import strategy_combinations
  from tensorflow.python.distribute import strategy_test_lib
  from tensorflow.python.distribute import test_util
  from tensorflow.python.eager import def_function
  from tensorflow.python.eager import test
  from tensorflow.python.framework import constant_op
  from tensorflow.python.ops import variables
  from tensorflow.python.training import moving_averages
label_desc: Use image node_id 1 for calling the ExponentialMovingAverageTest obj's underlying member method code with example usage: obj.testReplicaContextEager(distribution, use_function) and returns: distribution, ema