class_docstr: Writes protocol buffers to event files to be consumed by TensorBoard.
  
  The `FileWriter` class provides a mechanism to create an event file in a
  given directory and add summaries and events to it. The class updates the
  file contents asynchronously. This allows a training program to call methods
  to add data to the file directly from the training loop, without slowing down
  training.
class_docstr_tok: ["Writes","protocol","buffers","to","event","files","to","be","consumed","by","TensorBoard",".","The","`","FileWriter","`","class","provides","a","mechanism","to","create","an","event","file","in","a","given","directory","and","add","summaries","and","events","to","it",".","The","class","updates","the","file","contents","asynchronously",".","This","allows","a","training","program","to","call","methods","to","add","data","to","the","file","directly","from","the","training","loop",",","without","slowing","down","training","."]
docstr: Create a `FileWriter` and an event file.
  
  On construction the writer creates a new event file in `log_dir`.
  The other arguments to the constructor control the asynchronous writes to
  the event file.
  
  Args:
    log_dir: A string. Directory where event file will be written.
    max_queue: Integer. Size of the queue for pending events and
      summaries before one of the 'add' calls forces a flush to disk.
      Default is ten items.
    flush_secs: Number. How often, in seconds, to flush the
      pending events and summaries to disk. Default is every two minutes.
    filename_suffix: A string. Suffix added to all event filenames
      in the log_dir directory. More details on filename construction in
      tensorboard.summary.writer.event_file_writer.EventFileWriter.
docstr_tok: ["Create","a","`","FileWriter","`","and","an","event","file",".","On","construction","the","writer","creates","a","new","event","file","in","`","log_dir","`",".","The","other","arguments","to","the","constructor","control","the","asynchronous","writes","to","the","event","file",".","Args",":","log_dir",":","A","string",".","Directory","where","event","file","will","be","written",".","max_queue",":","Integer",".","Size","of","the","queue","for","pending","events","and","summaries","before","one","of","the","'add","'","calls","forces","a","flush","to","disk",".","Default","is","ten","items",".","flush_secs",":","Number",".","How","often",",","in","seconds",",","to","flush","the","pending","events","and","summaries","to","disk",".","Default","is","every","two","minutes",".","filename_suffix",":","A","string",".","Suffix","added","to","all","event","filenames","in","the","log_dir","directory",".","More","details","on","filename","construction","in","tensorboard.summary.writer.event_file_writer.EventFileWriter","."]
code: def __init__(
      self, log_dir, max_queue=10, flush_secs=120, filename_suffix=""
  ):
      """Create a `FileWriter` and an event file.
  
      On construction the writer creates a new event file in `log_dir`.
      The other arguments to the constructor control the asynchronous writes to
      the event file.
  
      Args:
        log_dir: A string. Directory where event file will be written.
        max_queue: Integer. Size of the queue for pending events and
          summaries before one of the 'add' calls forces a flush to disk.
          Default is ten items.
        flush_secs: Number. How often, in seconds, to flush the
          pending events and summaries to disk. Default is every two minutes.
        filename_suffix: A string. Suffix added to all event filenames
          in the log_dir directory. More details on filename construction in
          tensorboard.summary.writer.event_file_writer.EventFileWriter.
      """
      # Sometimes PosixPath is passed in and we need to coerce it to
      # a string in all cases
      # TODO: See if we can remove this in the future if we are
      # actually the ones passing in a PosixPath
      log_dir = str(log_dir)
      self.event_writer = EventFileWriter(
          log_dir, max_queue, flush_secs, filename_suffix
      )
  
imports: import os
  import time
  from typing import List, Optional, Union, TYPE_CHECKING
  import torch
  from tensorboard.compat import tf
  from tensorboard.compat.proto import event_pb2
  from tensorboard.compat.proto.event_pb2 import Event, SessionLog
  from tensorboard.plugins.projector.projector_config_pb2 import ProjectorConfig
  from tensorboard.summary.writer.event_file_writer import EventFileWriter
  from ._convert_np import make_np
  from ._embedding import get_embedding_info, make_mat, make_sprite, make_tsv, write_pbtxt
  from ._onnx_graph import load_onnx_graph
  from ._pytorch_graph import graph
  from ._utils import figure_to_image
  from .summary import audio, custom_scalars, histogram, histogram_raw, hparams, image, image_boxes, mesh, pr_curve, pr_curve_raw, scalar, tensor_proto, text, video
label_desc: Use image node_id 1 to create a new FileWriter object  with example: obj = FileWriter(log_dir, max_queue, flush_secs, filename_suffix)