class_docstr: Log to local file system in `TensorBoard <https://www.tensorflow.org/tensorboard>`_ format.
  
  Implemented using :class:`~tensorboardX.SummaryWriter`. Logs are saved to
  ``os.path.join(root_dir, name, version)``. This is the recommended logger in Lightning Fabric.
  
  Args:
      root_dir: The root directory in which all your experiments with different names and versions will be stored.
      name: Experiment name. Defaults to ``'lightning_logs'``. If it is the empty string then no per-experiment
          subdirectory is used.
      version: Experiment version. If version is not specified the logger inspects the save
          directory for existing versions, then automatically assigns the next available version.
          If it is a string then it is used as the run-specific subdirectory name,
          otherwise ``'version_${version}'`` is used.
      default_hp_metric: Enables a placeholder metric with key `hp_metric` when `log_hyperparams` is
          called without a metric (otherwise calls to ``log_hyperparams`` without a metric are ignored).
      prefix: A string to put at the beginning of all metric keys.
      sub_dir: Sub-directory to group TensorBoard logs. If a ``sub_dir`` argument is passed
          then logs are saved in ``/root_dir/name/version/sub_dir/``. Defaults to ``None`` in which case
          logs are saved in ``/root_dir/name/version/``.
      \**kwargs: Additional arguments used by :class:`tensorboardX.SummaryWriter` can be passed as keyword
          arguments in this logger. To automatically flush to disk, `max_queue` sets the size
          of the queue for pending logs before flushing. `flush_secs` determines how many seconds
          elapses before flushing.
  
  
  Example::
  
      from lightning.fabric.loggers import TensorBoardLogger
  
      logger = TensorBoardLogger("path/to/logs/root", name="my_model")
      logger.log_hyperparams({"epochs": 5, "optimizer": "Adam"})
      logger.log_metrics({"acc": 0.75})
      logger.finalize("success")
code: def __init__(
      self,
      root_dir: _PATH,
      name: Optional[str] = "lightning_logs",
      version: Optional[Union[int, str]] = None,
      default_hp_metric: bool = True,
      prefix: str = "",
      sub_dir: Optional[_PATH] = None,
      **kwargs: Any,
  ):
      if not _TENSORBOARD_AVAILABLE and not _TENSORBOARDX_AVAILABLE:
          raise ModuleNotFoundError(
              "Neither `tensorboard` nor `tensorboardX` is available. Try `pip install`ing either.\n"
              f"{str(_TENSORBOARDX_AVAILABLE)}\n{str(_TENSORBOARD_AVAILABLE)}"
          )
      super().__init__()
      root_dir = os.fspath(root_dir)
      self._root_dir = root_dir
      self._name = name or ""
      self._version = version
      self._sub_dir = None if sub_dir is None else os.fspath(sub_dir)
  
      self._default_hp_metric = default_hp_metric
      self._prefix = prefix
      self._fs = get_filesystem(root_dir)
  
      self._experiment: Optional["SummaryWriter"] = None
      self._kwargs = kwargs
  
imports: import logging
  import os
  from argparse import Namespace
  from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union
  from lightning_utilities.core.imports import RequirementCache
  from torch import Tensor
  from torch.nn import Module
  from typing_extensions import override
  from lightning.fabric.loggers.logger import Logger, rank_zero_experiment
  from lightning.fabric.utilities.cloud_io import _is_dir, get_filesystem
  from lightning.fabric.utilities.logger import _add_prefix, _convert_params, _flatten_dict
  from lightning.fabric.utilities.logger import _sanitize_params
  from lightning.fabric.utilities.rank_zero import rank_zero_only, rank_zero_warn
  from lightning.fabric.utilities.types import _PATH
  from lightning.fabric.wrappers import _unwrap_objects
label_desc: Use image node_id 1 to create a new TensorBoardLogger object from inherited base classes: Logger with example: obj = TensorBoardLogger(root_dir, name, version, default_hp_metric, prefix, sub_dir)