class_docstr: Accumulator for loss statistics.
  Currently calculates:
  
  * accuracy
  * perplexity
  * elapsed time
docstr: Write out statistics to stdout.
  
  Args:
     step (int): current step
     n_batch (int): total batches
     start (int): start time of step.
docstr_tok: ["Write","out","statistics","to","stdout",".","Args",":","step","(","int",")",":","current","step","n_batch","(","int",")",":","total","batches","start","(","int",")",":","start","time","of","step","."]
code: def output(self, step, num_steps, learning_rate, start):
      """Write out statistics to stdout.
  
      Args:
         step (int): current step
         n_batch (int): total batches
         start (int): start time of step.
      """
      t = self.elapsed_time()
      step_fmt = "%2d" % step
      if num_steps > 0:
          step_fmt = "%s/%5d" % (step_fmt, num_steps)
      logger.info(
          (
              "Step %s; acc: %2.1f; ppl: %5.1f; xent: %2.1f; "
              + "lr: %7.5f; sents: %7.0f; bsz: %4.0f/%4.0f/%2.0f; "
              + "%3.0f/%3.0f tok/s; %6.0f sec;"
          )
          % (
              step_fmt,
              self.accuracy(),
              self.ppl(),
              self.xent(),
              learning_rate,
              self.n_sents,
              self.n_src_words / self.n_batchs,
              self.n_words / self.n_batchs,
              self.n_sents / self.n_batchs,
              self.n_src_words / (t + 1e-5),
              self.n_words / (t + 1e-5),
              time.time() - start,
          )
          + "".join(
              [
                  " {}: {}".format(k, round(v, 2))
                  for k, v in self.computed_metrics.items()
              ]
          )
      )
      sys.stdout.flush()
  
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 9 for calling the Statistics obj's underlying member method code with example usage: obj.output(step, num_steps, learning_rate, start) without return types