From 42d67dacb652f1d16406cbcdd36acd429c1e9c7b Mon Sep 17 00:00:00 2001 From: zhaoyuchen2018 <45989343+zhaoyuchen2018@users.noreply.github.com> Date: Thu, 9 Apr 2020 18:08:23 +0800 Subject: [PATCH] OP(minus) error message enhancement. test=develop (#23621) C++ error message enhancement. --- paddle/fluid/operators/minus_op.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/operators/minus_op.cc b/paddle/fluid/operators/minus_op.cc index 08696e32fc..5b14d4f687 100644 --- a/paddle/fluid/operators/minus_op.cc +++ b/paddle/fluid/operators/minus_op.cc @@ -47,7 +47,10 @@ class MinusOp : public framework::OperatorWithKernel { (framework::product(x_dims) > 0 && framework::product(y_dims) > 0)) { PADDLE_ENFORCE_EQ( x_dims, y_dims, - "Minus operator must take two tensor with same num of elements"); + platform::errors::InvalidArgument( + "Minus operator must take two tensor with same dim, but received " + "input X dim is:[%s], Y dim is:[%s]", + x_dims, y_dims)); } ctx->SetOutputDim("Out", x_dims); ctx->ShareLoD("X", /*->*/ "Out"); -- GitLab