docstr: Sums the gradients at the param_loc then divides by the
  number of trainers.
  Args:
      param_loc (int): bucket location sent by the trainer
          containing the gradient
docstr_tok: ["Sums","the","gradients","at","the","param_loc","then","divides","by","the","number","of","trainers",".","Args",":","param_loc","(","int",")",":","bucket","location","sent","by","the","trainer","containing","the","gradient"]
code: def average(self, param_loc):
      r"""
      Sums the gradients at the param_loc then divides by the
      number of trainers.
      Args:
          param_loc (int): bucket location sent by the trainer
              containing the gradient
      """
      param_loc_avg = self.gradient_dict[param_loc][0]
      for gradient in self.gradient_dict[param_loc][1:]:
          param_loc_avg += gradient
      param_loc_avg / (1.0 * self.trainer_count)
      return param_loc_avg
  
imports: import functools
  import threading
  import time
  from abc import ABC, abstractmethod
  import torch
  import torch.distributed.rpc
  from metrics.MetricsLogger import MetricsLogger
  from utils import sparse_rpc_format_to_tensor, sparse_tensor_to_rpc_format
label_desc: Use image node_id 3 for calling the AverageBatchParameterServer obj's underlying member method code with example usage: obj.average(param_loc) and returns: param_loc_avg