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

Resolve truncated normal issues #9957

Closed
wants to merge 13 commits into from
Closed

Conversation

mrTsjolder
Copy link
Contributor

Attempt to implement the fix for the issue with truncated normal as discussed in #8048

@fchollet
Copy link
Member

Thanks for the PR.

This would be a breaking behavior change, so we won't merge it. In general it is preferable to align the behavior of backend functions on the corresponding TF functions. If the docstring is misleading, we can fix the docstring.

What we can do, is merge your fix for Theano (since a different behavior for Theano would be a bug), and add a unit test checking that the distributions are equivalent across the different backends.

@mrTsjolder mrTsjolder mentioned this pull request Apr 17, 2018
@mrTsjolder
Copy link
Contributor Author

Changing the documentation of the backend functions would be a good idea indeed (this is also how tensorflow handled this issue), because, in my eyes, the option to provide standard deviation as a parameter to a distribution, implies that the returned distribution has the given standard deviation.

In the case that keras.backend.truncated_normal is really supposed to have a lower standard deviation than the one provided as argument to the function, the correct Theano function to use, would be rng.normal(shape, mean, stddev, dtype, truncate=True).

In order for the initializers to finally work correctly, I do think it is important to fix keras.initializers.VarianceScaling. Currently, it does not provide distributions with the given standard deviation when using distribution='normal', breaking the entire foundations of most initializers.

See #9963 for this alternative fix

@mrTsjolder mrTsjolder closed this Apr 17, 2018
@mrTsjolder mrTsjolder deleted the patch-1 branch May 7, 2018 20:28
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.

2 participants