code: def _get_nn_mappings(layers):
      layer_map = {}
      type_map = {}
      output_map = {}
      input_map = {}
      for idx, layer in enumerate(layers):
          layer_name = "{}".format(idx)
          layer_map[layer_name] = {"outputs": [], "inputs": []}
          layer_type = layer.WhichOneof("layer")
          if layer_type not in type_map.keys():
              type_map[layer_type] = []
          type_map[layer_type].append(layer_name)
  
          # Add inputs and outputs for layer
          for o in layer.output:
              layer_map[layer_name]["outputs"].append(o)
          for i in layer.input:
              layer_map[layer_name]["inputs"].append(i)
  
      # Construct input/output graph dict
      for l in layer_map.keys():
          output_map[l] = []
          input_map[l] = []
          for cl in layer_map.keys():
              if any(
                  x in layer_map[l]["outputs"]
                  for x in layer_map[cl]["inputs"]
              ):
                  output_map[l].append(cl)
              if any(
                  x in layer_map[l]["inputs"]
                  for x in layer_map[cl]["outputs"]
              ):
                  input_map[l].append(cl)
  
      return type_map, output_map, input_map
  
imports: import numpy
label_desc: Use image node_id 5 for calling a global function with example usage: _get_nn_mappings(layers) and returns: type_map,  output_map,  input_map