Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions keras_nlp/layers/token_and_position_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@
@keras.utils.register_keras_serializable(package="keras_nlp")
class TokenAndPositionEmbedding(keras.layers.Layer):
"""A layer which sums a token and position embedding.

This layer assumes that the last dimension in the input corresponds
to the sequence dimension.

Token and position embeddings are ways of representing words and their order
in a sentence. This layer creates a `keras.layers.Embedding` token embedding
and a `keras_nlp.layers.PositionEmbedding` position embedding and sums their
output when called. This layer assumes that the last dimension in the input
corresponds to the sequence dimension.

Args:
vocabulary_size: The size of the vocabulary.
Expand Down