code: def testAverageVariablesDeviceAssignment(self):
      with ops.device("/job:dev_v0"):
          v0 = variables.Variable(10.0, name="v0")
      with ops.device("/job:dev_v1"):
          v1 = gen_state_ops.variable(
              shape=[1],
              dtype=dtypes.float32,
              name="v1",
              container="",
              shared_name="",
          )
          v1.set_shape([1])
      tensor2 = v0 + v1
      ema = moving_averages.ExponentialMovingAverage(
          0.25, name="foo_avg"
      )
      with ops.device("/job:default"):
          ema.apply([v0, v1, tensor2])
      self.assertDeviceEqual("/job:dev_v0", ema.average(v0).device)
      self.assertDeviceEqual("/job:dev_v1", ema.average(v1).device)
      # However, the colocation property is maintained.
      self.assertEqual(
          [b"loc:@v1"], ema.average(v1).op.colocation_groups()
      )
      self.assertDeviceEqual(
          "/job:default", ema.average(tensor2).device
      )
  
imports: import numpy
  from tensorflow.python.compiler.xla.experimental import xla_sharding
  from tensorflow.python.eager import context
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_state_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
  from tensorflow.python.training import moving_averages
  from tensorflow.python.training import saver
label_desc: Use image node_id 28 for calling the ExponentialMovingAverageTest obj's underlying member method code with example usage: obj.testAverageVariablesDeviceAssignment() without return types