code: def _parse_tensor_info_proto(tensor_info):
      """Returns a ParsedTensorInfo instance from a TensorInfo proto."""
      encoding = tensor_info.WhichOneof("encoding")
      if encoding == "name":
          dtype = tf.DType(tensor_info.dtype)
          shape = tf.TensorShape(tensor_info.tensor_shape)
          return ParsedTensorInfo(
              dtype=dtype, shape=shape, is_sparse=False
          )
      elif encoding == "coo_sparse":
          dtype = tf.DType(tensor_info.dtype)
          shape = tf.TensorShape(tensor_info.tensor_shape)
          return ParsedTensorInfo(
              dtype=dtype, shape=shape, is_sparse=True
          )
      elif encoding == "composite_tensor":
          spec = tf_utils.composite_tensor_info_to_type_spec(
              tensor_info
          )
          return ParsedTensorInfo.from_type_spec(spec)
      else:
          raise ValueError(
              "Unsupported TensorInfo encoding %r" % encoding
          )
  
imports: import tensorflow
  from tensorflow_hub import tf_utils
label_desc: Use image node_id 1 for calling a global function with example usage: _parse_tensor_info_proto(tensor_info) and returns: ParsedTensorInfo, ParsedTensorInfo, ParsedTensorInfo