class_docstr: Write all scalars to a tensorboard file.
docstr: Args:
      log_dir (str): the directory to save the output events
      window_size (int): the scalars will be median-smoothed by this window size
  
      kwargs: other arguments passed to `torch.utils.tensorboard.SummaryWriter(...)`
docstr_tok: ["Args",":","log_dir","(","str",")",":","the","directory","to","save","the","output","events","window_size","(","int",")",":","the","scalars","will","be","median-smoothed","by","this","window","size","kwargs",":","other","arguments","passed","to","`","torch.utils.tensorboard.SummaryWriter","(","...",")","`"]
code: def __init__(self, log_dir: str, window_size: int = 20, **kwargs):
      """
      Args:
          log_dir (str): the directory to save the output events
          window_size (int): the scalars will be median-smoothed by this window size
  
          kwargs: other arguments passed to `torch.utils.tensorboard.SummaryWriter(...)`
      """
      self._window_size = window_size
      self._writer_args = {"log_dir": log_dir, **kwargs}
      self._last_write = -1
  
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 TensorboardXWriter object from inherited base classes: EventWriter with example: obj = TensorboardXWriter(log_dir, window_size)