haojin2 commented on a change in pull request #15819: [Numpy]flip
URL: https://github.com/apache/incubator-mxnet/pull/15819#discussion_r314198515
 
 

 ##########
 File path: tests/python/unittest/test_numpy_op.py
 ##########
 @@ -829,6 +829,71 @@ def get_indices(axis_size):
                     assert_almost_equal(mx_out.asnumpy(), np_out, rtol=1e-3, 
atol=1e-5)
 
 
+@with_seed()
+@use_np
+def test_np_flip():
+    class TestFlip(HybridBlock):
+        def __init__(self, axis):
+            super(TestFlip, self).__init__()
+            # Necessary initialization
+            self.axis = axis
+
+        def hybrid_forward(self, F, x):
+            return F.np.flip(x, self.axis)
+
+    shapes1 = [(1, 2, 3), (1, 0), (3, 0, 2), (), (1,)]
+    shapes2 = [(2, 2, 3, 3), (1, 1, 2, 4)]
+    types = ['int32', 'int64', 'float16', 'float32', 'double']
+    for hybridize in [True, False]:
+        for oneType in types:
+            if oneType is 'float16':
+                rtol=1e-2
+                atol=1e-2
+            else:
+                rtol=1e-3
+                atol=1e-5
+            for shape in shapes1:
+                for axis in [None]:
 
 Review comment:
   If you just have 1 thing to test then do not have a for-loop, just do 
   ```Python
   for shape in shapes1:
       axis = None
       # your test code
   ```

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to