nickguletskii commented on a change in pull request #14638: [MXNET-1382] Add 
the index_array operator
URL: https://github.com/apache/incubator-mxnet/pull/14638#discussion_r283554609
 
 

 ##########
 File path: tests/python/unittest/test_operator.py
 ##########
 @@ -8054,6 +8054,68 @@ def test_image_normalize():
     # check backward using finite difference
     check_numeric_gradient(img_norm_sym, [data_in_4d], atol=0.001)
 
+@with_seed()
+def test_index_array_default():
+    for shape in [(10,), (7, 5, 29), (5, 7, 11, 13, 17, 19)]:
+        data  = mx.symbol.Variable("data")
+        index_array = mx.sym.contrib.index_array(data)
+
+        input_array = np.ones(shape)
+        mgrid = np.mgrid[tuple(slice(0, x) for x in shape)]
+        expected = np.stack(mgrid, axis=-1)
+
+        check_symbolic_forward(index_array, [input_array], [expected])
+        check_symbolic_backward(index_array, [input_array], 
[np.ones(expected.shape)], [np.zeros_like(input_array)])
+
+@with_seed()
+def test_index_array_default_zero_dim():
+    with mx.np_compat(active=True):
 
 Review comment:
   Thanks, I've updated the subtests to use `@mx.use_np_compat` in 
139567b9e5d1cf909b69355e0aeb162e38eb5ed6.

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