From c2674930672db3c3d84f761b4bcf414e2e93b152 Mon Sep 17 00:00:00 2001 From: ChaiBapchya Date: Wed, 7 Aug 2019 10:37:13 -0700 Subject: [PATCH 1/8] test rdiv --- tests/nightly/test_large_array.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/nightly/test_large_array.py b/tests/nightly/test_large_array.py index 0df481a01987..a7c9356ce9ae 100644 --- a/tests/nightly/test_large_array.py +++ b/tests/nightly/test_large_array.py @@ -351,6 +351,12 @@ def test_topk(): l = nd.topk(b, k=1, axis=-1, dtype=np.int64, ret_typ="value") assert l.sum() == np.sum(np.arange(0, SMALL_Y)) +def test_rdiv(): + a = create_2d_tensor(rows=2, columns=3) + b = create_2d_tensor(rows=2, columns=3) + res = b/a + out = a.__rdiv__(b) + assert_almost_equal(res.asnumpy(),out.asnumpy()) if __name__ == '__main__': import nose From f36d641c4d82fb3447a82e4911aeebccd9021e2c Mon Sep 17 00:00:00 2001 From: ChaiBapchya Date: Wed, 7 Aug 2019 14:07:44 -0700 Subject: [PATCH 2/8] floating_point exception handle --- tests/nightly/test_large_array.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/nightly/test_large_array.py b/tests/nightly/test_large_array.py index a7c9356ce9ae..26db02e6a2dc 100644 --- a/tests/nightly/test_large_array.py +++ b/tests/nightly/test_large_array.py @@ -292,7 +292,7 @@ def test_unravel_index(): assert (indices_2d.asnumpy() == np.array(original_2d_indices)).all() -def create_2d_tensor(rows, columns): +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=np.int64) @@ -352,8 +352,8 @@ def test_topk(): assert l.sum() == np.sum(np.arange(0, SMALL_Y)) def test_rdiv(): - a = create_2d_tensor(rows=2, columns=3) - b = create_2d_tensor(rows=2, columns=3) + a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) res = b/a out = a.__rdiv__(b) assert_almost_equal(res.asnumpy(),out.asnumpy()) From c070b8d41e241a3693e07dd2c195edf9dd0dfa3f Mon Sep 17 00:00:00 2001 From: ChaiBapchya Date: Wed, 7 Aug 2019 15:48:36 -0700 Subject: [PATCH 3/8] add 10 other ops --- tests/nightly/test_large_array.py | 89 +++++++++++++++++++++++++++++-- 1 file changed, 85 insertions(+), 4 deletions(-) diff --git a/tests/nightly/test_large_array.py b/tests/nightly/test_large_array.py index 26db02e6a2dc..f1f7b37db58a 100644 --- a/tests/nightly/test_large_array.py +++ b/tests/nightly/test_large_array.py @@ -295,7 +295,7 @@ def test_unravel_index(): 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=np.int64) + return nd.array(b, dtype=dtype) def test_transpose(): @@ -351,12 +351,93 @@ def test_topk(): l = nd.topk(b, k=1, axis=-1, dtype=np.int64, ret_typ="value") assert l.sum() == np.sum(np.arange(0, SMALL_Y)) + +def test_add(): + a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + mx_res = a.__add__(b) + np_res = b.asnumpy()+a.asnumpy() + assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + + +def test_sub(): + a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + mx_res = a.__sub__(b) + np_res = a.asnumpy()-b.asnumpy() + assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + + +def test_rsub(): + a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + mx_res = a.__rsub__(b) + np_res = b.asnumpy()-a.asnumpy() + assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + + +def test_neg(): + a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + mx_res = a.__neg__() + np_res = np.negative(a.asnumpy()) + assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + + +def test_mul(): + a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + mx_res = a.__mul__(b) + np_res = np.multiply(a.asnumpy(),b.asnumpy()) + assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + + +def test_div(): + a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + mx_res = a.__div__(b) + np_res = np.divide(a.asnumpy(),b.asnumpy()) + assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + + def test_rdiv(): a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - res = b/a - out = a.__rdiv__(b) - assert_almost_equal(res.asnumpy(),out.asnumpy()) + mx_res = a.__rdiv__(b) + np_res = b.asnumpy()/a.asnumpy() + assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + + +def test_mod(): + a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + mx_res = a.__mod__(b) + np_res = np.mod(a.asnumpy(),b.asnumpy()) + assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + + +def test_rmod(): + a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + mx_res = a.__rmod__(b) + np_res = np.mod(b.asnumpy(),a.asnumpy()) + assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + + +def test_imod(): + a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + mx_res = a.__imod__(b) + np_res = a.asnumpy().__imod__(b.asnumpy()) + assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + + +def test_pow(): + a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + mx_res = a.__pow__(b) + np_res = np.power(a.asnumpy(),b.asnumpy()) + assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + if __name__ == '__main__': import nose From 7f1c2b50238f6e8488356aece5e517ebc0b54e52 Mon Sep 17 00:00:00 2001 From: ChaiBapchya Date: Wed, 7 Aug 2019 16:35:19 -0700 Subject: [PATCH 4/8] added rpow and made numpy consistent --- tests/nightly/test_large_array.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/tests/nightly/test_large_array.py b/tests/nightly/test_large_array.py index f1f7b37db58a..8fda9d32bf21 100644 --- a/tests/nightly/test_large_array.py +++ b/tests/nightly/test_large_array.py @@ -356,7 +356,7 @@ def test_add(): a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) mx_res = a.__add__(b) - np_res = b.asnumpy()+a.asnumpy() + np_res = a.asnumpy().__add__(b.asnumpy()) assert mx_res.asnumpy()[-1][0]==np_res[-1][0] @@ -364,7 +364,7 @@ def test_sub(): a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) mx_res = a.__sub__(b) - np_res = a.asnumpy()-b.asnumpy() + np_res = a.asnumpy().__sub__(b.asnumpy()) assert mx_res.asnumpy()[-1][0]==np_res[-1][0] @@ -372,14 +372,14 @@ def test_rsub(): a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) mx_res = a.__rsub__(b) - np_res = b.asnumpy()-a.asnumpy() + np_res = a.asnumpy().__rsub__(b.asnumpy()) assert mx_res.asnumpy()[-1][0]==np_res[-1][0] def test_neg(): a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) mx_res = a.__neg__() - np_res = np.negative(a.asnumpy()) + np_res = a.asnumpy().__neg__() assert mx_res.asnumpy()[-1][0]==np_res[-1][0] @@ -387,7 +387,7 @@ def test_mul(): a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) mx_res = a.__mul__(b) - np_res = np.multiply(a.asnumpy(),b.asnumpy()) + np_res = a.asnumpy().__mul__(b.asnumpy()) assert mx_res.asnumpy()[-1][0]==np_res[-1][0] @@ -395,7 +395,7 @@ def test_div(): a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) mx_res = a.__div__(b) - np_res = np.divide(a.asnumpy(),b.asnumpy()) + np_res = a.asnumpy().__truediv__(b.asnumpy()) assert mx_res.asnumpy()[-1][0]==np_res[-1][0] @@ -403,7 +403,7 @@ def test_rdiv(): a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) mx_res = a.__rdiv__(b) - np_res = b.asnumpy()/a.asnumpy() + np_res = a.asnumpy().__rtruediv__(b.asnumpy()) assert mx_res.asnumpy()[-1][0]==np_res[-1][0] @@ -411,7 +411,7 @@ def test_mod(): a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) mx_res = a.__mod__(b) - np_res = np.mod(a.asnumpy(),b.asnumpy()) + np_res = a.asnumpy().__mod__(b.asnumpy()) assert mx_res.asnumpy()[-1][0]==np_res[-1][0] @@ -419,7 +419,7 @@ def test_rmod(): a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) mx_res = a.__rmod__(b) - np_res = np.mod(b.asnumpy(),a.asnumpy()) + np_res = a.asnumpy().__rmod__(b.asnumpy()) assert mx_res.asnumpy()[-1][0]==np_res[-1][0] @@ -435,9 +435,15 @@ def test_pow(): a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) mx_res = a.__pow__(b) - np_res = np.power(a.asnumpy(),b.asnumpy()) + np_res = a.asnumpy().__pow__(b.asnumpy()) assert mx_res.asnumpy()[-1][0]==np_res[-1][0] +def test_rpow(): + a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) + mx_res = a.__rpow__(b) + np_res = a.asnumpy().__rpow__(b.asnumpy()) + assert mx_res.asnumpy()[-1][0]==np_res[-1][0] if __name__ == '__main__': import nose From a151181478a8e9cdce4ffe19b2fcadd29a6f237d Mon Sep 17 00:00:00 2001 From: ChaiBapchya Date: Wed, 7 Aug 2019 21:29:24 -0700 Subject: [PATCH 5/8] attempt to solve memory issue --- tests/nightly/test_large_array.py | 130 ++++++++++++++++-------------- 1 file changed, 71 insertions(+), 59 deletions(-) diff --git a/tests/nightly/test_large_array.py b/tests/nightly/test_large_array.py index 8fda9d32bf21..50f364c0407a 100644 --- a/tests/nightly/test_large_array.py +++ b/tests/nightly/test_large_array.py @@ -353,97 +353,109 @@ def test_topk(): def test_add(): - a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - mx_res = a.__add__(b) - np_res = a.asnumpy().__add__(b.asnumpy()) - assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + a = nd.ones(shape=(LARGE_X, SMALL_Y)) + b = nd.ones(shape=(LARGE_X, SMALL_Y)) + c = b + c = c.__add__(a) + assert c[0][-1] == 2 + assert c.shape == a.shape def test_sub(): - a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - mx_res = a.__sub__(b) - np_res = a.asnumpy().__sub__(b.asnumpy()) - assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + a = 3*nd.ones(shape=(LARGE_X, SMALL_Y)) + b = nd.ones(shape=(LARGE_X, SMALL_Y)) + c = b + c = c.__sub__(a) + assert c[0][-1] == -2 + assert c.shape == a.shape def test_rsub(): - a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - mx_res = a.__rsub__(b) - np_res = a.asnumpy().__rsub__(b.asnumpy()) - assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + a = 3*nd.ones(shape=(LARGE_X, SMALL_Y)) + b = nd.ones(shape=(LARGE_X, SMALL_Y)) + c = b + c = c.__rsub__(a) + assert c[0][-1] == 2 + assert c.shape == a.shape def test_neg(): - a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - mx_res = a.__neg__() - np_res = a.asnumpy().__neg__() - assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + a = nd.ones(shape=(LARGE_X, SMALL_Y)) + c = a + c = c.__neg__() + assert c[0][-1] == -1 + assert c.shape == a.shape def test_mul(): - a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - mx_res = a.__mul__(b) - np_res = a.asnumpy().__mul__(b.asnumpy()) - assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + a = 2*nd.ones(shape=(LARGE_X, SMALL_Y)) + b = 3*nd.ones(shape=(LARGE_X, SMALL_Y)) + c = b + c = c.__mul__(a) + assert c[0][-1] == 6 + assert c.shape == a.shape def test_div(): - a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - mx_res = a.__div__(b) - np_res = a.asnumpy().__truediv__(b.asnumpy()) - assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + a = 2*nd.ones(shape=(LARGE_X, SMALL_Y)) + b = 3*nd.ones(shape=(LARGE_X, SMALL_Y)) + c = b + c = c.__div__(a) + assert c[0][-1] == 3/2 + assert c.shape == a.shape def test_rdiv(): - a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - mx_res = a.__rdiv__(b) - np_res = a.asnumpy().__rtruediv__(b.asnumpy()) - assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + a = 2*nd.ones(shape=(LARGE_X, SMALL_Y)) + b = 3*nd.ones(shape=(LARGE_X, SMALL_Y)) + c = b + c = c.__rdiv__(a) + assert c[0][-1] == 2/3 + assert c.shape == a.shape def test_mod(): - a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - mx_res = a.__mod__(b) - np_res = a.asnumpy().__mod__(b.asnumpy()) - assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + a = 2*nd.ones(shape=(LARGE_X, SMALL_Y)) + b = 3*nd.ones(shape=(LARGE_X, SMALL_Y)) + c = b + c = c.__mod__(a) + assert c[0][-1] == 1 + assert c.shape == a.shape def test_rmod(): - a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - mx_res = a.__rmod__(b) - np_res = a.asnumpy().__rmod__(b.asnumpy()) - assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + a = 2*nd.ones(shape=(LARGE_X, SMALL_Y)) + b = 3*nd.ones(shape=(LARGE_X, SMALL_Y)) + c = b + c = c.__rmod__(a) + assert c[0][-1] == 2 + assert c.shape == a.shape def test_imod(): - a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - mx_res = a.__imod__(b) - np_res = a.asnumpy().__imod__(b.asnumpy()) - assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + a = 2*nd.ones(shape=(LARGE_X, SMALL_Y)) + b = 3*nd.ones(shape=(LARGE_X, SMALL_Y)) + c = b + c = c.__imod__(a) + assert c[0][-1] == 1 + assert c.shape == a.shape def test_pow(): - a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - mx_res = a.__pow__(b) - np_res = a.asnumpy().__pow__(b.asnumpy()) - assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + a = 2*nd.ones(shape=(LARGE_X, SMALL_Y)) + b = 3*nd.ones(shape=(LARGE_X, SMALL_Y)) + c = b + c = c.__pow__(a) + assert c[0][-1] == 9 + assert c.shape == a.shape def test_rpow(): - a = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - b = create_2d_tensor(rows=LARGE_X, columns=SMALL_Y, dtype=np.float64) - mx_res = a.__rpow__(b) - np_res = a.asnumpy().__rpow__(b.asnumpy()) - assert mx_res.asnumpy()[-1][0]==np_res[-1][0] + a = 2*nd.ones(shape=(LARGE_X, SMALL_Y)) + b = 3*nd.ones(shape=(LARGE_X, SMALL_Y)) + c = b + c = c.__rpow__(a) + assert c[0][-1] == 8 + assert c.shape == a.shape if __name__ == '__main__': import nose From c6121763af2291d0994ee71978693d888b8bc859 Mon Sep 17 00:00:00 2001 From: ChaiBapchya Date: Thu, 8 Aug 2019 18:12:05 -0700 Subject: [PATCH 6/8] linting fix --- tests/nightly/test_large_array.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/nightly/test_large_array.py b/tests/nightly/test_large_array.py index 50f364c0407a..a3fa65026831 100644 --- a/tests/nightly/test_large_array.py +++ b/tests/nightly/test_large_array.py @@ -356,7 +356,7 @@ def test_add(): a = nd.ones(shape=(LARGE_X, SMALL_Y)) b = nd.ones(shape=(LARGE_X, SMALL_Y)) c = b - c = c.__add__(a) + c = c.__add__(a) assert c[0][-1] == 2 assert c.shape == a.shape @@ -365,7 +365,7 @@ def test_sub(): a = 3*nd.ones(shape=(LARGE_X, SMALL_Y)) b = nd.ones(shape=(LARGE_X, SMALL_Y)) c = b - c = c.__sub__(a) + c = c.__sub__(a) assert c[0][-1] == -2 assert c.shape == a.shape @@ -380,7 +380,7 @@ def test_rsub(): def test_neg(): - a = nd.ones(shape=(LARGE_X, SMALL_Y)) + a = nd.ones(shape=(LARGE_X, SMALL_Y)) c = a c = c.__neg__() assert c[0][-1] == -1 @@ -391,7 +391,7 @@ def test_mul(): a = 2*nd.ones(shape=(LARGE_X, SMALL_Y)) b = 3*nd.ones(shape=(LARGE_X, SMALL_Y)) c = b - c = c.__mul__(a) + c = c.__mul__(a) assert c[0][-1] == 6 assert c.shape == a.shape @@ -400,7 +400,7 @@ def test_div(): a = 2*nd.ones(shape=(LARGE_X, SMALL_Y)) b = 3*nd.ones(shape=(LARGE_X, SMALL_Y)) c = b - c = c.__div__(a) + c = c.__div__(a) assert c[0][-1] == 3/2 assert c.shape == a.shape @@ -409,7 +409,7 @@ def test_rdiv(): a = 2*nd.ones(shape=(LARGE_X, SMALL_Y)) b = 3*nd.ones(shape=(LARGE_X, SMALL_Y)) c = b - c = c.__rdiv__(a) + c = c.__rdiv__(a) assert c[0][-1] == 2/3 assert c.shape == a.shape @@ -418,7 +418,7 @@ def test_mod(): a = 2*nd.ones(shape=(LARGE_X, SMALL_Y)) b = 3*nd.ones(shape=(LARGE_X, SMALL_Y)) c = b - c = c.__mod__(a) + c = c.__mod__(a) assert c[0][-1] == 1 assert c.shape == a.shape @@ -427,7 +427,7 @@ def test_rmod(): a = 2*nd.ones(shape=(LARGE_X, SMALL_Y)) b = 3*nd.ones(shape=(LARGE_X, SMALL_Y)) c = b - c = c.__rmod__(a) + c = c.__rmod__(a) assert c[0][-1] == 2 assert c.shape == a.shape @@ -436,7 +436,7 @@ def test_imod(): a = 2*nd.ones(shape=(LARGE_X, SMALL_Y)) b = 3*nd.ones(shape=(LARGE_X, SMALL_Y)) c = b - c = c.__imod__(a) + c = c.__imod__(a) assert c[0][-1] == 1 assert c.shape == a.shape @@ -445,15 +445,16 @@ def test_pow(): a = 2*nd.ones(shape=(LARGE_X, SMALL_Y)) b = 3*nd.ones(shape=(LARGE_X, SMALL_Y)) c = b - c = c.__pow__(a) + c = c.__pow__(a) assert c[0][-1] == 9 assert c.shape == a.shape + def test_rpow(): a = 2*nd.ones(shape=(LARGE_X, SMALL_Y)) b = 3*nd.ones(shape=(LARGE_X, SMALL_Y)) c = b - c = c.__rpow__(a) + c = c.__rpow__(a) assert c[0][-1] == 8 assert c.shape == a.shape From 09aa9245d3a0870569c0bd9c0c65e882ca22e80a Mon Sep 17 00:00:00 2001 From: ChaiBapchya Date: Thu, 8 Aug 2019 22:05:23 -0700 Subject: [PATCH 7/8] Trigger notification From d26801e1ac028caf9103031a4d049ca944de4ac6 Mon Sep 17 00:00:00 2001 From: ChaiBapchya Date: Fri, 9 Aug 2019 15:05:42 -0700 Subject: [PATCH 8/8] lint --- tests/nightly/test_large_array.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/nightly/test_large_array.py b/tests/nightly/test_large_array.py index a3fa65026831..232b9cf6962c 100644 --- a/tests/nightly/test_large_array.py +++ b/tests/nightly/test_large_array.py @@ -458,6 +458,7 @@ def test_rpow(): assert c[0][-1] == 8 assert c.shape == a.shape + if __name__ == '__main__': import nose nose.runmodule()