|
|
|
@ -177,6 +177,16 @@ class MarginRakingLossError(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
self.assertRaises(ValueError, test_margin_value_error)
|
|
|
|
|
|
|
|
|
|
def test_functional_margin_value_error():
|
|
|
|
|
x = paddle.static.data(name="x", shape=[10, 10], dtype="float64")
|
|
|
|
|
y = paddle.static.data(name="y", shape=[10, 10], dtype="float64")
|
|
|
|
|
label = paddle.static.data(
|
|
|
|
|
name="label", shape=[10, 10], dtype="float64")
|
|
|
|
|
result = paddle.nn.functional.margin_ranking_loss(
|
|
|
|
|
x, y, label, margin=0.1, reduction="reduction_mean")
|
|
|
|
|
|
|
|
|
|
self.assertRaises(ValueError, test_functional_margin_value_error)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
unittest.main()
|
|
|
|
|