class_docstr: Plugin that takes care of tensorboard logging.
class_docstr_tok: ["Plugin","that","takes","care","of","tensorboard","logging","."]
docstr: Initializes the TensorboardLogger.
  
  Args:
      log_dir: Directory into which tensorboard log files will be written
      comment: The comment to specify Comment log_dir suffix appended to the default
        ``log_dir``. If ``log_dir`` is assigned, this argument has no effect.
      tracked_metrics: List of tuples that specify which metrics (in addition to the main_score) shall be plotted in tensorboard, could be [("macro avg", 'f1-score'), ("macro avg", 'precision')] for example
docstr_tok: ["Initializes","the","TensorboardLogger",".","Args",":","log_dir",":","Directory","into","which","tensorboard","log","files","will","be","written","comment",":","The","comment","to","specify","Comment","log_dir","suffix","appended","to","the","default","``","log_dir","``",".","If","``","log_dir","``","is","assigned",",","this","argument","has","no","effect",".","tracked_metrics",":","List","of","tuples","that","specify","which","metrics","(","in","addition","to","the","main_score",")","shall","be","plotted","in","tensorboard",",","could","be","[","(","``","macro","avg","''",",","'f1-score","'",")",",","(","``","macro","avg","''",",","'precision","'",")","]","for","example"]
code: def __init__(
      self, log_dir=None, comment="", tracked_metrics=()
  ) -> None:
      """Initializes the TensorboardLogger.
  
      Args:
          log_dir: Directory into which tensorboard log files will be written
          comment: The comment to specify Comment log_dir suffix appended to the default
            ``log_dir``. If ``log_dir`` is assigned, this argument has no effect.
          tracked_metrics: List of tuples that specify which metrics (in addition to the main_score) shall be plotted in tensorboard, could be [("macro avg", 'f1-score'), ("macro avg", 'precision')] for example
      """
      super().__init__()
      self.comment = comment
      self.tracked_metrics = tracked_metrics
      self.log_dir = log_dir
  
      try:
          from torch.utils.tensorboard import SummaryWriter
  
          if log_dir is not None and not os.path.exists(log_dir):
              os.mkdir(log_dir)
  
          self.writer = SummaryWriter(
              log_dir=log_dir, comment=self.comment
          )
  
          log.info(f"tensorboard logging path is {log_dir}")
  
      except ImportError:
          log_line(log)
          log.warning(
              "ATTENTION! PyTorch >= 1.1.0 and pillow are required for TensorBoard support!"
          )
          log_line(log)
  
      self._warned = False
  
file_path: flair/flair/trainers/plugins/loggers/tensorboard.py
imports: import logging
  import os
  from typing import Any, Dict
  from flair.trainers.plugins.base import TrainerPlugin
  from flair.training_utils import log_line
label_desc: Use image node_id 1 to create a new TensorboardLogger object from inherited base classes: TrainerPlugin with example: obj = TensorboardLogger(log_dir, comment, tracked_metrics)