Merged
Conversation
qingqing01
reviewed
Dec 4, 2017
| """ | ||
|
|
||
| def __init__(self, uniform=True, fan_in=None, seed=0): | ||
| def __init__(self, uniform=True, fan_in=None, seed=set_random_seed(0)): |
Contributor
There was a problem hiding this comment.
Could the user set the seed globally instead of setting the seed at each parameter initializer?
Contributor
Author
There was a problem hiding this comment.
I didn't get an elegant way to implement it. Use a global seed seems ugly,
typhoonzero
reviewed
Dec 5, 2017
| import numpy as np | ||
|
|
||
| __all__ = ['Constant', 'Uniform', 'Normal', 'Xavier'] | ||
| __all__ = ['Constant', 'Uniform', 'Normal', 'Xavier', 'set_random_seed'] |
Contributor
There was a problem hiding this comment.
set_random_seed seems a private function, if it is, do not expose it.
typhoonzero
reviewed
Dec 5, 2017
| assert isinstance(var, framework.Variable) | ||
| assert isinstance(block, framework.Block) | ||
| # Initialization Ops should be prepended and not appended | ||
| if block.program.random_seed != 0 and self._seed == 0: |
Contributor
There was a problem hiding this comment.
If we don't consider case that user need to overwrite program default rand seed with 0, just use if self._seed == 0 is fine, maybe?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #6220