docstr: :param log_dir: Log directory of TensorBoard.
  :param freq: Frequency of logging metrics and loss.
      Accept values: 'batch' or 'epoch' or integer. When using 'batch',
      writes the losses and metrics to TensorBoard after each batch.
      The same applies for 'epoch'. If using an integer, let's say 1000,
      the callback will write the metrics and losses to TensorBoard every 1000 batches.
      Note that writing too frequently to TensorBoard can slow down your training.
  :param **kwargs: The keyword arguments will be pased to ``SummaryWriter``.
docstr_tok: [":","param","log_dir",":","Log","directory","of","TensorBoard",".",":","param","freq",":","Frequency","of","logging","metrics","and","loss",".","Accept","values",":","'batch","'","or","'epoch","'","or","integer",".","When","using","'batch","'",",","writes","the","losses","and","metrics","to","TensorBoard","after","each","batch",".","The","same","applies","for","'epoch","'",".","If","using","an","integer",",","let","'s","say","1000",",","the","callback","will","write","the","metrics","and","losses","to","TensorBoard","every","1000","batches",".","Note","that","writing","too","frequently","to","TensorBoard","can","slow","down","your","training",".",":","param","*","*","kwargs",":","The","keyword","arguments","will","be","pased","to","``","SummaryWriter","``","."]
code: def __init__(
      self,
      log_dir=None,
      freq="epoch",
      **kwargs,
  ):
      """
      :param log_dir: Log directory of TensorBoard.
      :param freq: Frequency of logging metrics and loss.
          Accept values: 'batch' or 'epoch' or integer. When using 'batch',
          writes the losses and metrics to TensorBoard after each batch.
          The same applies for 'epoch'. If using an integer, let's say 1000,
          the callback will write the metrics and losses to TensorBoard every 1000 batches.
          Note that writing too frequently to TensorBoard can slow down your training.
      :param **kwargs: The keyword arguments will be pased to ``SummaryWriter``.
      """
      self.log_dir = log_dir
      self.tmp_dir = os.path.join(
          tempfile.mkdtemp(), os.path.basename(log_dir)
      )
      self.freq = freq
      self.kwargs = kwargs
      self.unlog_items = ["epoch", "batch_count", "num_samples"]
      super().__init__()
  
file_path: BigDL/python/orca/src/bigdl/orca/learn/pytorch/callbacks/tensorboard.py
imports: import os
  import shutil
  import tempfile
  from torch.utils.tensorboard import SummaryWriter
  from bigdl.orca.data.file import put_local_dir_tree_to_remote
  from bigdl.orca.learn.pytorch.callbacks import Callback
  from bigdl.dllib.utils.log4Error import invalidInputError
label_desc: Use image node_id 1 to create a new TensorBoardCallback object from inherited base classes: Callback with example: obj = TensorBoardCallback(log_dir, freq)