This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
[MXNET-145] Remove the dependences of mx.io and mx.initializer on the numpy's global random number generator #10260
Merged
Conversation
This file contains 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
piiswrong
reviewed
Mar 27, 2018
@@ -530,9 +530,9 @@ def _init_weight(self, _, arr): | |||
nout = arr.shape[0] | |||
nin = np.prod(arr.shape[1:]) | |||
if self.rand_type == "uniform": | |||
tmp = np.random.uniform(-1.0, 1.0, (nout, nin)) | |||
tmp = random.uniform(-1.0, 1.0, shape=(nout, nin)).asnumpy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these asnumpys necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Numpy's SVD is applied to tmp
array, so the conversions are needed. Currently mxnet seems not have SVD. There is a simple workaround to perform SVD using eigen decomposition (so using syevd
), however it is not so efficient.
jinhuang415
pushed a commit
to jinhuang415/incubator-mxnet
that referenced
this pull request
Mar 30, 2018
… numpy's global random number generator (apache#10260) * Remove the dependence of mx.io on the global random number generator of numpy * Remove the dependence of mx.initializer on the global random number generator of numpy
cjolivier01
pushed a commit
to cjolivier01/mxnet
that referenced
this pull request
Mar 30, 2018
…r on the numpy's global random number generator (apache#10260)" This reverts commit fdb5664.
haojin2
pushed a commit
to haojin2/incubator-mxnet
that referenced
this pull request
Apr 2, 2018
… numpy's global random number generator (apache#10260) * Remove the dependence of mx.io on the global random number generator of numpy * Remove the dependence of mx.initializer on the global random number generator of numpy
5 tasks
rahul003
pushed a commit
to rahul003/mxnet
that referenced
this pull request
Jun 4, 2018
… numpy's global random number generator (apache#10260) * Remove the dependence of mx.io on the global random number generator of numpy * Remove the dependence of mx.initializer on the global random number generator of numpy
zheng-da
pushed a commit
to zheng-da/incubator-mxnet
that referenced
this pull request
Jun 28, 2018
… numpy's global random number generator (apache#10260) * Remove the dependence of mx.io on the global random number generator of numpy * Remove the dependence of mx.initializer on the global random number generator of numpy
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
This PR removes the dependences of
mx.io
andmx.initializer
on the numpy's global random number generator. The dependences are not sound as they introduce unnecessary coupling with user's environment and confuse newcomers about seeding.Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Comments
rnn/io
,gluon
's samplers and so on.