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 2020/01/29 07:20:49 UTC
[GitHub] [incubator-mxnet] sxjscience commented on a change in pull request
#17452: Fix indexing with zero dim array
sxjscience commented on a change in pull request #17452: Fix indexing with zero dim array
URL: https://github.com/apache/incubator-mxnet/pull/17452#discussion_r372222530
##########
File path: python/mxnet/ndarray/ndarray.py
##########
@@ -3055,6 +3060,8 @@ def get_indexing_dispatch_code(key):
return _NDARRAY_EMPTY_TUPLE_INDEXING
if getattr(idx, 'dtype', None) == np.bool_:
num_bools += 1
+ if getattr(idx, 'ndim', None) == 0: # zero-dim array as index treated as integer
Review comment:
Should we support indexing with float32 0-dim array?
```python
import numpy as np
a = np.ones((2, 2))
b = np.array(1.0)
a[b]
```
Currently, numpy will raise an error.
----------------------------------------------------------------
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