-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
SobolEngine should use random seed by default when scrambling #24881
Comments
@Balandat sounds very reasonable. I actually hadn't thought of this at the time. I would be wary of the tests, because they assume the above behavior. |
yeah I could have thought of that myself as well at the time when reviewing the PR... |
Balandat
added a commit
to Balandat/pytorch
that referenced
this issue
Aug 20, 2019
Closing since the fix has been merged. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, the following behavior is deterministic:
To achieve random scrambling, you need to do
This behavior is inconsistent with that of other random number generation in torch. E.g.,
torch.rand(d)
will generate different numbers in each call, unless the seed is fixed manually.I believe the
SobolEngine
behavior should be consistent with this, otherwise this is a pretty big gotcha. This behavior is because if no seed is given toSobolEngine
, it usestorch.Generator()
to generate the random numbers for scrambling. My suggestion is to use a random seed ifseed=None
in theSobolEngine
constructor.If this sounds reasonable, I'll put up a two line PR.
The text was updated successfully, but these errors were encountered: