code: def build_input_map(protomap, inputs):
      """Builds a map to feed tensors in `protomap` using `inputs`.
  
      Args:
        protomap: A proto map<string,TensorInfo>.
        inputs: A map with same keys as `protomap` of Tensors and CompositeTensors.
  
      Returns:
        A map from nodes refered by TensorInfo protos to corresponding input
        tensors.
  
      Raises:
        ValueError: if a TensorInfo proto is malformed or map keys do not match.
      """
      if set(protomap.keys()) != set(inputs.keys()):
          raise ValueError("build_input_map: keys do not match.")
      input_map = {}
      for key, tensor_info in protomap.items():
          arg = inputs[key]
          encoding = tensor_info.WhichOneof("encoding")
          if encoding == "name":
              input_map[tensor_info.name] = arg
          elif encoding == "coo_sparse":
              coo_sparse = tensor_info.coo_sparse
              input_map[coo_sparse.values_tensor_name] = arg.values
              input_map[coo_sparse.indices_tensor_name] = arg.indices
              input_map[
                  coo_sparse.dense_shape_tensor_name
              ] = arg.dense_shape
          elif encoding == "composite_tensor":
              component_infos = tensor_info.composite_tensor.components
              component_tensors = tf.nest.flatten(
                  arg, expand_composites=True
              )
              for info, tensor in zip(
                  component_infos, component_tensors
              ):
                  input_map[info.name] = tensor
          else:
              raise ValueError(
                  "Invalid TensorInfo.encoding: %s" % encoding
              )
      return input_map
  
imports: import tensorflow
  from tensorflow_hub import tf_utils
label_desc: Use image node_id 6 for calling a global function with example usage: build_input_map(protomap, inputs) and returns: input_map