From 046b7ebc03fa16af42d6db83e4185438ec7ff4a0 Mon Sep 17 00:00:00 2001 From: huangjun12 <2399845970@qq.com> Date: Wed, 13 May 2020 11:25:35 +0800 Subject: [PATCH] refine Error message of modified_huber_loss (#24417) * refine Error message of modified_huber_loss, test=develop * refine Error message style, test=develop --- paddle/fluid/operators/modified_huber_loss_op.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/operators/modified_huber_loss_op.h b/paddle/fluid/operators/modified_huber_loss_op.h index d6dd5539af0..17621095c49 100644 --- a/paddle/fluid/operators/modified_huber_loss_op.h +++ b/paddle/fluid/operators/modified_huber_loss_op.h @@ -29,10 +29,12 @@ using EigenVector = framework::EigenVector; template struct CheckLabelValue { HOSTDEVICE T operator()(const T& val) const { - PADDLE_ENFORCE(val == static_cast(0) || val == static_cast(1), - "LabelValue of modified_huber_loss_op expected to be 0 " - "or 1, but got %ld. Please check input value.", - val); + PADDLE_ENFORCE( + val == static_cast(0) || val == static_cast(1), + platform::errors::InvalidArgument( + "Input(label) value of modified_huber_loss_op expected to be 0 " + "or 1, but got %ld. Please check label value.", + val)); } }; -- GitLab