code: def import_graph(hl_graph, tf_graph, output=None, verbose=False):
      """Convert TF graph to directed graph
      tfgraph: A TF Graph object.
      output: Name of the output node (string).
      verbose: Set to True for debug print output
      """
      # Get clean(er) list of nodes
      graph_def = tf_graph.as_graph_def(add_shapes=True)
      graph_def = tf.graph_util.remove_training_nodes(graph_def)
  
      # Dump list of TF nodes (DEBUG only)
      if verbose:
          dump_tf_graph(tf_graph, graph_def)
  
      # Loop through nodes and build the matching directed graph
      for tf_node in graph_def.node:
          # Read node details
          try:
              op, uid, name, shape, params = import_node(
                  tf_node, tf_graph, verbose
              )
          except:
              if verbose:
                  logging.exception(
                      "Failed to read node {}".format(tf_node)
                  )
              continue
  
          # Add node
          hl_node = Node(
              uid=uid,
              name=name,
              op=op,
              output_shape=shape,
              params=params,
          )
          hl_graph.add_node(hl_node)
  
          # Add edges
          for target_node in graph_def.node:
              target_inputs = target_node.input
              if uid in target_node.input:
                  hl_graph.add_edge_by_id(uid, target_node.name, shape)
      return hl_graph
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import tensorflow
  from .graph import Graph, Node
  from .None import transforms
label_desc: Use image node_id 2 for calling a global function with example usage: import_graph(hl_graph, tf_graph, output, verbose) and returns: hl_graph