aksnzhy commented on a change in pull request #13392: add csr sample op URL: https://github.com/apache/incubator-mxnet/pull/13392#discussion_r237330840
########## File path: tests/python/unittest/test_dgl_graph.py ########## @@ -26,6 +26,41 @@ from mxnet.test_utils import * import unittest +def test_uniform_sample(): + shape = (5, 5) + data_np = np.array([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], dtype=np.int64) + indices_np = np.array([1,2,3,4,0,2,3,4,0,1,3,4,0,1,2,4,0,1,2,3], dtype=np.int64) + indptr_np = np.array([0,4,8,12,16,20], dtype=np.int64) + a = mx.nd.sparse.csr_matrix((data_np, indices_np, indptr_np), shape=shape) + seed = mx.nd.array([0,1,2,3,4], dtype=np.int64) + out = mx.nd.contrib.csr_neighbor_uniform_sample(a, seed, num_args=2, num_hops=1, num_neighbor=2, max_num_vertices=5) + sample_id = out[0] + count = 0 + for data in sample_id: + if data != -1: + count = count + 1 Review comment: Add new test ---------------------------------------------------------------- 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
