From 6f85e24187bb1c29dce10eaccbac6a4935d3513c Mon Sep 17 00:00:00 2001 From: Kqnonrime <36952116+Kqnonrime@users.noreply.github.com> Date: Wed, 31 Mar 2021 15:58:30 +0800 Subject: [PATCH] fix one error massage (#31904) * fix one error massage * fix a error message * new fix three error messages * new fix three error messages * new fix some error * new fix one error message --- paddle/fluid/operators/meshgrid_op.cc | 4 +++- paddle/fluid/operators/meshgrid_op.h | 10 +++++++--- paddle/fluid/operators/range_op.h | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/paddle/fluid/operators/meshgrid_op.cc b/paddle/fluid/operators/meshgrid_op.cc index 12b255329d..33f71b4adc 100644 --- a/paddle/fluid/operators/meshgrid_op.cc +++ b/paddle/fluid/operators/meshgrid_op.cc @@ -108,7 +108,9 @@ class MeshgridGradOp : public framework::OperatorWithKernel { void InferShape(framework::InferShapeContext* ctx) const override { PADDLE_ENFORCE_GT(ctx->Inputs(framework::GradVarName("Out")).size(), 1, platform::errors::InvalidArgument( - "Number of Inputs(Out@Grad) must be larger than 1")); + "Number of Inputs(Out@Grad) should be larger than 1." + "But received Inputs(Out@Grad)' size = %d .", + ctx->Inputs(framework::GradVarName("Out")).size())); ctx->SetOutputsDim(framework::GradVarName("X"), ctx->GetInputsDim("X")); } diff --git a/paddle/fluid/operators/meshgrid_op.h b/paddle/fluid/operators/meshgrid_op.h index 11cd43b220..162622c7d0 100644 --- a/paddle/fluid/operators/meshgrid_op.h +++ b/paddle/fluid/operators/meshgrid_op.h @@ -60,7 +60,8 @@ class MeshgridKernel : public framework::OpKernel { REP_MESHGRID_TEMPLATE(MAX_RANK_SUPPORTED) default: PADDLE_THROW(platform::errors::InvalidArgument( - "Only support tensor nums between 1 and 6.")); + "Excepted Tensor numbers between 1 and 6, but only received d% .", + rank)); } } @@ -71,7 +72,9 @@ class MeshgridKernel : public framework::OpKernel { auto outs = context.MultiOutput("Out"); PADDLE_ENFORCE_EQ( ins.size() > 1, true, - platform::errors::InvalidArgument("expect at least 2 input tensors")); + platform::errors::InvalidArgument( + "Expected at least 2 input tensors, but only received d%.", + ins.size())); int64_t size = ins.size(); std::vector shape(size); @@ -131,7 +134,8 @@ class MeshgridGradKernel : public framework::OpKernel { REP_MESHGRID_GRAD_TEMPLATE(MAX_RANK_SUPPORTED) default: PADDLE_THROW(platform::errors::InvalidArgument( - "only support tensor nums being between 1 and 6.")); + "Excepted Tensor numbers between 1 and 6, but only received d% .", + n)); } } diff --git a/paddle/fluid/operators/range_op.h b/paddle/fluid/operators/range_op.h index a793d12f52..5344147a90 100644 --- a/paddle/fluid/operators/range_op.h +++ b/paddle/fluid/operators/range_op.h @@ -34,7 +34,7 @@ void GetSize(T start, T end, T step, int64_t* size) { if (start > end) { PADDLE_ENFORCE_LT(step, 0, platform::errors::InvalidArgument( - "step should be less than 0 while start > end.")); + "The step should be less than 0 while start > end.")); } *size = std::is_integral::value -- GitLab