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 2018/11/17 00:07:09 UTC

[GitHub] anirudh2290 closed pull request #13276: enabling test_dropout after fixing flaky issue

anirudh2290 closed pull request #13276: enabling test_dropout after fixing flaky issue
URL: https://github.com/apache/incubator-mxnet/pull/13276
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/operator/nn/dropout-inl.h b/src/operator/nn/dropout-inl.h
index b7c40fbdf52..9668c227b30 100644
--- a/src/operator/nn/dropout-inl.h
+++ b/src/operator/nn/dropout-inl.h
@@ -82,7 +82,8 @@ class DropoutOp {
   static void BernoulliGenerate(common::random::RandGenerator<cpu, DType> gen,
                                 int n, double p, int* r) {
     typename RandGenerator<xpu, DType>::Impl genImpl(&gen, 1);
-    const int seed = 17 + genImpl.rand() % 4096;  // NOLINT(runtime/threadsafe_fn)
+    const int seed = 17 + abs(genImpl.rand() % 4096);
+    CHECK_GE(seed, 0);
     const int nthr = engine::OpenMP::Get()->GetRecommendedOMPThreadCount();
 #pragma omp parallel num_threads(nthr)
     {
@@ -92,7 +93,7 @@ class DropoutOp {
       const int my_amount = std::min(my_offset + avg_amount, n) - my_offset;
       if (my_amount > 0) {
         VSLStreamStatePtr stream;
-        vslNewStream(&stream, VSL_BRNG_MCG31, seed + my_offset);
+        vslNewStream(&stream, VSL_BRNG_MCG31, seed);
         vslSkipAheadStream(stream, my_offset);
         viRngBernoulli(VSL_RNG_METHOD_BERNOULLI_ICDF, stream, my_amount, r + my_offset, p);
         vslDeleteStream(&stream);
diff --git a/tests/python/unittest/test_operator.py b/tests/python/unittest/test_operator.py
index 283a2820a4c..1bf9ca0237a 100644
--- a/tests/python/unittest/test_operator.py
+++ b/tests/python/unittest/test_operator.py
@@ -5808,7 +5808,6 @@ def test_stack():
 
 
 @with_seed()
-@unittest.skip("Flaky test, tracked at https://github.com/apache/incubator-mxnet/issues/12314")
 def test_dropout():
     def zero_count(array, ratio):
         zeros = 0


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services