class_docstr: Abstractly implements the SummaryWriter API.
  
  This API basically implements a number of endpoints (add_summary,
  add_session_log, etc). The endpoints all generate an event protobuf, which is
  passed to the contained event_writer.
docstr: Adds a `Graph` to the event file.
  
  The graph described by the protocol buffer will be displayed by
  TensorBoard. Most users pass a graph in the constructor instead.
  
  Args:
    graph: A `Graph` object, such as `sess.graph`.
    global_step: Number. Optional global step counter to record with the
      graph.
    graph_def: DEPRECATED. Use the `graph` parameter instead.
  
  Raises:
    ValueError: If both graph and graph_def are passed to the method.
code: def add_graph(self, graph, global_step=None, graph_def=None):
      """Adds a `Graph` to the event file.
  
      The graph described by the protocol buffer will be displayed by
      TensorBoard. Most users pass a graph in the constructor instead.
  
      Args:
        graph: A `Graph` object, such as `sess.graph`.
        global_step: Number. Optional global step counter to record with the
          graph.
        graph_def: DEPRECATED. Use the `graph` parameter instead.
  
      Raises:
        ValueError: If both graph and graph_def are passed to the method.
      """
  
      if graph is not None and graph_def is not None:
          raise ValueError(
              "Please pass only graph, or graph_def (deprecated), "
              "but not both."
          )
  
      if isinstance(graph, ops.Graph) or isinstance(
          graph_def, ops.Graph
      ):
          # The user passed a `Graph`.
  
          # Check if the user passed it via the graph or the graph_def argument and
          # correct for that.
          if not isinstance(graph, ops.Graph):
              logging.warning(
                  "When passing a `Graph` object, please use the `graph`"
                  " named argument instead of `graph_def`."
              )
              graph = graph_def
  
          # Serialize the graph with additional info.
          true_graph_def = graph.as_graph_def(add_shapes=True)
          self._write_plugin_assets(graph)
      elif isinstance(graph, graph_pb2.GraphDef) or isinstance(
          graph_def, graph_pb2.GraphDef
      ):
          # The user passed a `GraphDef`.
          logging.warning(
              "Passing a `GraphDef` to the SummaryWriter is deprecated."
              " Pass a `Graph` object instead, such as `sess.graph`."
          )
  
          # Check if the user passed it via the graph or the graph_def argument and
          # correct for that.
          if isinstance(graph, graph_pb2.GraphDef):
              true_graph_def = graph
          else:
              true_graph_def = graph_def
  
      else:
          # The user passed neither `Graph`, nor `GraphDef`.
          raise TypeError(
              "The passed graph must be an instance of `Graph` "
              "or the deprecated `GraphDef`"
          )
      # Finally, add the graph_def to the summary writer.
      self._add_graph_def(true_graph_def, global_step)
  
imports: import os.path
  import time
  import warnings
  from tensorflow.core.framework import graph_pb2
  from tensorflow.core.framework import summary_pb2
  from tensorflow.core.protobuf import meta_graph_pb2
  from tensorflow.core.util import event_pb2
  from tensorflow.python.eager import context
  from tensorflow.python.framework import meta_graph
  from tensorflow.python.framework import ops
  from tensorflow.python.platform import gfile
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.summary import plugin_asset
  from tensorflow.python.summary.writer.event_file_writer import EventFileWriter
  from tensorflow.python.summary.writer.event_file_writer_v2 import EventFileWriterV2
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 5 for calling the SummaryToEventTransformer obj's underlying member method code with example usage: obj.add_graph(graph, global_step, graph_def) without return types