class_docstr: Accumulator for loss statistics.
  Currently calculates:
  
  * accuracy
  * perplexity
  * elapsed time
docstr: Gather a `Statistics` list accross all processes/nodes
  
  Args:
      stat_list(list([`Statistics`])): list of statistics objects to
          gather accross all processes/nodes
      max_size(int): max buffer size to use
  
  Returns:
      our_stats(list([`Statistics`])): list of updated stats
docstr_tok: ["Gather","a","`","Statistics","`","list","accross","all","processes\/nodes","Args",":","stat_list","(","list","(","[","`","Statistics","`","]",")",")",":","list","of","statistics","objects","to","gather","accross","all","processes\/nodes","max_size","(","int",")",":","max","buffer","size","to","use","Returns",":","our_stats","(","list","(","[","`","Statistics","`","]",")",")",":","list","of","updated","stats"]
code: def all_gather_stats_list(stat_list, max_size=4096):
      """
      Gather a `Statistics` list accross all processes/nodes
  
      Args:
          stat_list(list([`Statistics`])): list of statistics objects to
              gather accross all processes/nodes
          max_size(int): max buffer size to use
  
      Returns:
          our_stats(list([`Statistics`])): list of updated stats
      """
      from torch.distributed import get_rank
      from onmt.utils.distributed import all_gather_list
  
      # Get a list of world_size lists with len(stat_list) Statistics objects
      all_stats = all_gather_list(stat_list, max_size=max_size)
  
      our_rank = get_rank()
      our_stats = all_stats[our_rank]
      for other_rank, stats in enumerate(all_stats):
          if other_rank == our_rank:
              continue
          for i, stat in enumerate(stats):
              our_stats[i].update(stat, update_n_src_words=True)
      return our_stats
  
file_path: OpenNMT-py/onmt/utils/statistics.py
imports: import time
  import math
  import sys
  from onmt.utils.logging import logger
label_desc: Use image node_id 3 for calling the Statistics obj's underlying member method code with example usage: obj.all_gather_stats_list(stat_list, max_size) and returns: our_stats