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 6381aeeca98681f0be559a6b5df4309b44cea799..8296aa320f59bb2e853fda343f00cdeedc3d2660 100644 --- a/python/paddle/fluid/tests/unittests/test_matrix_power_op.py +++ b/python/paddle/fluid/tests/unittests/test_matrix_power_op.py @@ -317,6 +317,12 @@ class TestMatrixPowerAPIError(unittest.TestCase): 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):