class_docstr: Measures training stats.
code: def __init__(self, epoch_iters, phase="train"):
      self.epoch_iters = epoch_iters
      self.max_iter = cfg.OPTIM.MAX_EPOCH * epoch_iters
      self.phase = phase
      self.iter_timer = Timer()
      self.loss = ScalarMeter(cfg.LOG_PERIOD)
      self.loss_total = 0.0
      self.lr = None
      # Current minibatch errors (smoothed over a window)
      self.mb_top1_err = ScalarMeter(cfg.LOG_PERIOD)
      self.mb_top5_err = ScalarMeter(cfg.LOG_PERIOD)
      # Number of misclassified examples
      self.num_top1_mis = 0
      self.num_top5_mis = 0
      self.num_samples = 0
  
imports: from collections import deque
  import numpy
  import pycls.core.logging
  import torch
  from pycls.core.config import cfg
  from pycls.core.timer import Timer
label_desc: Use image node_id 1 to create a new TrainMeter object  with example: obj = TrainMeter(epoch_iters, phase)