szha commented on a change in pull request #18852:
URL: https://github.com/apache/incubator-mxnet/pull/18852#discussion_r468945939
##########
File path: tests/python/unittest/test_numpy_op.py
##########
@@ -4777,6 +4777,47 @@ def _test_gamma_exception(shape, scale):
assertRaises(ValueError, _test_gamma_exception, shape, scale)
+@with_seed()
+@use_np
+def test_gamma_grad():
+ class TestRandomGamma(HybridBlock):
+ def __init__(self, size, beta):
+ super(TestRandomGamma, self).__init__()
+ self._size = size
+ self._beta = beta
+
+ def hybrid_forward(self, F, a):
+ return F.np.random.gamma(a, self._beta, size=self._size)
+
+ shapes = [(1,), (2, 2), (4, 2, 2)]
+ alpha = [2.0, 5.0, 10.0]
+ beta = [0.5, 1.0, 1.5]
+ for (shape, a, b) in itertools.product(shapes, alpha, beta):
+ for hybridize in [True, False]:
Review comment:
use pytest.mark.parametrize for simplicity and parallelism.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]