code: def build_output_map(protomap, get_tensor_by_name):
      """Builds a map of tensors from `protomap` using `get_tensor_by_name`.
  
      Args:
        protomap: A proto map<string,TensorInfo>.
        get_tensor_by_name: A lambda that receives a tensor name and returns a
          Tensor instance.
  
      Returns:
        A map from string to Tensor or CompositeTensor instances built from
        `protomap` and resolving tensors using `get_tensor_by_name()`.
  
      Raises:
        ValueError: if a TensorInfo proto is malformed.
      """
  
      def get_output_from_tensor_info(tensor_info):
          encoding = tensor_info.WhichOneof("encoding")
          if encoding == "name":
              return get_tensor_by_name(tensor_info.name)
          elif encoding == "coo_sparse":
              return tf.SparseTensor(
                  get_tensor_by_name(
                      tensor_info.coo_sparse.indices_tensor_name
                  ),
                  get_tensor_by_name(
                      tensor_info.coo_sparse.values_tensor_name
                  ),
                  get_tensor_by_name(
                      tensor_info.coo_sparse.dense_shape_tensor_name
                  ),
              )
          elif encoding == "composite_tensor":
              type_spec = tf_utils.composite_tensor_info_to_type_spec(
                  tensor_info
              )
              components = [
                  get_tensor_by_name(component.name)
                  for component in tensor_info.composite_tensor.components
              ]
              return tf_utils.composite_tensor_from_components(
                  type_spec, components
              )
          else:
              raise ValueError(
                  "Invalid TensorInfo.encoding: %s" % encoding
              )
  
      return {
          key: get_output_from_tensor_info(tensor_info)
          for key, tensor_info in protomap.items()
      }
  
imports: import tensorflow
  from tensorflow_hub import tf_utils
label_desc: Use image node_id 7 for calling a global function with example usage: build_output_map(protomap, get_tensor_by_name) and returns: unknown, get_tensor_by_name, tf, tf_utils