class_docstr: Print **common** metrics to the terminal, including
  iteration time, ETA, memory, all losses, and the learning rate.
  It also applies smoothing using a window of 20 elements.
  
  It's meant to print common metrics in common ways.
  To print something in more customized ways, please implement a similar printer by yourself.
docstr: Args:
      max_iter: the maximum number of iterations to train.
          Used to compute ETA. If not given, ETA will not be printed.
      window_size (int): the losses will be median-smoothed by this window size
docstr_tok: ["Args",":","max_iter",":","the","maximum","number","of","iterations","to","train",".","Used","to","compute","ETA",".","If","not","given",",","ETA","will","not","be","printed",".","window_size","(","int",")",":","the","losses","will","be","median-smoothed","by","this","window","size"]
code: def __init__(
      self, max_iter: Optional[int] = None, window_size: int = 20
  ):
      """
      Args:
          max_iter: the maximum number of iterations to train.
              Used to compute ETA. If not given, ETA will not be printed.
          window_size (int): the losses will be median-smoothed by this window size
      """
      self.logger = logging.getLogger("detectron2.utils.events")
      self._max_iter = max_iter
      self._window_size = window_size
      self._last_write = None
  
imports: import datetime
  import json
  import logging
  import os
  import time
  from collections import defaultdict
  from contextlib import contextmanager
  from functools import cached_property
  from typing import Optional
  import torch
  from fvcore.common.history_buffer import HistoryBuffer
  from detectron2.utils.file_io import PathManager
label_desc: Use image node_id 1 to create a new CommonMetricPrinter object from inherited base classes: EventWriter with example: obj = CommonMetricPrinter(max_iter, window_size)