DickJC123 opened a new issue #9816: Dropout may mask values even when ratio=0.0
URL: https://github.com/apache/incubator-mxnet/issues/9816
 
 
   One reasonable expectation is that a dropout layout would pass no values 
when the dropout ratio=1.0 and would pass all values with the dropout 
ratio=0.0.  However, the current dropout test fails a ratio=0.0 test under some 
seeds because some values are masked.  Adapting from the current 
nn/dropout-inl.h, we have essentially:
   ```
   prob_keep = 1.0 - ratio;
   rand_pick = random_uniform_pick(0.0,1.0);
   mask_out = (rand_pick < prob_keep ? 1.0 : 0.0) * (1.0/prob_keep);
   dropout_out = input_data * mask_out;
   ```
   It must be that rand_pick above can include the 1.0 endpoint, so mask_out 
becomes 0.0.  A quick fix might change the '<' to '<=', but then some values 
might be passed when the dropout ratio = 1.0 if the rand_pick can be 0.0.  The 
possible differences between rng properties between cpu and gpu's should be 
considered: CUDNN rngs return values in (0.0,1.0] while most others are in the 
range [0.0,1.0).
   
   This can be reproduced in any of the commits of the ci_test_randomness3 PR 
if you edit the line above 'def test_dropout()' in test_operator.py to be only 
"@with_seed()", then execute: (output shown)
   ``
   MXNET_TEST_SEED=990952066 nosetests --verbose 
tests/python/unittest/test_operator.py:test_dropout
   [INFO] Setting module np/mx/python random seeds, use 
MXNET_MODULE_SEED=881809903 to reproduce.
   [WARNING] *** test-level seed set: all "@with_seed()" tests run 
deterministically ***
   test_operator.test_dropout ... [INFO] Setting test np/mx/python random 
seeds, use MXNET_TEST_SEED=990952066 to reproduce.
   FAIL
   ======================================================================
   FAIL: test_operator.test_dropout
   ----------------------------------------------------------------------
   Traceback (most recent call last):
     File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
       self.test(*self.arg)
     File "/home/dcarter/mxnet_dev/dgx/mxnet/tests/python/unittest/common.py", 
line 152, in test_new
       orig_test(*args, **kwargs)
     File 
"/home/dcarter/mxnet_dev/dgx/mxnet/tests/python/unittest/test_operator.py", 
line 4596, in test_dropout
       check_dropout_ratio(0.0, shape)
     File 
"/home/dcarter/mxnet_dev/dgx/mxnet/tests/python/unittest/test_operator.py", 
line 4561, in check_dropout_ratio
       assert exe.outputs[0].asnumpy().min() == min_value
   AssertionError: 
   -------------------- >> begin captured logging << --------------------
   common: INFO: Setting module np/mx/python random seeds, use 
MXNET_MODULE_SEED=881809903 to reproduce.
   common: WARNING: *** test-level seed set: all "@with_seed()" tests run 
deterministically ***
   common: INFO: Setting test np/mx/python random seeds, use 
MXNET_TEST_SEED=990952066 to reproduce.
   --------------------- >> end captured logging << ---------------------
   ```
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to