class_docstr: Saves data in event and summary protos for tensorboard.
class_docstr_tok: ["Saves","data","in","event","and","summary","protos","for","tensorboard","."]
docstr: Create a new SummaryWriter.
  
  Args:
    log_dir: path to record tfevents files in.
    auto_flush: if true, flush after every reported metric.
docstr_tok: ["Create","a","new","SummaryWriter",".","Args",":","log_dir",":","path","to","record","tfevents","files","in",".","auto_flush",":","if","true",",","flush","after","every","reported","metric","."]
code: def __init__(self, log_dir, auto_flush=True):
      """Create a new SummaryWriter.
  
      Args:
        log_dir: path to record tfevents files in.
        auto_flush: if true, flush after every reported metric.
      """
      log_dir = os.fspath(log_dir)
  
      # If needed, create log_dir directory as well as missing parent directories.
      if not io.isdir(log_dir):
          io.makedirs(log_dir)
  
      self._event_writer = tf.summary.create_file_writer(log_dir)
      self._as_default = functools.partial(
          _as_default, auto_flush=auto_flush
      )
      self._closed = False
  
file_path: flax/flax/metrics/tensorboard.py
imports: import contextlib
  import functools
  import os
  import numpy
  import tensorflow
  from tensorboard.plugins.hparams import api
  from flax import io
label_desc: Use image node_id 1 to create a new SummaryWriter object  with example: obj = SummaryWriter(log_dir, auto_flush)