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: Add an event to the event file.
  
  Args:
    event: An `Event` protocol buffer.
    step: Number. Optional global step value for training process
      to record with the event.
    walltime: float. Optional walltime to override the default (current)
      walltime (from time.time()) seconds after epoch
docstr_tok: ["Add","an","event","to","the","event","file",".","Args",":","event",":","An","`","Event","`","protocol","buffer",".","step",":","Number",".","Optional","global","step","value","for","training","process","to","record","with","the","event",".","walltime",":","float",".","Optional","walltime","to","override","the","default","(","current",")","walltime","(","from","time.time","(",")",")","seconds","after","epoch"]
code: def add_event(self, event, step=None, walltime=None):
      """Add an event to the event file.
  
      Args:
        event: An `Event` protocol buffer.
        step: Number. Optional global step value for training process
          to record with the event.
        walltime: float. Optional walltime to override the default (current)
          walltime (from time.time()) seconds after epoch
      """
      event.wall_time = time.time() if walltime is None else walltime
      if step is not None:
          # Make sure step is converted from numpy or other formats
          # since protobuf might not convert depending on version
          event.step = int(step)
      self.event_writer.add_event(event)
  
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 3 for calling the FileWriter obj's underlying member method code with example usage: obj.add_event(event, step, walltime) without return types