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/02/04 13:42:12 UTC
[GitHub] djl11 commented on issue #11424: Add support for numpy.nonzero() to
ndarray
djl11 commented on issue #11424: Add support for numpy.nonzero() to ndarray
URL: https://github.com/apache/incubator-mxnet/issues/11424#issuecomment-460253701
You can achieve this affect by creating a CSRNDArray, as explained [here](https://github.com/apache/incubator-mxnet/blob/master/docs/tutorials/sparse/csr.md).
If you have a 2D array which contains zeros, you can convert this to a csr array like so:
`some_array = some_array.tostype('csr')`
you can then extract the indices of the non-zero entries like so:
`some_array.indices`
This is not to say that a non-zero function directly in mx.nd wouldn't be useful, but this is a good current solution for anybody who is searching.
----------------------------------------------------------------
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