From a392b127c4ca5ab5407816f03c9c2f897b5f6936 Mon Sep 17 00:00:00 2001 From: Joe Evans Date: Tue, 21 Jul 2020 14:21:55 -0700 Subject: [PATCH] Add large tensor unit tests for linalg_potrf and linalg_potri. --- tests/nightly/test_large_array.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/nightly/test_large_array.py b/tests/nightly/test_large_array.py index d50f3ff7e539..4925e54c247b 100644 --- a/tests/nightly/test_large_array.py +++ b/tests/nightly/test_large_array.py @@ -37,6 +37,7 @@ LARGE_X = 100000000 SMALL_X = 100 SMALL_Y = 50 +LARGE_SQ_X = 80000 LARGE_SIZE = LARGE_X * SMALL_Y LARGE_TENSOR_SHAPE = 2**32 RNN_LARGE_TENSOR = 2**28 @@ -1167,6 +1168,32 @@ def check_correctness(mxnet_op, numpy_op, atol=1e-3): check_gather() check_binary_broadcast() +def test_linalg(): + def check_potrf(): + # creating an identity matrix input + A = nd.zeros((LARGE_SQ_X, LARGE_SQ_X)) + for i in range(LARGE_SQ_X): + A[i,i] = 1 + + out = nd.linalg.potrf(A) + # output should be an identity matrix + for i in range(LARGE_SQ_X): + assert out[i,i] == 1 + + def check_potri(): + # creating an identity matrix input + A = nd.zeros((LARGE_SQ_X, LARGE_SQ_X)) + for i in range(LARGE_SQ_X): + A[i,i] = 1 + + out = nd.linalg.potri(A) + # output should be an identity matrix + for i in range(LARGE_SQ_X): + assert out[i,i] == 1 + + check_potrf() + check_potri() + def test_basic(): def check_elementwise():