code: def build_input_map(protomap, inputs):
    
    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
      else:
        raise ValueError("Invalid TensorInfo.encoding: %s" % encoding)
    return input_map
docs: 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 SparseTensors.
  
    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.