code: def load_legacy_inputs(
      meta_graph_def: tf.compat.v1.MetaGraphDef,
      signature_def: tf.compat.v1.MetaGraphDef.SignatureDefEntry,
      graph: tf.Graph,
  ) -> Tuple[Dict[str, types.TensorType], types.TensorType]:
      """Loads legacy inputs.
  
      Args:
        meta_graph_def: MetaGraphDef to lookup nodes in.
        signature_def: SignatureDef to lookup nodes in.
        graph: TensorFlow graph to lookup the nodes in.
  
      Returns:
        Tuple of (inputs_map, input_refs_node)
      """
      input_node = (
          tf.compat.v1.saved_model.utils.get_tensor_from_tensor_info(
              list(signature_def.inputs.values())[0], graph
          )
      )
      try:
          input_refs_node = get_node_in_graph(
              meta_graph_def, encoding.EXAMPLE_REF_COLLECTION, graph
          )
      except KeyError:
          # If we can't find the ExampleRef collection, then this is probably a model
          # created before we introduced the ExampleRef parameter to
          # EvalInputReceiver. In that case, we default to a tensor of range(0,
          # len(input_example)).
          # TODO(b/117519999): Remove this backwards-compatibility shim once all
          # exported EvalSavedModels have ExampleRef.
          input_refs_node = tf.range(tf.size(input=input_node))
      inputs_map = collections.OrderedDict(
          {list(signature_def.inputs)[0]: input_node}
      )
      return (inputs_map, input_refs_node)
  
imports: import collections
  from typing import Dict, List, Optional, Tuple, Union
  import tensorflow
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.eval_saved_model import constants
  from tensorflow_model_analysis.eval_saved_model import encoding
  from tensorflow_model_analysis.eval_saved_model import util
  from google.protobuf import any_pb2
  from tensorflow.core.protobuf import meta_graph_pb2
label_desc: Use image node_id 2 for calling a global function with example usage: load_legacy_inputs(meta_graph_def, signature_def, graph) and returns: inputs_map,  input_refs_node