You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/05/19 06:45:09 UTC

[GitHub] [incubator-mxnet] reminisce commented on a change in pull request #13143: [MXNET-1206] Support NDArray indexing with None and Ellipsis

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

 ##########
 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:
   Is an exception expected to happen with the given test data? If not, can we remove it?

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


With regards,
Apache Git Services