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/08/30 17:58:04 UTC
[GitHub] [incubator-mxnet] eric-haibin-lin commented on a change in pull
request #16047: Support range as advanced index for ndarrays
eric-haibin-lin commented on a change in pull request #16047: Support range as advanced index for ndarrays
URL: https://github.com/apache/incubator-mxnet/pull/16047#discussion_r319618759
##########
File path: python/mxnet/ndarray/ndarray.py
##########
@@ -1053,17 +1053,15 @@ def _advanced_index_to_array(idx, ax_len, ctx):
if idx.dtype != idx_dtype:
idx = idx.astype(idx_dtype)
return idx.as_in_context(ctx)
-
elif isinstance(idx, (np.ndarray, list, tuple)):
return array(idx, ctx, idx_dtype)
-
elif isinstance(idx, integer_types):
return array([idx], ctx, idx_dtype)
-
elif isinstance(idx, py_slice):
start, stop, step = idx.indices(ax_len)
return arange(start, stop, step, ctx=ctx, dtype=idx_dtype)
-
+ elif sys.version_info[0] > 2 and isinstance(idx, range):
Review comment:
Shall we also update the doc?
----------------------------------------------------------------
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