class_docstr: PS Synchronizer.
  
  Synchronizes gradient updates using a Parameter Server.
  
  For in-graph synchronization, this just aggregates gradients on a worker's CPU.
  
  For between-graph synchronization, this aggregates gradients on a pre-defined
  (defined in the Strategy) parameter server.
  
  To keep this gradient aggregation in sync, the chief gives each worker a token
  for each variable for the workers to mark when their variable update is complete.
code: def _aggregate_sparse_gradients(
      self,
      var_op,
      reduce_to_device,
      indexed_slices_grads,
      values_op_name,
  ):
      with ops.device(reduce_to_device):
          grad_accum_op_name = ops.prepend_name_scope(
              values_op_name, "%sAccum" % AUTODIST_PREFIX
          )
          grad_accum = data_flow_ops.SparseConditionalAccumulator(
              dtype=indexed_slices_grads[0].values.dtype,
              shape=var_op.outputs[0].shape,
              shared_name=grad_accum_op_name,
              name=grad_accum_op_name,
          )
          accum_apply_ops = [
              grad_accum.apply_indexed_slices_grad(
                  indexed_slices_grads[i],
                  MAX_INT64,
                  name=ops.prepend_name_scope(
                      values_op_name,
                      "%s-Accum-Apply" % replica_prefix(i),
                  ),
              )
              for i in range(self.num_replicas)
          ]
          take_grad_op_name = ops.prepend_name_scope(
              values_op_name, "%sTake-Grad" % AUTODIST_PREFIX
          )
          with ops.control_dependencies(accum_apply_ops):
              take_grad = grad_accum.take_indexed_slices_grad(
                  self.num_replicas, name=take_grad_op_name
              )
  
          new_indices = take_grad.indices
          new_values = take_grad.values
          new_dense_shape = take_grad.dense_shape
          if indexed_slices_grads[0].indices.dtype != new_indices.dtype:
              new_indices = math_ops.cast(
                  new_indices,
                  indexed_slices_grads[0].indices.dtype,
                  name=ops.prepend_name_scope(
                      values_op_name,
                      "%sTake-Grad-Cast-Indices" % AUTODIST_PREFIX,
                  ),
              )
          if (
              indexed_slices_grads[0].dense_shape.dtype
              != new_dense_shape.dtype
          ):
              new_dense_shape = math_ops.cast(
                  new_dense_shape,
                  indexed_slices_grads[0].dense_shape.dtype,
                  name=ops.prepend_name_scope(
                      values_op_name,
                      "%sTake-Grad-Cast-Shape" % AUTODIST_PREFIX,
                  ),
              )
      return ops.IndexedSlices(new_values, new_indices, new_dense_shape)
  
imports: from functools import partial
  from typing import List
  from tensorflow.python import ops
  from tensorflow.python.framework import device_spec, dtypes, constant_op
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.ops import math_ops, data_flow_ops, gen_control_flow_ops, control_flow_ops, gen_math_ops, gen_array_ops
  from autodist.const import MAX_INT64, AUTODIST_PREFIX
  from autodist.kernel.common import utils, variable_utils
  from autodist.kernel.common.op_info import UPDATE_OP_VAR_POS
  from autodist.kernel.common.proxy_variable import ProxyVariable
  from autodist.kernel.common.utils import get_op_name, get_consumers, get_ancestors, traverse, update_consumers, update_control_consumers, replica_prefix, strip_replica_prefix, get_control_consumers, remove_from_control_consumers, get_index_from_tensor_name, update_colocation_group
  from autodist.kernel.common.variable_utils import get_read_var_ops
  from autodist.kernel.synchronization.synchronizer import Synchronizer
  from autodist.proto import synchronizers_pb2
label_desc: Use image node_id 13 for calling the PSSynchronizer obj's underlying member method code with example usage: obj._aggregate_sparse_gradients(var_op, reduce_to_device, indexed_slices_grads, values_op_name) and returns: ops