code: def testParallelApplyGradMean(self):
      # We need each thread to keep its own device stack or the device scopes
      # won't be properly nested.
      ops.get_default_graph().switch_to_thread_local()
      with self.cached_session() as sess:
          q = data_flow_ops.SparseConditionalAccumulator(
              dtypes_lib.float32,
              name="Q",
              shape=tensor_shape.TensorShape([2, 2]),
          )
          elems = [
              10.0,
              20.0,
              30.0,
              40.0,
              50.0,
              60.0,
              70.0,
              80.0,
              90.0,
              100.0,
          ]
          accum_ops = []
          for x in elems:
              x = _indexedslice(
                  np.array([[x, 0], [0, x]]).astype(np.float32)
              )
              accum_ops.append(
                  q.apply_indexed_slices_grad(x, local_step=0)
              )
          takeg_t = q.take_indexed_slices_grad(1)
  
          def apply_indexed_slices_grad(accum_op):
              self.evaluate(accum_op)
  
          threads = [
              self.checkedThread(
                  target=apply_indexed_slices_grad, args=(o,)
              )
              for o in accum_ops
          ]
  
          for thread in threads:
              thread.start()
          for thread in threads:
              thread.join()
  
          val = self.evaluate(takeg_t)
  
          expected_val = sum(elems) / len(elems)
          self._assertEqual_nparray(
              np.array([[expected_val, 0], [0, expected_val]]).astype(
                  np.float32
              ),
              val,
              sess,
          )
  
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 indexed_slices
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  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.platform import test
label_desc: Use image node_id 15 for calling the IndexedSlicesConditionalAccumulatorTest obj's underlying member method code with example usage: obj.testParallelApplyGradMean() without return types