Skip to content

Modify TransformerEncoder masking documentation #2297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

sonali-kumari1
Copy link
Contributor

Improved TransformerEncoder masking documentation: Added explicit masking details (using padding_mask and custom attention_mask arguments) to complement implicit Keras masking (using mask_zero=True).
Fixes #2220

Copy link
Member

@mattdangerw mattdangerw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lg! just one nit

Keras padding mask (for example, by passing `mask_zero=True` to a
`keras.layers.Embedding` layer). See the Masking and Padding
This layer will compute an attention mask, prioritizing explicitly provided
masks(a `padding_mask` or a custom `attention_mask`) over an implicit Keras
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space before paren

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mattdangerw, I have added space before parenthesis. Thanks!

@sachinprasadhs sachinprasadhs merged commit 66a60ce into keras-team:master Jun 18, 2025
7 checks passed
@sonali-kumari1 sonali-kumari1 deleted the TransformerEncoderTest branch June 18, 2025 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TransformerEncoder silently ignores mask_zero=True despite docs claim
3 participants