def lookup_tensor_or_sparse_or_composite_tensor(tensor_info):
    """Returns the remapped tensor corresponding to TensorInfo."""
    encoding = tensor_info.WhichOneof('encoding')
    if encoding == 'coo_sparse':
      return tf.SparseTensor(
          lookup_remapped_tensor(tensor_info.coo_sparse.indices_tensor_name),
          lookup_remapped_tensor(tensor_info.coo_sparse.values_tensor_name),
          lookup_remapped_tensor(
              tensor_info.coo_sparse.dense_shape_tensor_name))
    elif encoding == 'composite_tensor':
      components = [lookup_remapped_tensor(info.name)
                    for info in tensor_info.composite_tensor.components]
      spec_proto = struct_pb2.StructuredValue(
          type_spec_value=tensor_info.composite_tensor.type_spec)
      # StrcutureCoder.decode_proto was migrated after TF 2.7 to
      # nested_structure_coder.decode_proto.
      try:
        spec = nested_structure_coder.decode_proto(spec_proto)
      except AttributeError:
        struct_coder = nested_structure_coder.StructureCoder()
        spec = struct_coder.decode_proto(spec_proto)
      return spec._from_components(components)  # pylint: disable=protected-access
    elif encoding == 'name':
      return lookup_remapped_tensor(tensor_info.name)
    else:
      raise ValueError('Unsupported TensorInfo encoding %s' % encoding)
Returns the remapped tensor corresponding to TensorInfo.
tensorflow_transform/saved/saved_transform_io.py