code: def _do_allreduce(self, index, grad):
      if self._process_set.size() == 1:
          return
  
      if isinstance(index, (tuple, list)):
          if self._num_groups > 0:
              grad_split = split_list(grad, self._num_groups)
              index_split = split_list(index, self._num_groups)
  
              for i, (grads, indices) in enumerate(
                  zip(grad_split, index_split)
              ):
                  grouped_allreduce_(
                      tensors=grads,
                      average=not self._average_in_framework,
                      name="{}:{}".format(indices[0], indices[-1]),
                      priority=-i,
                      prescale_factor=1.0
                      / self._gradient_predivide_factor,
                      postscale_factor=self._postscale_factor,
                      process_set=self._process_set,
                  )
          else:
              for i in range(len(index)):
                  allreduce_(
                      grad[i],
                      average=not self._average_in_framework,
                      name=str(index[i]),
                      priority=-i,
                      prescale_factor=1.0
                      / self._gradient_predivide_factor,
                      postscale_factor=self._postscale_factor,
                      process_set=self._process_set,
                  )
      else:
          allreduce_(
              grad,
              average=not self._average_in_framework,
              name=str(index),
              prescale_factor=1.0 / self._gradient_predivide_factor,
              postscale_factor=self._postscale_factor,
              process_set=self._process_set,
          )
  
imports: from horovod.common.util import check_extension, split_list
  from horovod.mxnet.compression import Compression
  from horovod.mxnet.functions import allgather_object, broadcast_object
  from horovod.mxnet.mpi_ops import allgather, grouped_allgather
  from horovod.mxnet.mpi_ops import allreduce, allreduce_, grouped_allreduce, grouped_allreduce_
  from horovod.mxnet.mpi_ops import alltoall
  from horovod.mxnet.mpi_ops import broadcast, broadcast_
  from horovod.mxnet.mpi_ops import reducescatter, grouped_reducescatter
  from horovod.mxnet.mpi_ops import init, shutdown
  from horovod.mxnet.mpi_ops import is_initialized, start_timeline, stop_timeline
  from horovod.mxnet.mpi_ops import size, local_size, cross_size, rank, local_rank, cross_rank
  from horovod.mxnet.mpi_ops import mpi_threads_supported, mpi_enabled, mpi_built
  from horovod.mxnet.mpi_ops import gloo_enabled, gloo_built
  from horovod.mxnet.mpi_ops import nccl_built, ddl_built, ccl_built, cuda_built, rocm_built
  from horovod.mxnet.mpi_ops import ProcessSet, global_process_set, add_process_set, remove_process_set
  from horovod.mxnet.mpi_ops import Average, Sum, Adasum, Min, Max, Product
  import mxnet
  from collections import OrderedDict, defaultdict
  import types
  import warnings
label_desc: Use image node_id 5 for calling the DistributedOptimizer obj's underlying member method code with example usage: obj._do_allreduce(index, grad) without return types