code: def save_graph(net, file_name, graph_name="net", op_only=True):
      from caffe2.python import net_drawer
  
      graph = None
      ops = net.op
      if not op_only:
          graph = net_drawer.GetPydotGraph(
              ops, graph_name, rankdir="TB"
          )
      else:
          graph = net_drawer.GetPydotGraphMinimal(
              ops, graph_name, rankdir="TB", minimal_dependency=True
          )
  
      try:
          graph.write_png(file_name)
      except Exception as e:
          print("Error when writing graph to image {}".format(e))
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  from functools import wraps
  import copy
  import numpy
  from caffe2.python import core, workspace
  from caffe2.proto import caffe2_pb2
label_desc: Use image node_id 22 for calling a global function with example usage: save_graph(net, file_name, graph_name, op_only) without return types