This is an automated email from the ASF dual-hosted git repository. anirudh2290 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push: new 70f4e2c enabling test_dropout after fixing flaky issue (#13276) 70f4e2c is described below commit 70f4e2cf46a48677a85d76986753670ba771a1a8 Author: Manu Seth <22492939+mset...@users.noreply.github.com> AuthorDate: Fri Nov 16 16:07:07 2018 -0800 enabling test_dropout after fixing flaky issue (#13276) * enabling test_dropout after fixing flaky issue * adding a check for positive seed --- src/operator/nn/dropout-inl.h | 5 +++-- tests/python/unittest/test_operator.py | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/operator/nn/dropout-inl.h b/src/operator/nn/dropout-inl.h index b7c40fb..9668c22 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 283a282..1bf9ca0 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