From f1b53aba8f5fffa92d2bcaf3c5e6b6d0e5eb7e40 Mon Sep 17 00:00:00 2001 From: Sheng Zha Date: Sat, 25 Jul 2020 20:29:32 -0700 Subject: [PATCH] fix flaky --- tests/python/unittest/test_base.py | 2 ++ tests/python/unittest/test_gluon_probability_v1.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/python/unittest/test_base.py b/tests/python/unittest/test_base.py index 74d3f17a645e..2175d7b9a062 100644 --- a/tests/python/unittest/test_base.py +++ b/tests/python/unittest/test_base.py @@ -25,7 +25,9 @@ import logging import os.path as op import platform +import pytest +@pytest.mark.garbage_expected def test_environment(): name1 = 'MXNET_TEST_ENV_VAR_1' name2 = 'MXNET_TEST_ENV_VAR_2' diff --git a/tests/python/unittest/test_gluon_probability_v1.py b/tests/python/unittest/test_gluon_probability_v1.py index c0dd5d54ab9f..e0e44445183b 100644 --- a/tests/python/unittest/test_gluon_probability_v1.py +++ b/tests/python/unittest/test_gluon_probability_v1.py @@ -540,7 +540,7 @@ def hybrid_forward(self, F, n, params, *args): # Test log_prob for shape, hybridize, use_logit in itertools.product(shapes, [True, False], [True, False]): n = np.random.randint(1, 10, size=shape).astype('float32') - prob = np.random.uniform(low=0.1, size=shape) + prob = np.random.uniform(low=0.1, size=shape).astype('float32') sample = np.random.randint(0, 10, size=shape).astype('float32') param = prob if use_logit: @@ -559,7 +559,7 @@ def hybrid_forward(self, F, n, params, *args): for func in ['mean', 'variance']: for use_logit in [True, False]: n = np.random.randint(1, 10, size=shape).astype('float32') - prob = np.random.uniform(low=0.1, size=shape) + prob = np.random.uniform(low=0.1, size=shape).astype('float32') net = TestNegativeBinomial(func, use_logit) param = prob if use_logit: @@ -2015,7 +2015,7 @@ def hybrid_forward(self, F, logit, *args): def test_gluon_kl_v1(): def _test_zero_kl(p, shape): """Check if KL(p || p) = 0 - + Parameters ---------- p : Distribution