提交 94952111 编写于 作者: R root 提交者: chajchaj

add weigth data to unit test

上级 e1ea895f
...@@ -1373,8 +1373,9 @@ class TestCrossEntropyFAPIError(unittest.TestCase): ...@@ -1373,8 +1373,9 @@ class TestCrossEntropyFAPIError(unittest.TestCase):
label_data = paddle.randint( label_data = paddle.randint(
0, 100, shape=[20, 1], dtype="int64") 0, 100, shape=[20, 1], dtype="int64")
label_data[0] = 255 label_data[0] = 255
weight_data = paddle.rand([100])
paddle.nn.functional.cross_entropy( paddle.nn.functional.cross_entropy(
input=input_data, label=label_data) input=input_data, label=label_data, weight=weight_data)
self.assertRaises(ValueError, test_LabelValue) self.assertRaises(ValueError, test_LabelValue)
...@@ -1383,8 +1384,9 @@ class TestCrossEntropyFAPIError(unittest.TestCase): ...@@ -1383,8 +1384,9 @@ class TestCrossEntropyFAPIError(unittest.TestCase):
label_data = paddle.randint( label_data = paddle.randint(
0, 100, shape=[20, 1], dtype="int64") 0, 100, shape=[20, 1], dtype="int64")
label_data[0] = -1 label_data[0] = -1
weight_data = paddle.rand([100])
paddle.nn.functional.cross_entropy( paddle.nn.functional.cross_entropy(
input=input_data, label=label_data) input=input_data, label=label_data, weight=weight_data)
self.assertRaises(ValueError, test_LabelValueNeg) self.assertRaises(ValueError, test_LabelValueNeg)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册