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 2019/10/18 08:19:47 UTC

[GitHub] [incubator-mxnet] wkcn commented on a change in pull request #16532: fix dropout gpu seed

wkcn commented on a change in pull request #16532: fix dropout gpu seed
URL: https://github.com/apache/incubator-mxnet/pull/16532#discussion_r336370708
 
 

 ##########
 File path: tests/python/gpu/test_operator_gpu.py
 ##########
 @@ -2507,6 +2507,18 @@ def test_arange_like_dtype():
         for v in out:
             assert v.dtype == t
 
+# do not remove seed
+@with_seed(1234)
+def test_dropout_with_seed():
+    a = mx.nd.ones((10, 10), ctx=mx.gpu())
+    dropout = mx.gluon.nn.Dropout(0.5)
+    with mx.autograd.record():
 
 Review comment:
   I have a suggestion.
   Firstly, replace `@with_seed(1234)` with `@with_seed()`.
   Then add the following code,
   ```python
   info = np.iinfo(np.int64)
   seed = np.random.randint(info.min, info.max)
   ```
   Finally, we add `mx.random.seed(seed)` before each `dropout(a)`.

----------------------------------------------------------------
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


With regards,
Apache Git Services