# tf.feature_column.make_parse_example_spec

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 2 version](https://www.tensorflow.org/api_docs/python/tf/feature_column/make_parse_example_spec) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/feature_column/feature_column.py#L755-L814) |

Creates parsing spec dictionary from input feature_columns.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.feature_column.make_parse_example_spec`](https://www.tensorflow.org/api_docs/python/tf/compat/v1/feature_column/make_parse_example_spec)

<br />

    tf.feature_column.make_parse_example_spec(
        feature_columns
    )

The returned dictionary can be used as arg 'features' in
[`tf.io.parse_example`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/io/parse_example).

#### Typical usage example:

    # Define features and transformations
    feature_a = categorical_column_with_vocabulary_file(...)
    feature_b = numeric_column(...)
    feature_c_bucketized = bucketized_column(numeric_column("feature_c"), ...)
    feature_a_x_feature_c = 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=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)
    }

<br />

<br />

<br />

| ## Args ||
|---|---|
| `feature_columns` | An iterable containing all feature columns. All items should be instances of classes derived from `_FeatureColumn`. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A dict mapping each feature key to a `FixedLenFeature` or `VarLenFeature` value. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | If any of the given `feature_columns` is not a `_FeatureColumn` instance. |

<br />