diff --git a/python/mxnet/ndarray/numpy/random.py b/python/mxnet/ndarray/numpy/random.py index a35039beff7c..bf7aba8a9a08 100644 --- a/python/mxnet/ndarray/numpy/random.py +++ b/python/mxnet/ndarray/numpy/random.py @@ -462,7 +462,7 @@ def exponential(scale, size): return _npi.exponential(scale=scale, size=size) -def weibull(a, size): +def weibull(a, size=None): r"""Draw samples from a 1-parameter Weibull distribution with given parameter a, via inversion. @@ -515,7 +515,7 @@ def weibull(a, size): return _npi.weibull(a=a, size=size) -def pareto(a, size): +def pareto(a, size=None): r"""Draw samples from a Pareto II or Lomax distribution with specified shape a. Parameters @@ -558,7 +558,7 @@ def pareto(a, size): return _npi.pareto(a=a, size=size) -def power(a, size): +def power(a, size=None): r"""Draw samples in [0, 1] from a power distribution with given parameter a. Parameters diff --git a/python/mxnet/symbol/numpy/random.py b/python/mxnet/symbol/numpy/random.py index 72d55f58719f..78c2b76db0aa 100644 --- a/python/mxnet/symbol/numpy/random.py +++ b/python/mxnet/symbol/numpy/random.py @@ -469,7 +469,7 @@ def exponential(scale=1.0, size=None): return _npi.exponential(scale=scale, size=size) -def weibull(a, size): +def weibull(a, size=None): r"""Draw samples from a 1-parameter Weibull distribution with given parameter a via inversion. @@ -524,7 +524,7 @@ def weibull(a, size): return _npi.weibull(a=a, size=size) -def pareto(a, size): +def pareto(a, size=None): r"""Draw samples from a Pareto II or Lomax distribution with specified shape a. Parameters @@ -567,7 +567,7 @@ def pareto(a, size): return _npi.pareto(a=a, size=size) -def power(a, size): +def power(a, size=None): r"""Draw samples in [0, 1] from a power distribution with given parameter a. Parameters diff --git a/tests/python/unittest/test_numpy_op.py b/tests/python/unittest/test_numpy_op.py index 8ff71e201186..726a6179c516 100644 --- a/tests/python/unittest/test_numpy_op.py +++ b/tests/python/unittest/test_numpy_op.py @@ -3598,36 +3598,6 @@ def _test_exponential_exception(scale): assertRaises(ValueError, _test_exponential_exception, -1) -@with_seed() -@use_np -def test_np_random_weibull(): - class TestRandomWeibull(HybridBlock): - def __init__(self, shape): - super(TestRandomWeibull, self).__init__() - self._shape = shape - - def hybrid_forward(self, F, a): - return F.np.random.weibull(a, self._shape) - - shapes = [(), (1,), (2, 3), (4, 0, 5), 6, (7, 8), None] - for hybridize in [False, True]: - for shape in shapes: - test_weibull = TestRandomWeibull(shape) - if hybridize: - test_weibull.hybridize() - np_out = _np.random.weibull(1, size = shape) - mx_out = test_weibull(np.array([1])) - - for shape in shapes: - mx_out = np.random.weibull(np.array([1]), shape) - np_out = _np.random.weibull(np.array([1]).asnumpy(), shape) - assert_almost_equal(mx_out.asnumpy().shape, np_out.shape) - - def _test_weibull_exception(a): - output = np.random.weibull(a=a).asnumpy() - assertRaises(ValueError, _test_weibull_exception, -1) - - @with_seed() @use_np def test_np_random_a(): @@ -3687,7 +3657,7 @@ def hybrid_forward(self, F, a): expected_shape = a.shape assert mx_out.shape == expected_shape - # test illegal parameter values + # test illegal parameter values (as numpy produces) def _test_exception(a): output = op(a=a).asnumpy() for op in op_names: