-
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
Potential error in documentation of keras.random.uniform. #20569
Comments
It's a bit subtle because the behavior isn't quite the same when executing eagerly and when compiling.
So if you want to generate different values at each execution even when compiling, you really need |
Ok, I can suggest a reformulation, but I'd first like to confirm that we agree on what is happening. Follwing your explanation, I looked this up in the code and I found here the implementation of the uniform function for the tensorflow backend
with
If I read the global_seed_generator implementation correctly, it works the same for all backends, in compiled or eager mode, besides for the If you are fine with this conclusion, then I would suggest changing
I could create a pull request if this would be fine for you. I would then also propose to change the documentation of the SeedGenerator class saying that when seed is set to |
You're right, the very first implementation of Your description is accurate. |
In the documentation of keras.ranom.uniform I find
For me this implies that
keras.random.unform(shape=(), seed=None) == keras.random.unform(shape=(), seed=None)
Which however is not the case.
See the colab here to see that calling keras.random.unform(shape=(), seed=None) produces a sequence of random numbers.
On the other hand
seed=1
really creates the same number for all calls in keras but not in Tensorflow, which is what I was expecting from the documentation.Am I misunderstanding this or is the documentation about
seed=None
wrong?The text was updated successfully, but these errors were encountered: