haojin2 commented on a change in pull request #11024: concat of CSR NDArrays on
first dimension
URL: https://github.com/apache/incubator-mxnet/pull/11024#discussion_r192551931
##########
File path: tests/python/unittest/test_sparse_ndarray.py
##########
@@ -155,6 +155,22 @@ def check_slice_nd_csr_fallback(shape):
check_slice_nd_csr_fallback(shape)
+@with_seed()
+def test_sparse_nd_concat():
+ def check_concat(arrays):
+ ret = np.concatenate([arr.asnumpy() for arr in arrays], axis=0)
+ same(mx.nd.concat(*arrays, dim=0).asnumpy(), ret)
+ nds = []
+ zero_nds = []
+ ncols = rnd.randint(2, 10)
+ for i in range(3):
+ shape = (rnd.randint(2, 10), ncols)
+ A, _ = rand_sparse_ndarray(shape, 'csr')
+ nds.append(A)
+ zero_nds.append(mx.nd.zeros(shape).tostype('csr'))
+ check_concat(nds)
+ check_concat(zero_nds)
+
Review comment:
nit: one more blank line here
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services