code: def testAccumulatorSetGlobalStepPreventsAccumulation(self):
      with self.cached_session():
          q = data_flow_ops.ConditionalAccumulator(
              dtypes_lib.float32,
              name="Q",
              shape=tensor_shape.TensorShape([1]),
          )
  
          local_steps = range(1000, 1005)
          accum_ops = [
              q.apply_grad((0.0 + x,), local_step=x)
              for x in local_steps
          ]
  
          for ls in local_steps:
              set_global_step_op = q.set_global_step(ls)
              set_global_step_op.run()
  
              for accum_op in accum_ops:
                  accum_op.run()
              takeg_t = q.take_grad(1)
  
              val = self.evaluate(takeg_t)
              self.assertEqual(
                  0.0
                  + sum(x for x in local_steps if x >= ls)
                  / sum(1 for x in local_steps if x >= ls),
                  val,
              )
  
imports: import time
  import numpy
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import data_flow_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import state_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
label_desc: Use image node_id 20 for calling the ConditionalAccumulatorTest obj's underlying member method code with example usage: obj.testAccumulatorSetGlobalStepPreventsAccumulation() without return types