TableConfig
classkeras_rs.layers.TableConfig(
name: str,
vocabulary_size: int,
embedding_dim: int,
initializer: Union[
str, keras.src.initializers.initializer.Initializer
] = keras.src.initializers.random_initializers.VarianceScaling(mode="fan_out"),
optimizer: Union[str, keras.src.optimizers.optimizer.Optimizer] = "adam",
combiner: str = "mean",
placement: str = "auto",
max_ids_per_partition: int = 256,
max_unique_ids_per_partition: int = 256,
)
Configuration for one embedding table.
Configures one table for use by one or more keras_rs.layers.FeatureConfig
,
which in turn is used to configure a keras_rs.layers.DistributedEmbedding
.
Attributes
truncated_normal_initializer
with mean
0.0
and standard deviation 1 / sqrt(embedding_dim)
.mean
, sqrtn
and sum
are supported. mean
is the
default. sqrtn
often achieves good accuracy, in particular with
bag-of-words columns."auto"
, which is the
default, means that the table is placed on SparseCore if available,
otherwise on the default device where the rest of the model is
placed. A value of "sparsecore"
means the table will be placed on
the SparseCore chips and an error is raised if SparseCore is not
available. A value of "default_device"
means the table will be
placed on the default device where the rest of the model is placed,
even if SparseCore is available. The default device for the rest of
the model is the TPU's TensorCore on TPUs, otherwise the GPU or CPU.