class_docstr: Stats logging object useful for gathering statistics of training
  a deep network in PyTorch.
  
  Example:
      ```
      # Init stats structure that logs statistics 'objective' and 'top1e'.
      stats = Stats( ('objective','top1e') )
  
      network = init_net()  # init a pytorch module (=neural 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:
              # Run a model and save into a dict of output variables "output"
              output = network(batch)
  
              # stats.update() automatically parses the 'objective' and 'top1e'
              # from the "output" dict and stores this into the db.
              stats.update(output)
              stats.print() # prints the averages over given epoch
  
          # 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')
      ```
docstr: Args:
      log_vars: The list of variable names to be logged.
      verbose: Print status messages.
      epoch: The initial epoch of the object.
      plot_file: The path to the file that will hold the training plots.
docstr_tok: ["Args",":","log_vars",":","The","list","of","variable","names","to","be","logged",".","verbose",":","Print","status","messages",".","epoch",":","The","initial","epoch","of","the","object",".","plot_file",":","The","path","to","the","file","that","will","hold","the","training","plots","."]
code: def __init__(
      self,
      log_vars: List[str],
      verbose: bool = False,
      epoch: int = -1,
      plot_file: Optional[str] = None,
  ) -> None:
      """
      Args:
          log_vars: The list of variable names to be logged.
          verbose: Print status messages.
          epoch: The initial epoch of the object.
          plot_file: The path to the file that will hold the training plots.
      """
      self.verbose = verbose
      self.log_vars = log_vars
      self.plot_file = plot_file
      self.hard_reset(epoch=epoch)
  
imports: import time
  import warnings
  from itertools import cycle
  from typing import List, Optional
  import matplotlib
  import matplotlib.pyplot
  import numpy
  from matplotlib import colors
  from visdom import Visdom
label_desc: Use image node_id 1 to create a new Stats object  with example: obj = Stats(log_vars, verbose, epoch, plot_file)