From 739cff2dc1740da5b130e5991ecce22971461745 Mon Sep 17 00:00:00 2001 From: HydrogenSulfate <490868991@qq.com> Date: Mon, 27 Dec 2021 11:40:07 +0800 Subject: [PATCH] change to IndexError --- .../paddle/fluid/tests/unittests/test_cross_entropy_loss.py | 5 +++-- 1 file changed, 3 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 adf11e815fa..12dc47785d2 100644 --- a/python/paddle/fluid/tests/unittests/test_cross_entropy_loss.py +++ b/python/paddle/fluid/tests/unittests/test_cross_entropy_loss.py @@ -13,6 +13,7 @@ # limitations under the License. from __future__ import print_function +from ast import Index import paddle import paddle.fluid as fluid @@ -1477,7 +1478,7 @@ class TestCrossEntropyFAPIError(unittest.TestCase): weight=weight_data, ignore_index=-100) - self.assertRaises(ValueError, test_LabelValue_ExceedMax) + self.assertRaises(IndexError, test_LabelValue_ExceedMax) def test_LabelValue_ExceedMin(): input_data = paddle.rand(shape=[20, 100]) @@ -1491,7 +1492,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