def get_values(x: common_types.TensorType) -> tf.Tensor:
  """Extracts values if the given tensor is composite."""
  if isinstance(x, tf.SparseTensor):
    return x.values
  elif isinstance(x, tf.RaggedTensor):
    return x.flat_values
  else:
    return x
Extracts values if the given tensor is composite.
tensorflow_transform/tf_utils.py