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/09/27 04:05:46 UTC
[GitHub] szha commented on a change in pull request #7911: More sparse related docs
szha commented on a change in pull request #7911: More sparse related docs
URL: https://github.com/apache/incubator-mxnet/pull/7911#discussion_r141240533
##########
File path: python/mxnet/test_utils.py
##########
@@ -134,22 +134,32 @@ def _get_uniform_dataset_csr(num_rows, num_cols, density=0.1, dtype=None,
"""Returns CSRNDArray with uniform distribution
This generates a csr matrix with totalnnz unique randomly chosen numbers
from num_rows*num_cols and arranges them in the 2d array in the
- following way: row_index = (random_number_generated / num_rows)
+ following way:
+ row_index = (random_number_generated / num_rows)
col_index = random_number_generated - row_index * num_cols
"""
_validate_csr_generation_inputs(num_rows, num_cols, density,
distribution="uniform")
- from scipy import sparse as spsp
- csr = spsp.rand(num_rows, num_cols, density, dtype=dtype, format="csr")
- if data_init is not None:
- csr.data.fill(data_init)
- if shuffle_csr_indices is True:
- shuffle_csr_column_indices(csr)
- result = mx.nd.sparse.csr_matrix(csr.data, csr.indptr, csr.indices,
- (num_rows, num_cols), dtype=dtype)
+ try:
+ from scipy import sparse as spsp
Review comment:
numpy doesn't seem to depend on scipy, so I guess there could be a chance for the user not to have scipy in the environment. Would you like to include that in the list of dependencies in setup.py?
----------------------------------------------------------------
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