You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by gi...@git.apache.org on 2017/10/13 17:56:59 UTC
[GitHub] ZiyueHuang commented on a change in pull request #8259: check_format of ndrray, mainly for csr
ZiyueHuang commented on a change in pull request #8259: check_format of ndrray, mainly for csr
URL: https://github.com/apache/incubator-mxnet/pull/8259#discussion_r144619433
##########
File path: include/mxnet/c_api.h
##########
@@ -405,6 +405,12 @@ MXNET_DLL int MXNDArraySyncCopyFromNDArray(NDArrayHandle handle_dst,
const int i);
/*!
+ * \brief check whether the matrix format is valid
+ * \param full_check if `True`, rigorous check, O(N) operations
+ * Otherwise basic check, O(1) operations
+ */
+MXNET_DLL int MXNDArrayCheckFormat(NDArrayHandle handle, const bool full_check);
Review comment:
Yes. For example,
```
import mxnet as mx
# Create a CSRNDArray with python lists
shape = (3, 4)
data_list = [7, 8, 9]
indices_list = [0, 2, 1]
indptr_list = [0, 2, 5, 3]
a = mx.nd.sparse.csr_matrix(data_list, indptr_list, indices_list, shape)
# Inspect the matrix
print a.asnumpy()
```
It is an invalid csr ndarray and will cause segfault in my machine (pip install mxnet-cu80 --pre).
----------------------------------------------------------------
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