Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix one error massage #31904

Merged
merged 6 commits into from
Mar 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion paddle/fluid/operators/meshgrid_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}

Expand Down
10 changes: 7 additions & 3 deletions paddle/fluid/operators/meshgrid_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class MeshgridKernel : public framework::OpKernel<T> {
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));
}
}

Expand All @@ -71,7 +72,9 @@ class MeshgridKernel : public framework::OpKernel<T> {
auto outs = context.MultiOutput<framework::Tensor>("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<int64_t> shape(size);
Expand Down Expand Up @@ -131,7 +134,8 @@ class MeshgridGradKernel : public framework::OpKernel<T> {
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));
}
}

Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/operators/range_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>::value
Expand Down