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

Commit 392e834

Browse files
committed
Fix unit test
1 parent 7aa68ac commit 392e834

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

tests/python/unittest/test_operator.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3480,24 +3480,23 @@ def test_reverse():
34803480
@with_seed()
34813481
def test_tile():
34823482
def test_normal_case():
3483-
ndim_max = 3 # max number of dims of the ndarray
3484-
size_max = 10 # max number of elements in each dim
3485-
length_max = 3 # max length of reps
3486-
rep_max = 10 # max number of tiling in each dim
3487-
for ndim in range(ndim_max, ndim_max+1):
3488-
shape = ()
3489-
for i in range(0, ndim):
3490-
shape += (np.random.randint(1, size_max+1), )
3483+
ndim_min = 1
3484+
ndim_max = 5 # max number of dims of the ndarray
3485+
size_max = 10 # max number of elements in each dim
3486+
length_max = 3 # max length of reps
3487+
rep_max = 10 # max number of tiling in each dim
3488+
for ndim in range(ndim_min, ndim_max+1):
3489+
shape = []
3490+
for i in range(1, ndim+1):
3491+
shape.append(np.random.randint(1, size_max+1))
3492+
shape = tuple(shape)
34913493
a = np.random.randint(0, 100, shape)
3492-
a = np.asarray(a, dtype=np.int32)
3493-
if ndim == 0:
3494-
a = np.array([])
3495-
b = mx.nd.array(a, ctx=default_context(), dtype=a.dtype)
3494+
b = mx.nd.array(a, dtype=a.dtype)
34963495

3497-
reps_len = np.random.randint(0, length_max+1)
3496+
reps_len = np.random.randint(1, length_max+1)
34983497
reps_tuple = ()
34993498
for i in range(1, reps_len):
3500-
reps_tuple += (np.random.randint(0, rep_max), )
3499+
reps_tuple += (np.random.randint(1, rep_max), )
35013500
reps_array = np.asarray(reps_tuple)
35023501

35033502
a_tiled = np.tile(a, reps_array)

0 commit comments

Comments
 (0)