From becf99d2e8fab3e8be7adfdc6f4245b9e8341918 Mon Sep 17 00:00:00 2001 From: ShenLiang Date: Wed, 6 Jan 2021 21:01:26 +0800 Subject: [PATCH] fix error message (#30135) --- paddle/fluid/operators/math/matrix_inverse.cu.cc | 6 ++++-- paddle/fluid/operators/rank_attention_op.cc | 4 +++- paddle/fluid/operators/scatter.h | 6 +++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/operators/math/matrix_inverse.cu.cc b/paddle/fluid/operators/math/matrix_inverse.cu.cc index 950aed0aa49..7f5df114680 100644 --- a/paddle/fluid/operators/math/matrix_inverse.cu.cc +++ b/paddle/fluid/operators/math/matrix_inverse.cu.cc @@ -106,8 +106,10 @@ class MatrixInverseFunctor { for (int i = 0; i < batch_size; ++i) { PADDLE_ENFORCE_EQ(info[i], 0, platform::errors::PreconditionNotMet( - "For batch [%d]: U(%d, %d) is zero, singular U.", i, - info[i], info[i])); + "For batch [%d]: U(%d, %d) is zero, singular U. " + "Please check the matrix value and change it to a " + "non-singular matrix", + i, info[i], info[i])); } } }; diff --git a/paddle/fluid/operators/rank_attention_op.cc b/paddle/fluid/operators/rank_attention_op.cc index d7490220da0..e5332da6475 100644 --- a/paddle/fluid/operators/rank_attention_op.cc +++ b/paddle/fluid/operators/rank_attention_op.cc @@ -59,7 +59,9 @@ class RankAttentionOp : public framework::OperatorWithKernel { PADDLE_ENFORCE_EQ((rank_offset_dims[1] - 1) / 2, max_rank, platform::errors::InvalidArgument( - "Input(RankOffset) has wrong columns.")); + "Input(RankOffset) has wrong columns, " + "except columns to be %d, but got %d", + max_rank, (rank_offset_dims[1] - 1) / 2)); ctx->SetOutputDim("Out", {ins_num, para_col}); ctx->SetOutputDim("InputHelp", {ins_num, block_matrix_row}); diff --git a/paddle/fluid/operators/scatter.h b/paddle/fluid/operators/scatter.h index 97d35061f85..7325df85c46 100644 --- a/paddle/fluid/operators/scatter.h +++ b/paddle/fluid/operators/scatter.h @@ -128,7 +128,11 @@ void ScatterAssignAdd(const framework::ExecutionContext& ctx, const Tensor& src, PADDLE_ENFORCE_EQ( index.dims().size() == 1 || (index.dims().size() == 2 && index.dims()[1] == 1), - true, platform::errors::InvalidArgument("index's shape is error.")); + true, platform::errors::InvalidArgument( + "index's shape is error, " + "expect index'dims shape is 1 or 2 and index.dims[1] is 1" + "but got index'dims shape is %d", + index.dims().size())); int index_size = index.dims()[0]; auto src_dims = src.dims(); -- GitLab