class_docstr: Generates model graph, each node is created from single or multiple jit trace nodes.
class_docstr_tok: ["Generates","model","graph",",","each","node","is","created","from","single","or","multiple","jit","trace","nodes","."]
code: def _build_index(self, nodes_op):
      name_to_node = dict()
      input_to_node = defaultdict(list)
      output_to_node = dict()
      for node in nodes_op:
          name_to_node[node.unique_name] = node
          for _input in node.inputs:
              # inputs may have duplicate tensors
              if node not in input_to_node[_input]:
                  input_to_node[_input].append(node)
          for output in node.outputs:
              if output in output_to_node:
                  assert output_to_node[output] == node, (
                      "One output cannot be generated by multiple nodes %s"
                      % output
                  )
              output_to_node[output] = node
      return name_to_node, input_to_node, output_to_node
  
imports: import logging
  import queue
  import re
  from collections import defaultdict
  from typing import List, Dict
  import torch
  from torch.utils.tensorboard._pytorch_graph import NodePy, NodePyIO, NodePyOP, GraphPy
label_desc: Use image node_id 9 for calling the TorchModuleGraph obj's underlying member method code with example usage: obj._build_index(nodes_op) and returns: name_to_node,  input_to_node,  output_to_node