-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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
Fix TimeDistributed BatchNormalization #7467
Conversation
Thanks for your job.But it got 1 failing check in |
cb58df0
to
7d5802f
Compare
Thanks for the heads up! I had a line over indented. It's fixed, and I also fixed another indentation issue that was already in the original code. |
|
Is this the same as BatchNormalization's |
is there any chance #7033 might be fixed by this or could be updated to do so? |
e5bbcb1
to
8049b84
Compare
@fchollet Done! Added the unit tests and removed the \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Three more things:
- please keep lines under 80 chars (approx), there are long lines in the test
- make
input_map
a private attribute (_input_map
) - in the test, you use
"
as quote character, but the rest of the file uses'
Thanks!
The CI test fails with W503 error, but actually the testing tool is enforcing PEP8 wrong. PyCQA/pycodestyle#498
4865173
to
9a4d9fc
Compare
@fchollet Done! Please review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
This PR fixes issue #7466. The root cause of the problem is that TimeDistributed reshapes the inputs before passing them to BatchNormalization, and batch normalization has update ops that are conditioned on the inputs. Since the inputs to TimeDistributed are different from those passed to BatchNormalization, the conditional updates don't get executed and the mean and variance don't get updated.
Wrappers could modify the inputs in many different ways, so I implemented a generic solution on the Wrapper class to map wrapper inputs to inner layer inputs. This solution should fix the issue with BatchNormaliztion and also with any other wrapped layer that might have update ops conditioned on its inputs.