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 2017/12/18 20:28:22 UTC

[GitHub] marfago commented on issue #9117: argsort produces an ndarray which cannot be used for indexing an ndarray

marfago commented on issue #9117: argsort produces an ndarray which cannot be used for indexing an ndarray
URL: https://github.com/apache/incubator-mxnet/issues/9117#issuecomment-352548271
 
 
   @aidan-plenert-macdonald Try the code I posted above, it won't work. You can use neither an numpy array or a NDArray as index of NDArray.
   
    In particular
   ```X = nd.random_normal(shape=(10, 10))```
   ```X[nd.argsort(X,axis=1)] = 0``` -> **ValueError: NDArray does not support slicing with key**
   ```X.asnumpy()[nd.argsort(X,axis=1).asnumpy()] = 0``` -> **IndexError: arrays used as indices must be of integer (or boolean) type**
   ```X.asnumpy()[nd.argsort(X,axis=1).astype(int).asnumpy()] = 0``` -> **Ok**
   
   
   BTW,
   ```
   >>> mx.__version__
   '0.12.1'
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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