tf.feature_column.make_parse_example_spec

Creates parsing spec dictionary from input feature_columns. (deprecated)

The returned dictionary can be used as arg 'features' in tf.io.parse_example.

Typical usage example:

# Define features and transformations
feature_a = tf.feature_column.categorical_column_with_vocabulary_file(...)
feature_b = tf.feature_column.numeric_column(...)
feature_c_bucketized = tf.feature_column.bucketized_column(
    tf.feature_column.numeric_column("feature_c"), ...)
feature_a_x_feature_c = tf.feature_column.crossed_column(
    columns=["feature_a", feature_c_bucketized], ...)

feature_columns = set(
    [feature_b, feature_c_bucketized, feature_a_x_feature_c])
features = tf.io.parse_example(
    serialized=serialized_examples,
    features=tf.feature_column.make_parse_example_spec(feature_columns))

For the above example, make_parse_example_spec would return the dict:

{
    "feature_a": parsing_ops.VarLenFeature(tf.string),
    "feature_b": parsing_ops.FixedLenFeature([1], dtype=tf.float32),
    "feature_c": parsing_ops.FixedLenFeature([1], dtype=tf.float32)
}

feature_columns An iterable containing all feature columns. All items should be instances of classes derived from FeatureColumn.

A dict mapping each feature key to a FixedLenFeature or VarLenFeature value.

ValueError If any of the given feature_columns is not a FeatureColumn instance.