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 e9116ae1b44346cc3ea13daa58513cf24a14120a..01710d579a6fbb0d7b15588767b8865bf95b4609 100644 --- a/python/paddle/fluid/tests/unittests/test_cross_entropy_loss.py +++ b/python/paddle/fluid/tests/unittests/test_cross_entropy_loss.py @@ -1375,7 +1375,10 @@ class TestCrossEntropyFAPIError(unittest.TestCase): label_data[0] = 255 weight_data = paddle.rand([100]) paddle.nn.functional.cross_entropy( - input=input_data, label=label_data, weight=weight_data) + input=input_data, + label=label_data, + weight=weight_data, + ignore_index=0) self.assertRaises(ValueError, test_LabelValue) @@ -1386,7 +1389,10 @@ class TestCrossEntropyFAPIError(unittest.TestCase): label_data[0] = -1 weight_data = paddle.rand([100]) paddle.nn.functional.cross_entropy( - input=input_data, label=label_data, weight=weight_data) + input=input_data, + label=label_data, + weight=weight_data, + ignore_index=0) self.assertRaises(ValueError, test_LabelValueNeg)