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

Masking layer doesn't work #50

Open
FrancescoFrontino opened this issue Sep 10, 2018 · 1 comment
Open

Masking layer doesn't work #50

FrancescoFrontino opened this issue Sep 10, 2018 · 1 comment

Comments

@FrancescoFrontino
Copy link

I encountered some problems using the masking layer. The network, instead of skipping the padded timestamps, computes the gradients obtaining nan values. More in detail, I have padded the sequences with the value -1.0 using the pad_sequences function implemented in keras. Then, I have trained the model using the train_on_batch method.

Do you already face these kinds of problems?

Can be this explanation a reason for such problems? "If any downstream layer does not support masking yet receives such an input mask, an exception will be raised." -- keras documentation

@ragulpr
Copy link
Owner

ragulpr commented Sep 11, 2018

Hi thanks for comment! Do you have a reproducible example? I've never used pad_sequences myself.

In any case (when it's working) mask layer will multiply loss function by 0/1 mask if all above layer propagates the mask. So if any of the outputs is NaN then endresult would be NaN after summation

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