diff --git a/python/paddle/fluid/tests/unittests/test_huber_loss_op.py b/python/paddle/fluid/tests/unittests/test_huber_loss_op.py index 2c8626cfd930f3fea8f4b16502f8d26ac074f169..cb97103e770d1a175dcd942575c047517167f1e1 100644 --- a/python/paddle/fluid/tests/unittests/test_huber_loss_op.py +++ b/python/paddle/fluid/tests/unittests/test_huber_loss_op.py @@ -89,14 +89,17 @@ class TestHuberLossOpError(unittest.TestCase): xr = fluid.data(name='xr', shape=[None, 6], dtype="float32") lw = np.random.random((6, 6)).astype("float32") lr = fluid.data(name='lr', shape=[None, 6], dtype="float32") - self.assertRaises(TypeError, fluid.layers.huber_loss, xw, lr) - self.assertRaises(TypeError, fluid.layers.huber_loss, xr, lw) + delta = 1.0 + self.assertRaises(TypeError, fluid.layers.huber_loss, xr, lw, delta) + self.assertRaises(TypeError, fluid.layers.huber_loss, xw, lr, delta) # the dtype of input and label must be float32 or float64 xw2 = fluid.data(name='xw2', shape=[None, 6], dtype="int32") lw2 = fluid.data(name='lw2', shape=[None, 6], dtype="int32") - self.assertRaises(TypeError, fluid.layers.huber_loss, xw2, lr) - self.assertRaises(TypeError, fluid.layers.huber_loss, xr, lw2) + self.assertRaises(TypeError, fluid.layers.huber_loss, xw2, lr, + delta) + self.assertRaises(TypeError, fluid.layers.huber_loss, xr, lw2, + delta) if __name__ == '__main__':