Skip to content

Commit

Permalink
Fix test randint (apache#14990)
Browse files Browse the repository at this point in the history
* Add dtype for large int dtypes

* Fix bug
  • Loading branch information
anirudh2290 authored and haohuw committed Jun 23, 2019
1 parent e608313 commit c8ace2e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/nightly/test_large_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ def test_ndarray_random_randint():
# check if randint can generate value greater than 2**32 (large)
low_large_value = 2**32
high_large_value = 2**34
a = nd.random.randint(low_large_value,high_large_value)
a = nd.random.randint(low_large_value,high_large_value, dtype=np.int64)
low = mx.nd.array([low_large_value], dtype='int64')
high = mx.nd.array([high_large_value], dtype='int64')
assert a.__gt__(low) & a.__lt__(high)
assert a.__gt__(low) and a.__lt__(high)


def test_ndarray_empty():
Expand All @@ -87,20 +87,20 @@ def test_elementwise():


def test_reduce():
a = nd.ones(shape=(LARGE_X, SMALL_Y))
a = nd.ones(shape=(LARGE_X, SMALL_Y))
assert nd.sum(a).asnumpy() == a.shape[0] * a.shape[1]


def test_dot():
a = nd.ones(shape=(LARGE_X, SMALL_Y))
a = nd.ones(shape=(LARGE_X, SMALL_Y))
b = nd.ones(shape=(SMALL_Y, SMALL_Y))
res = nd.dot(a, b)
assert np.sum(res[-1].asnumpy() == SMALL_Y) == b.shape[1]


def test_FullyConnected():
a = nd.ones(shape=(LARGE_X, SMALL_Y))
b = nd.ones(shape=(SMALL_Y, SMALL_Y))
a = nd.ones(shape=(LARGE_X, SMALL_Y))
b = nd.ones(shape=(SMALL_Y, SMALL_Y))
res = nd.FullyConnected(a, b, num_hidden=b.shape[1], no_bias=True)
assert np.sum(res[-1].asnumpy() == SMALL_Y) == b.shape[1]

Expand Down Expand Up @@ -186,7 +186,7 @@ def test_pick():
b = mx.nd.ones(shape=(256*35,))
res = mx.nd.pick(a,b)
assert res.shape == b.shape

def test_depthtospace():
def numpy_depth_to_space(x, blocksize):
b, c, h, w = x.shape[0], x.shape[1], x.shape[2], x.shape[3]
Expand Down

0 comments on commit c8ace2e

Please sign in to comment.