kohr-h commented on a change in pull request #13143: [MXNET-1206] Support 
NDArray indexing with None and Ellipsis
URL: https://github.com/apache/incubator-mxnet/pull/13143#discussion_r292627078
 
 

 ##########
 File path: tests/python/unittest/test_ndarray.py
 ##########
 @@ -1208,22 +1266,24 @@ def test_getitem(np_array, index, is_scalar=False):
         if isinstance(index, mx.nd.NDArray):
             np_index = index.asnumpy()
         if isinstance(index, tuple):
-            np_index = []
-            for idx in index:
-                if isinstance(idx, mx.nd.NDArray):
-                    np_index.append(idx.asnumpy())
-                else:
-                    np_index.append(idx)
-            np_index = tuple(np_index)
+            np_index = tuple(
+                idx.asnumpy() if isinstance(idx, mx.nd.NDArray) else idx
+                for idx in index
+            )
 
         np_indexed_array = np_array[np_index]
         mx_array = mx.nd.array(np_array, dtype=np_array.dtype)
-        mx_indexed_array = mx_array[index]
+        try:
+            mx_indexed_array = mx_array[index]
+        except Exception as e:
 
 Review comment:
   OTOH, there's more code like this in the test suite, like `assert <expr>, 
"informative error text"`. It adds information to the plain failure report, so 
I'd prefer to leave it in.

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