You are viewing a plain text version of this content. The canonical link for it is here.
Posted to devnull@infra.apache.org by "sandeep-krishnamurthy (GitHub)" <gi...@apache.org> on 2018/08/21 18:33:21 UTC
[GitHub] [incubator-mxnet] sandeep-krishnamurthy commented on issue
#9410: Training with the same parameters and seed gets significantly
different results
Please ignore my previous comment. Thanks to Sina, for letting me know that seeding should happen just before the weight initialization to have deterministic behavior.
I verified that the initial state of all parameters across both the runs are same.
Sample code:
## Run 1
```
mx.random.seed(42)
w = gluon.parameter.Parameter('weight', shape = (3,3))
w.initialize(init=mx.initializer.Xavier(magnitude=2.0), ctx=mx.gpu(0))
```
```
[[ 0.53740764 0.4047128 0.09500974]
[ 0.10734546 0.21412051 0.81077886]
[ 0.39387202 0.0689261 -0.65652549]]
<NDArray 3x3 @cpu(0)>
```
## Run 2
```
mx.random.seed(42)
w.initialize(init=mx.initializer.Xavier(magnitude=2.0), ctx=mx.gpu(0), force_reinit=True)
w.data()
```
```
[[ 0.53740764 0.4047128 0.09500974]
[ 0.10734546 0.21412051 0.81077886]
[ 0.39387202 0.0689261 -0.65652549]]
<NDArray 3x3 @gpu(0)>
```
[ Full content available at: https://github.com/apache/incubator-mxnet/issues/9410 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org