Skip to content
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

What mask variable used for? #6

Open
athenspeterlong opened this issue Jun 7, 2016 · 2 comments
Open

What mask variable used for? #6

athenspeterlong opened this issue Jun 7, 2016 · 2 comments

Comments

@athenspeterlong
Copy link

Hello,

great job for implementing the paper and thanks!
However, I've got a question for the 'mask' variable?
What does it used for in LSTM? in the LSTM equations I do not see any related variable?

Thanks for your help!

@jazzsaxmafia
Copy link
Owner

Hello,

mask variable is used because every sentence has different length. Let's say the size of a minibatch is 3, and the length of each sentence (number of words) is 10, 6, 3, then the LSTM has to run for 10 time steps because of the longest sentence. For the sentences with shorter length, I made a mask that has (10, 6, 3) ones for each row and zeros elsewhere, and mask the result after LSTM encoding.
This masking technique is used for all kinds of RNN applications.

Thank you.
-Taeksoo

@shaoxuan92
Copy link

Thank you! Sooo much helpful..

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

No branches or pull requests

3 participants