class_docstr: Simple logger for TensorBoard.
  
  On construction, the logger creates a new events file that logs
  will be written to.  If the environment variable `RANK` is defined,
  logger will only log if RANK = 0.
  
  Note:
      If using this logger with distributed training:
  
      - This logger should be constructed on all ranks
      - This logger can call collective operations
      - Logs will be written on rank 0 only
      - Logger must be constructed synchronously *after* initializing the distributed process group.
  
  Args:
      path (str): path to write logs to
      *args: Extra positional arguments to pass to SummaryWriter
      **kwargs: Extra keyword arguments to pass to SummaryWriter
  
  Examples::
  
      from torchtnt.utils.loggers import TensorBoardLogger
      logger = TensorBoardLogger(path="tmp/tb_logs")
      logger.log("accuracy", 23.56, 10)
      logger.close()
class_docstr_tok: ["Simple","logger","for","TensorBoard",".","On","construction",",","the","logger","creates","a","new","events","file","that","logs","will","be","written","to",".","If","the","environment","variable","`","RANK","`","is","defined",",","logger","will","only","log","if","RANK","=","0",".","Note",":","If","using","this","logger","with","distributed","training",":","-","This","logger","should","be","constructed","on","all","ranks","-","This","logger","can","call","collective","operations","-","Logs","will","be","written","on","rank","0","only","-","Logger","must","be","constructed","synchronously","*","after","*","initializing","the","distributed","process","group",".","Args",":","path","(","str",")",":","path","to","write","logs","to","*","args",":","Extra","positional","arguments","to","pass","to","SummaryWriter","*","*","kwargs",":","Extra","keyword","arguments","to","pass","to","SummaryWriter","Examples",":",":","from","torchtnt.utils.loggers","import","TensorBoardLogger","logger","=","TensorBoardLogger","(","path=","''","tmp\/tb_logs","''",")","logger.log","(","``","accuracy","''",",","23.56",",","10",")","logger.close","(",")"]
code: def writer(self: TensorBoardLogger) -> Optional[SummaryWriter]:
      return self._writer
  
imports: from __future__ import annotations
  import atexit
  import logging
  from typing import Any, Dict, List, Mapping, Optional, Union
  import torch.distributed
  from torch.utils.tensorboard import SummaryWriter
  from torchtnt.utils.distributed import get_global_rank, PGWrapper
  from torchtnt.utils.loggers.logger import MetricLogger, Scalar
label_desc: Use image node_id 3 for calling the TensorBoardLogger obj's underlying member method code with example usage: obj.writer() and returns: self