class_docstr: A wrapper around the traced model in Caffe2's protobuf format.
  The exported graph has different inputs/outputs from the original Pytorch
  model, as explained in :class:`Caffe2Tracer`. This class wraps around the
  exported graph to simulate the same interface as the original Pytorch model.
  It also provides functions to save/load models in Caffe2's format.'
  
  Examples:
  ::
      c2_model = Caffe2Tracer(cfg, torch_model, inputs).export_caffe2()
      inputs = [{"image": img_tensor_CHW}]
      outputs = c2_model(inputs)
      orig_outputs = torch_model(inputs)
docstr: Save the graph as SVG format.
  
  Args:
      output_file (str): a SVG file
      inputs: optional inputs given to the model.
          If given, the inputs will be used to run the graph to record
          shape of every tensor. The shape information will be
          saved together with the graph.
docstr_tok: ["Save","the","graph","as","SVG","format",".","Args",":","output_file","(","str",")",":","a","SVG","file","inputs",":","optional","inputs","given","to","the","model",".","If","given",",","the","inputs","will","be","used","to","run","the","graph","to","record","shape","of","every","tensor",".","The","shape","information","will","be","saved","together","with","the","graph","."]
code: def save_graph(self, output_file, inputs=None):
      """
      Save the graph as SVG format.
  
      Args:
          output_file (str): a SVG file
          inputs: optional inputs given to the model.
              If given, the inputs will be used to run the graph to record
              shape of every tensor. The shape information will be
              saved together with the graph.
      """
      from .caffe2_export import run_and_save_graph
  
      if inputs is None:
          save_graph(self._predict_net, output_file, op_only=False)
      else:
          size_divisibility = get_pb_arg_vali(
              self._predict_net, "size_divisibility", 0
          )
          device = get_pb_arg_vals(
              self._predict_net, "device", b"cpu"
          ).decode("ascii")
          inputs = convert_batched_inputs_to_c2_format(
              inputs, size_divisibility, device
          )
          inputs = [x.cpu().numpy() for x in inputs]
          run_and_save_graph(
              self._predict_net, self._init_net, inputs, output_file
          )
  
imports: import copy
  import logging
  import os
  import torch
  from caffe2.proto import caffe2_pb2
  from torch import nn
  from detectron2.config import CfgNode
  from detectron2.utils.file_io import PathManager
  from .caffe2_inference import ProtobufDetectionModel
  from .caffe2_modeling import META_ARCH_CAFFE2_EXPORT_TYPE_MAP, convert_batched_inputs_to_c2_format
  from .shared import get_pb_arg_vali, get_pb_arg_vals, save_graph
label_desc: Use image node_id 5 for calling the Caffe2Model obj's underlying member method code with example usage: obj.save_graph(output_file, inputs) without return types