haojin2 commented on a change in pull request #17084: [numpy] add op median
URL: https://github.com/apache/incubator-mxnet/pull/17084#discussion_r359121659
 
 

 ##########
 File path: tests/python/unittest/test_numpy_op.py
 ##########
 @@ -712,6 +712,41 @@ def avg_backward(a, w, avg, axes, init_a_grad=None, 
init_w_grad=None):
             assert_almost_equal(mx_sum_of_weights.asnumpy(), 
np_sum_of_weights, rtol=rtol, atol=atol)
         assert_almost_equal(mx_out.asnumpy(), np_out.astype(dtype), rtol=rtol, 
atol=atol)
 
+def test_np_median():
+    class TestMedian(HybridBlock):
+        def __init__(self, axis=None, keepdims=False):
+            super(TestMedian, self).__init__()
+            self._axis = axis
+            self._keepdims = keepdims
+
+        def hybrid_forward(self, F, a):
+            return F.np.median(a, axis=self._axis, keepdims=self._keepdims)
+
+    flags = [True, False]
+    dtypes = ['float16', 'float32', 'float64']
+    qtypes = ['float32', 'float64']
+    tensor_shapes = [
+        ((2, 3), None),
+        ((2, 3, 4, 5), 3),
+        ((2, 3, 4), (0, 2)),
+        ((2, 3, 4), 1)
+    ]
+    for hybridize, keepdims, (a_shape, axis), dtype in \
 
 Review comment:
   one more blank line above

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to