You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2020/08/27 20:11:43 UTC

[GitHub] [incubator-mxnet] szha commented on issue #7410: mxnet random seed should not be fixed by default

szha commented on issue #7410:
URL: https://github.com/apache/incubator-mxnet/issues/7410#issuecomment-682166637


   > I saw a different result on CPU and GPU by using the same seed value. Is this an expected behavior or am I missing something here ??
   > 
   > ## script
   > ```python
   > import mxnet as mx
   > mx.random.seed(99)
   > t_cpu = mx.nd.random.uniform(shape=(4), ctx=mx.cpu())
   > print("CPU: ", t_cpu)
   > mx.random.seed(99)
   > t_gpu = mx.nd.random.uniform(shape=(4), ctx=mx.gpu(0))
   > print("GPU: ", t_gpu)
   > ```
   > 
   > ## Output
   > ```shell
   > CPU:
   > [0.9509902  0.71019113 0.7611274  0.08560332]
   > <NDArray 4 @cpu(0)>
   > GPU:
   > [0.29560053 0.07938761 0.29997164 0.4891801 ]
   > <NDArray 4 @gpu(0)>
   > ```
   
   This is expected. Setting the seed on a device only guarantees reproducible results on the same device, and does not guarantee the same result on different devices.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org