def _ragged_tensor_representation_as_feature_spec(
    name: str, tensor_representation: schema_pb2.TensorRepresentation,
    feature_by_name: Dict[str, schema_pb2.Feature],
    string_domains: Dict[str, common_types.DomainType]
) -> Tuple[tf.io.RaggedFeature, Optional[common_types.DomainType]]:
  """Returns a representation of a RaggedTensor as a feature spec."""
  value_feature = pop_ragged_source_columns(name, tensor_representation,
                                            feature_by_name)
  spec = tensor_representation_util.CreateTfExampleParserConfig(
      tensor_representation, value_feature.type)
  domain = _get_domain(value_feature, string_domains)
  return typing.cast(tf.io.RaggedFeature, spec), domain
Returns a representation of a RaggedTensor as a feature spec.
tensorflow_transform/tf_metadata/schema_utils.py