You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by la...@apache.org on 2020/07/29 22:17:54 UTC

[incubator-mxnet] branch v1.x updated: adding error message when attempting to use Large tensor with linalg_syevd (#18807)

This is an automated email from the ASF dual-hosted git repository.

lausen pushed a commit to branch v1.x
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/v1.x by this push:
     new ca6bcf3  adding error message when attempting to use Large tensor with linalg_syevd (#18807)
ca6bcf3 is described below

commit ca6bcf3480f8663b87e55b04d9769c44ec53e727
Author: Rohit Kumar Srivastava <sr...@osu.edu>
AuthorDate: Wed Jul 29 15:16:10 2020 -0700

    adding error message when attempting to use Large tensor with linalg_syevd (#18807)
    
    Co-authored-by: Rohit Kumar Srivastava <sr...@buckeyemail.osu.edu>
---
 src/operator/tensor/la_op.h       |  2 ++
 tests/nightly/test_large_array.py | 13 ++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/operator/tensor/la_op.h b/src/operator/tensor/la_op.h
index e15390e..cd09778 100644
--- a/src/operator/tensor/la_op.h
+++ b/src/operator/tensor/la_op.h
@@ -475,6 +475,8 @@ inline bool LaEigFactShape(const nnvm::NodeAttrs& attrs,
   const mxnet::TShape& in_a = (*in_attrs)[0];
   const mxnet::TShape& out_u = (*out_attrs)[0];
   const mxnet::TShape& out_l = (*out_attrs)[1];
+  CHECK_LE(in_a.Size(), INT_MAX)
+    << "Large tensors are not supported by Linear Algebra operator syevd";
   if ( in_a.ndim() >= 2 ) {
     // Forward shape inference.
     const int ndim(in_a.ndim());
diff --git a/tests/nightly/test_large_array.py b/tests/nightly/test_large_array.py
index 8865eae..d55d4e5 100644
--- a/tests/nightly/test_large_array.py
+++ b/tests/nightly/test_large_array.py
@@ -27,7 +27,8 @@ sys.path.append(os.path.join(curr_path, '../python/unittest/'))
 
 from mxnet.test_utils import rand_ndarray, assert_almost_equal, rand_coord_2d, default_context, check_symbolic_forward, create_2d_tensor, get_identity_mat, get_identity_mat_batch
 from mxnet import gluon, nd
-from common import with_seed, with_post_test_cleanup
+from common import with_seed, with_post_test_cleanup, assertRaises
+from mxnet.base import MXNetError
 from nose.tools import with_setup
 import unittest
 
@@ -1352,6 +1353,16 @@ def test_linalg():
     check_batch_trsm()
 
 
+def test_linalg_errors():
+    def check_syevd_error():
+        A = get_identity_mat(LARGE_SQ_X)
+        for i in range(LARGE_SQ_X):
+            A[i,i] = 1
+        assertRaises(MXNetError, mx.nd.linalg.syevd, A)
+
+    check_syevd_error()
+
+
 def test_basic():
     def check_elementwise():
         a = nd.ones(shape=(LARGE_X, SMALL_Y))