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 update(
      self, preds, time_start=None, freeze_iter=False, stat_set="train"
  ):
      if self.epoch == -1:  # uninitialized
          logger.warning(
              "epoch==-1 means uninitialized stats structure -> new_epoch() called"
          )
          self.new_epoch()
  
      if stat_set not in self.stats:
          self.stats[stat_set] = {}
          self.it[stat_set] = -1
  
      if not freeze_iter:
          self.it[stat_set] += 1
  
      epoch = self.epoch
  
      for stat in self.log_vars:
          if stat not in self.stats[stat_set]:
              self.stats[stat_set][stat] = AverageMeter()
  
          if stat == "sec/it":  # compute speed
              if time_start is None:
                  time_per_it = 0.0
              else:
                  now = time.time()
                  time_per_it = now - (
                      self._t_last_update or time_start
                  )
                  self._t_last_update = now
              val = time_per_it
          else:
              if stat in preds:
                  try:
                      val = self.gather_value(preds[stat])
                  except KeyError:
                      raise ValueError(
                          "could not extract prediction %s\
                                            from the prediction dictionary"
                          % stat
                      ) from None
              else:
                  val = None
  
          if val is not None:
              self.stats[stat_set][stat].update(val, epoch=epoch, n=1)
  
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 12 for calling the Stats obj's underlying member method code with example usage: obj.update(preds, time_start, freeze_iter, stat_set) without return types