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

mrg uniform include the lower bound, should exclude it. #6096

Closed
nouiz opened this issue Jul 1, 2017 · 3 comments
Closed

mrg uniform include the lower bound, should exclude it. #6096

nouiz opened this issue Jul 1, 2017 · 3 comments

Comments

@nouiz
Copy link
Member

nouiz commented Jul 1, 2017

see: [lasagne-users] float16 issues

Mostly the uniform generator include the lower bound 0, while it should exclude it.

This cause the normal generator to do log(0), so it return an inf.

@lamblin
Copy link
Member

lamblin commented Jul 1, 2017

numpy.uniform() includes the lower bound, so I believe that was on purpose.
The higher bound, on the other end, is excluded, so using log(1 - rng.uniform()) should work.

@lamblin
Copy link
Member

lamblin commented Jul 1, 2017

So, @nouiz was right, the comments in the original MRG uniform say we are supposed to exclude 0, even though we never took particular care of that.
Using 1 - uniform() would be bad for backward compatibility, so I'm not against slightly shifting the normalization for float16.

@lamblin
Copy link
Member

lamblin commented Jul 1, 2017

OK, so the issue does not actually happen because sample 1 got mapped to float16(0) during the normalization, but because the int sample gets masked with & 0x7fff, so a non-zero sample (because it was guaranteed not to be 0) got mapped to int 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants