diff --git a/python/paddle/fluid/tests/unittests/test_matrix_power_op.py b/python/paddle/fluid/tests/unittests/test_matrix_power_op.py index 7f26a7170191f..d12c65a4bd6c8 100644 --- a/python/paddle/fluid/tests/unittests/test_matrix_power_op.py +++ b/python/paddle/fluid/tests/unittests/test_matrix_power_op.py @@ -316,6 +316,12 @@ def test_errors(self): input = fluid.data(name="input_4", shape=[1, 1, 0, 0], dtype="float32") self.assertRaises(ValueError, paddle.linalg.matrix_power, input, 2) + # The size of input should not be 0 + input = fluid.data(name="input_5", shape=[0, 0], dtype="float32") + self.assertRaises( + ValueError, paddle.linalg.matrix_power, input, -956301312 + ) + class TestMatrixPowerSingularAPI(unittest.TestCase): def setUp(self):