From 53e94c60cf90baf52bb7c107fe20b7ebb6be7796 Mon Sep 17 00:00:00 2001 From: Haibin Lin Date: Wed, 16 Aug 2017 21:50:26 -0700 Subject: [PATCH] fix default val for distribution (#172) --- python/mxnet/test_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/mxnet/test_utils.py b/python/mxnet/test_utils.py index f7e7edb2ada6..46f14b52b03b 100644 --- a/python/mxnet/test_utils.py +++ b/python/mxnet/test_utils.py @@ -181,7 +181,7 @@ def _get_powerlaw_dataset_csr(num_rows, num_cols, density=0.1, dtype=None): return mx.nd.array(output_arr).tostype("csr") -def rand_sparse_ndarray(shape, stype, density=None, distribution="uniform", dtype=None): +def rand_sparse_ndarray(shape, stype, density=None, distribution=None, dtype=None): """Generate a random sparse ndarray. Returns the ndarray, value(np) and indices(np) Parameters ---------- @@ -216,6 +216,7 @@ def rand_sparse_ndarray(shape, stype, density=None, distribution="uniform", dtyp """ density = rnd.rand() if density is None else density dtype = default_dtype() if dtype is None else dtype + distribution = "uniform" if distribution is None else distribution if stype == 'row_sparse': assert (distribution == "uniform"), \ "Distribution %s not supported for row_sparse" % (distribution)