From 8aa0320874158e0756660f659079af51ebdbf7d7 Mon Sep 17 00:00:00 2001 From: Rohit Kumar Srivastava Date: Mon, 19 Aug 2019 23:08:40 -0700 Subject: [PATCH] creating ndarray directly using mxnet ndarray primitives to reduce memory footprint of tests for topk, sort and argsort (#15900) --- tests/nightly/test_large_array.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/nightly/test_large_array.py b/tests/nightly/test_large_array.py index 02c867720609..c9d48b77a283 100644 --- a/tests/nightly/test_large_array.py +++ b/tests/nightly/test_large_array.py @@ -31,6 +31,12 @@ LARGE_SIZE = LARGE_X * SMALL_Y +def create_2d_tensor(rows, columns, dtype=np.int64): + a = nd.arange(0, rows, dtype=dtype).reshape(rows, 1) + b = nd.broadcast_to(a, shape=(a.shape[0], columns)) + return nd.array(b, dtype=dtype) + + def test_gluon_embedding(): m = gluon.nn.Embedding(SMALL_Y, MEDIUM_X) m.initialize() @@ -383,12 +389,6 @@ def test_unravel_index(): assert (indices_2d.asnumpy() == np.array(original_2d_indices)).all() -def create_2d_tensor(rows, columns, dtype=np.int64): - a = np.arange(0, rows).reshape(rows, 1) - b = np.broadcast_to(a, shape=(a.shape[0], columns)) - return nd.array(b, dtype=dtype) - - def test_transpose(): b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y) t = b.T