class_docstr: stats logging object useful for gathering statistics of training a deep net in pytorch
  Example::
  
      # init stats structure that logs statistics 'objective' and 'top1e'
      stats = Stats( ('objective','top1e') )
      network = init_net() # init a pytorch module (=nueral network)
      dataloader = init_dataloader() # init a dataloader
      for epoch in range(10):
          # start of epoch -> call new_epoch
          stats.new_epoch()
  
          # iterate over batches
          for batch in dataloader:
  
              output = network(batch) # run and save into a dict of output variables
  
              # stats.update() automatically parses the 'objective' and 'top1e' from
              # the "output" dict and stores this into the db
              stats.update(output)
              # prints the metric averages over given epoch
              std_out = stats.get_status_string()
              logger.info(str_out)
          # stores the training plots into '/tmp/epoch_stats.pdf'
          # and plots into a visdom server running at localhost (if running)
          stats.plot_stats(plot_file='/tmp/epoch_stats.pdf')
code: def get_epoch_averages(self, epoch=None):
      stat_sets = list(self.stats.keys())
  
      if epoch is None:
          epoch = self.epoch
      if epoch == -1:
          epoch = list(range(self.epoch))
  
      outvals = {}
      for stat_set in stat_sets:
          outvals[stat_set] = {
              "epoch": epoch,
              "it": self.it[stat_set],
              "epoch_max": self.epoch,
          }
  
          for stat in self.stats[stat_set].keys():
              if self.stats[stat_set][stat].count == 0:
                  continue
              if isinstance(epoch, Iterable):
                  avgs = self.stats[stat_set][stat].get_epoch_averages()
                  avgs = [avgs[e] for e in epoch]
              else:
                  avgs = self.stats[stat_set][stat].get_epoch_averages(
                      epoch=epoch
                  )
              outvals[stat_set][stat] = avgs
  
      return outvals
  
imports: import gzip
  import json
  import logging
  import time
  import warnings
  from collections.abc import Iterable
  from itertools import cycle
  import matplotlib
  import matplotlib.pyplot
  import numpy
  from matplotlib import colors
  from pytorch3d.implicitron.tools.vis_utils import get_visdom_connection
label_desc: Use image node_id 13 for calling the Stats obj's underlying member method code with example usage: obj.get_epoch_averages(epoch) and returns: outvals