code: def import_graph(
      hl_graph, model, args, input_names=None, verbose=False
  ):
      # TODO: add input names to graph
  
      # Run the Pytorch graph to get a trace and generate a graph from it
      trace, out = torch.jit._get_trace_graph(model, args)
      torch_graph = torch.onnx._optimize_trace(
          trace, torch.onnx.OperatorExportTypes.ONNX
      )
  
      # Dump list of nodes (DEBUG only)
      if verbose:
          dump_pytorch_graph(torch_graph)
  
      # Loop through nodes and build HL graph
      for torch_node in torch_graph.nodes():
          # Op
          op = torch_node.kind()
          # Parameters
          params = {
              k: torch_node[k] for k in torch_node.attributeNames()
          }
          # Inputs/outputs
          # TODO: inputs = [i.unique() for i in node.inputs()]
          outputs = [o.unique() for o in torch_node.outputs()]
          # Get output shape
          shape = get_shape(torch_node)
          # Add HL node
          hl_node = Node(
              uid=pytorch_id(torch_node),
              name=None,
              op=op,
              output_shape=shape,
              params=params,
          )
          hl_graph.add_node(hl_node)
          # Add edges
          for target_torch_node in torch_graph.nodes():
              target_inputs = [
                  i.unique() for i in target_torch_node.inputs()
              ]
              if set(outputs) & set(target_inputs):
                  hl_graph.add_edge_by_id(
                      pytorch_id(torch_node),
                      pytorch_id(target_torch_node),
                      shape,
                  )
      return hl_graph
  
file_path: hiddenlayer/hiddenlayer/pytorch_builder.py
imports: from __future__ import absolute_import, division, print_function
  import re
  from .graph import Graph, Node
  from .None import transforms
  import torch
label_desc: Use image node_id 4 for calling a global function with example usage: import_graph(hl_graph, model, args, input_names, verbose) and returns: hl_graph