You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by zh...@apache.org on 2020/07/30 18:31:32 UTC
[incubator-mxnet] branch master updated: Fix dirichlet flaky tests
(#18817)
This is an automated email from the ASF dual-hosted git repository.
zhasheng 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 608afef Fix dirichlet flaky tests (#18817)
608afef is described below
commit 608afef6fb69129730f4c18d0e42f5a8ac2078a7
Author: Xi Wang <xi...@gmail.com>
AuthorDate: Fri Jul 31 02:30:25 2020 +0800
Fix dirichlet flaky tests (#18817)
* make parameter smoother
* minor changes
---
tests/python/unittest/test_gluon_probability_v1.py | 12 ++++++------
tests/python/unittest/test_gluon_probability_v2.py | 10 +++++-----
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/tests/python/unittest/test_gluon_probability_v1.py b/tests/python/unittest/test_gluon_probability_v1.py
index c0dd5d5..0fece99 100644
--- a/tests/python/unittest/test_gluon_probability_v1.py
+++ b/tests/python/unittest/test_gluon_probability_v1.py
@@ -341,7 +341,7 @@ def test_gluon_cauchy_v1():
for shape, hybridize in itertools.product(shapes, [True, False]):
loc = np.random.uniform(-1, 1, shape)
scale = np.random.uniform(0.5, 1.5, shape)
- samples = np.random.uniform(size=shape, high=1.0-1e-4)
+ samples = np.random.uniform(size=shape, low=1e-4, high=1.0-1e-4)
net = TestCauchy("icdf")
if hybridize:
net.hybridize()
@@ -837,7 +837,7 @@ def test_gluon_dirichlet_v1():
dirichlet = mgp.Dirichlet(alpha, F, validate_args=True)
return _distribution_method_invoker(dirichlet, self._func, *args)
- event_shapes = [2, 5, 10]
+ event_shapes = [2, 4, 6]
batch_shapes = [None, (2, 3)]
# Test sampling
@@ -845,7 +845,7 @@ def test_gluon_dirichlet_v1():
for hybridize in [True, False]:
desired_shape = (
batch_shape if batch_shape is not None else ()) + (event_shape,)
- alpha = np.random.uniform(size=desired_shape)
+ alpha = np.random.uniform(1.0, 5.0, size=desired_shape)
net = TestDirichlet("sample")
if hybridize:
net.hybridize()
@@ -862,9 +862,9 @@ def test_gluon_dirichlet_v1():
for hybridize in [True, False]:
desired_shape = (
batch_shape if batch_shape is not None else ()) + (event_shape,)
- alpha = np.random.uniform(size=desired_shape)
+ alpha = np.random.uniform(1.0, 5.0, desired_shape)
np_samples = _np.random.dirichlet(
- [1 / event_shape] * event_shape, size=batch_shape)
+ [10.0 / event_shape] * event_shape, size=batch_shape)
net = TestDirichlet("log_prob")
if hybridize:
net.hybridize()
@@ -879,7 +879,7 @@ def test_gluon_dirichlet_v1():
for func in ['mean', 'variance', 'entropy']:
desired_shape = (
batch_shape if batch_shape is not None else ()) + (event_shape,)
- alpha = np.random.uniform(size=desired_shape)
+ alpha = np.random.uniform(1.0, 5.0, desired_shape)
net = TestDirichlet(func)
if hybridize:
net.hybridize()
diff --git a/tests/python/unittest/test_gluon_probability_v2.py b/tests/python/unittest/test_gluon_probability_v2.py
index ecce63c..dc8ac14 100644
--- a/tests/python/unittest/test_gluon_probability_v2.py
+++ b/tests/python/unittest/test_gluon_probability_v2.py
@@ -837,7 +837,7 @@ def test_gluon_dirichlet():
dirichlet = mgp.Dirichlet(alpha, validate_args=True)
return _distribution_method_invoker(dirichlet, self._func, *args)
- event_shapes = [2, 5, 10]
+ event_shapes = [2, 4, 6]
batch_shapes = [None, (2, 3)]
# Test sampling
@@ -845,7 +845,7 @@ def test_gluon_dirichlet():
for hybridize in [True, False]:
desired_shape = (
batch_shape if batch_shape is not None else ()) + (event_shape,)
- alpha = np.random.uniform(size=desired_shape)
+ alpha = np.random.uniform(1.0, 5.0, size=desired_shape)
net = TestDirichlet("sample")
if hybridize:
net.hybridize()
@@ -862,9 +862,9 @@ def test_gluon_dirichlet():
for hybridize in [True, False]:
desired_shape = (
batch_shape if batch_shape is not None else ()) + (event_shape,)
- alpha = np.random.uniform(size=desired_shape)
+ alpha = np.random.uniform(1.0, 5.0, size=desired_shape)
np_samples = _np.random.dirichlet(
- [1 / event_shape] * event_shape, size=batch_shape)
+ [10.0 / event_shape] * event_shape, size=batch_shape)
net = TestDirichlet("log_prob")
if hybridize:
net.hybridize()
@@ -879,7 +879,7 @@ def test_gluon_dirichlet():
for func in ['mean', 'variance', 'entropy']:
desired_shape = (
batch_shape if batch_shape is not None else ()) + (event_shape,)
- alpha = np.random.uniform(size=desired_shape)
+ alpha = np.random.uniform(1.0, 5.0, desired_shape)
net = TestDirichlet(func)
if hybridize:
net.hybridize()