From 9f02c284751e39b23c8f8c55caa9d3981b471556 Mon Sep 17 00:00:00 2001 From: ShenLiang Date: Thu, 7 Jan 2021 16:48:32 +0800 Subject: [PATCH] fix error message (#30135) (#30182) --- 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 950aed0aa4..7f5df11468 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 460df0333f..7c2b4a8b48 100644 --- a/paddle/fluid/operators/rank_attention_op.cc +++ b/paddle/fluid/operators/rank_attention_op.cc @@ -58,7 +58,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 97d35061f8..7325df85c4 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