tf.keras.layers.DenseFeatures

A layer that produces a dense Tensor based on given feature_columns.

Inherits From: DenseFeatures, Layer, Module

Used in the notebooks

Used in the tutorials

Generally a single example in training data is described with FeatureColumns. At the first layer of the model, this column oriented data should be converted to a single Tensor.

This layer can be called multiple times with different features.

This is the V2 version of this layer that uses name_scopes to create variables instead of variable_scopes. But this approach currently lacks support for partitioned variables. In that case, use the V1 version instead.

Example:

price = tf.feature_column.numeric_column('price')
keywords_embedded = tf.feature_column.embedding_column(
    tf.feature_column.categorical_column_with_hash_bucket("keywords", 10K),
    dimensions=16)
columns = [price, keywords_embedded, ...]
feat