From 3021370307d8825c6a7bbba57262f92b45a6efae Mon Sep 17 00:00:00 2001 From: HydrogenSulfate <490868991@qq.com> Date: Sun, 26 Dec 2021 20:35:20 +0800 Subject: [PATCH] change error to IndexError --- .../paddle/fluid/tests/unittests/test_cross_entropy_loss.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/test_cross_entropy_loss.py b/python/paddle/fluid/tests/unittests/test_cross_entropy_loss.py index 28e286be638..d8f541bf48c 100644 --- a/python/paddle/fluid/tests/unittests/test_cross_entropy_loss.py +++ b/python/paddle/fluid/tests/unittests/test_cross_entropy_loss.py @@ -1463,7 +1463,7 @@ class TestCrossEntropyFAPIError(unittest.TestCase): weight=weight_data, ignore_index=-100) - self.assertRaises(IndexError, test_WeightLength_NotEqual) + self.assertRaises(ValueError, test_WeightLength_NotEqual) def test_LabelValue_ExceedMax(): input_data = paddle.rand(shape=[20, 100]) @@ -1491,7 +1491,7 @@ class TestCrossEntropyFAPIError(unittest.TestCase): weight=weight_data, ignore_index=-100) - self.assertRaises(ValueError, test_LabelValue_ExceedMin) + self.assertRaises(IndexError, test_LabelValue_ExceedMin) def static_test_WeightLength_NotEqual(): input_np = np.random.random([2, 4]).astype('float32') -- GitLab