Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Remove previous Weibull test
Browse files Browse the repository at this point in the history
  • Loading branch information
D-Roberts committed Feb 5, 2020
1 parent a3f4ffa commit 8006628
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 37 deletions.
6 changes: 3 additions & 3 deletions python/mxnet/ndarray/numpy/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions python/mxnet/symbol/numpy/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
32 changes: 1 addition & 31 deletions tests/python/unittest/test_numpy_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 8006628

Please sign in to comment.