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

The 'mask' operation in the code #7

Open
taylor2success opened this issue Oct 29, 2022 · 2 comments
Open

The 'mask' operation in the code #7

taylor2success opened this issue Oct 29, 2022 · 2 comments

Comments

@taylor2success
Copy link

I've seen 'mask' in a lot of places in your code, such as functions called 'makeMaskfromLength' and 'makepadding', and I'd like to ask how 'mask' works in this task and what it does.

@xichenpan
Copy link
Collaborator

Hi,
these masks means padding mask in this task. you can refer to https://pytorch.org/docs/stable/generated/torch.nn.TransformerEncoder.html for how padding mask works in Transfomer.
makeMaskfromLength function takes a longtensor as input, and output masked matrix. For example, the input is [3, 4, 7]
and the function output can be:
[[F, F, F, T, T, T, T],
[F, F, F, F, T, T, T],
[F, F, F, F, F, F, F]]
makepadding is a large function, it aims at padding the dowansampled audio and visual input stream at 25FPS.
You can try to debug the code to understand how each line works. (I'm sorry not giving enough comments to explain them in my code~

Xichen

@taylor2success
Copy link
Author

Thanks for your reply

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

2 participants