Skip to content

Commit

Permalink
creating ndarray directly using mxnet ndarray primitives to reduce me…
Browse files Browse the repository at this point in the history
…mory footprint of tests for topk, sort and argsort (apache#15900)
  • Loading branch information
access2rohit authored and Ubuntu committed Aug 20, 2019
1 parent 63c686b commit 8aa0320
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/nightly/test_large_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8aa0320

Please sign in to comment.