class_docstr: Writes entries directly to event files in the log_dir to be consumed by TensorBoard.
  
  The `SummaryWriter` class provides a high-level API 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","entries","directly","to","event","files","in","the","log_dir","to","be","consumed","by","TensorBoard",".","The","`","SummaryWriter","`","class","provides","a","high-level","API","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 graph data to summary.
  
  Args:
      model (torch.nn.Module): Model to draw.
      input_to_model (torch.Tensor or list of torch.Tensor): A variable or a tuple of
          variables to be fed.
      verbose (bool): Whether to print graph structure in console.
      use_strict_trace (bool): Whether to pass keyword argument `strict` to
          `torch.jit.trace`. Pass False when you want the tracer to
          record your mutable container types (list, dict)
docstr_tok: ["Add","graph","data","to","summary",".","Args",":","model","(","torch.nn.Module",")",":","Model","to","draw",".","input_to_model","(","torch.Tensor","or","list","of","torch.Tensor",")",":","A","variable","or","a","tuple","of","variables","to","be","fed",".","verbose","(","bool",")",":","Whether","to","print","graph","structure","in","console",".","use_strict_trace","(","bool",")",":","Whether","to","pass","keyword","argument","`","strict","`","to","`","torch.jit.trace","`",".","Pass","False","when","you","want","the","tracer","to","record","your","mutable","container","types","(","list",",","dict",")"]
code: def add_graph(
      self,
      model,
      input_to_model=None,
      verbose=False,
      use_strict_trace=True,
  ):
      """Add graph data to summary.
  
      Args:
          model (torch.nn.Module): Model to draw.
          input_to_model (torch.Tensor or list of torch.Tensor): A variable or a tuple of
              variables to be fed.
          verbose (bool): Whether to print graph structure in console.
          use_strict_trace (bool): Whether to pass keyword argument `strict` to
              `torch.jit.trace`. Pass False when you want the tracer to
              record your mutable container types (list, dict)
      """
      torch._C._log_api_usage_once("tensorboard.logging.add_graph")
      if hasattr(model, "forward"):
          # A valid PyTorch model should have a 'forward' method
          self._get_file_writer().add_graph(
              graph(model, input_to_model, verbose, use_strict_trace)
          )
      else:
          # Caffe2 models do not have the 'forward' method
          from caffe2.proto import caffe2_pb2
          from caffe2.python import core
  
          from ._caffe2_graph import (
              model_to_graph_def,
              nets_to_graph_def,
              protos_to_graph_def,
          )
  
          if isinstance(model, list):
              if isinstance(model[0], core.Net):
                  current_graph = nets_to_graph_def(model)
              elif isinstance(model[0], caffe2_pb2.NetDef):
                  current_graph = protos_to_graph_def(model)
          else:
              # Handles cnn.CNNModelHelper, model_helper.ModelHelper
              current_graph = model_to_graph_def(model)
          event = event_pb2.Event(
              graph_def=current_graph.SerializeToString()
          )
          self._get_file_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 19 for calling the SummaryWriter obj's underlying member method code with example usage: obj.add_graph(model, input_to_model, verbose, use_strict_trace) without return types