Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
qrgqwergq
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohit Kumar Srivastava committed May 31, 2019
1 parent 24cf092 commit 07fb649
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion python/mxnet/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def rand_shape_nd(num_dim, dim=10):
return tuple(rnd.randint(1, dim+1, size=num_dim))


def rand_2d_coord(x_low, x_high, y_low, y_high):
def rand_coord_2d(x_low, x_high, y_low, y_high):
x = np.random.randint(x_low, x_high, dtype=np.int64)
y = np.random.randint(y_low, y_high, dtype=np.int64)
return x, y
Expand Down
14 changes: 7 additions & 7 deletions tests/nightly/test_large_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import numpy as np
import mxnet as mx
from mxnet.test_utils import rand_ndarray, assert_almost_equal, rand_2d_coord
from mxnet.test_utils import rand_ndarray, assert_almost_equal, rand_coord_2d
from mxnet import gluon, nd
from tests.python.unittest.common import with_seed

Expand Down Expand Up @@ -272,9 +272,9 @@ def test_diag():

@with_seed()
def test_ravel_multi_index():
x1, y1 = rand_2d_coord((LARGE_X - 100), LARGE_X, 10, SMALL_Y)
x2, y2 = rand_2d_coord((LARGE_X - 200), LARGE_X, 9, SMALL_Y)
x3, y3 = rand_2d_coord((LARGE_X - 300), LARGE_X, 8, SMALL_Y)
x1, y1 = rand_coord_2d((LARGE_X - 100), LARGE_X, 10, SMALL_Y)
x2, y2 = rand_coord_2d((LARGE_X - 200), LARGE_X, 9, SMALL_Y)
x3, y3 = rand_coord_2d((LARGE_X - 300), LARGE_X, 8, SMALL_Y)
indices_2d = [[x1, x2, x3], [y1, y2, y3]]
idx = mx.nd.ravel_multi_index(mx.nd.array(indices_2d, dtype=np.int64), shape=(LARGE_X, SMALL_Y))
idx_numpy = np.ravel_multi_index(indices_2d, (LARGE_X, SMALL_Y))
Expand All @@ -283,9 +283,9 @@ def test_ravel_multi_index():

@with_seed()
def test_unravel_index():
x1, y1 = rand_2d_coord((LARGE_X - 100), LARGE_X, 10, SMALL_Y)
x2, y2 = rand_2d_coord((LARGE_X - 200), LARGE_X, 9, SMALL_Y)
x3, y3 = rand_2d_coord((LARGE_X - 300), LARGE_X, 8, SMALL_Y)
x1, y1 = rand_coord_2d((LARGE_X - 100), LARGE_X, 10, SMALL_Y)
x2, y2 = rand_coord_2d((LARGE_X - 200), LARGE_X, 9, SMALL_Y)
x3, y3 = rand_coord_2d((LARGE_X - 300), LARGE_X, 8, SMALL_Y)
original_2d_indices = [[x1, x2, x3], [y1, y2, y3]]
idx_numpy = np.ravel_multi_index(original_2d_indices, (LARGE_X, SMALL_Y))
indices_2d = mx.nd.unravel_index(mx.nd.array(idx_numpy, dtype=np.int64), shape=(LARGE_X, SMALL_Y))
Expand Down

0 comments on commit 07fb649

Please sign in to comment.