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

OP报错信息优化 #27301

Merged
merged 2 commits into from
Sep 17, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
fix typo
test=develop
  • Loading branch information
gavin1332 committed Sep 15, 2020
commit 554853042228fbb961ccfab38843e91ef4952d7a
20 changes: 10 additions & 10 deletions paddle/fluid/operators/distributed_ops/listen_and_serv_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void ListenAndServOp::RunSyncLoop(
auto optimize_blocks =
Attr<std::vector<framework::BlockDesc *>>(kOptimizeBlocks);
PADDLE_ENFORCE_GE(num_blocks, 2,
paddle::error::PreconditionNotMet(
platform::errors::PreconditionNotMet(
"Invalid number of blocks in server program. Expected "
"equal or greater than 2. Recieved %zu",
num_blocks));
Expand Down Expand Up @@ -221,7 +221,7 @@ void ListenAndServOp::ResetReceivedVars(framework::Scope *recv_scope,
VLOG(3) << "reset sparse var: " << varname;
var->GetMutable<framework::SelectedRows>()->mutable_rows()->clear();
} else {
PADDLE_THROW(paddle::errors::PreconditionNotMet(
PADDLE_THROW(platform::errors::PreconditionNotMet(
"The type of sparse var should be SelectedRows"));
}
}
Expand All @@ -239,7 +239,7 @@ void ListenAndServOp::ResetReceivedVars(framework::Scope *recv_scope,
math::set_constant(*dev_ctx, var->GetMutable<framework::Tensor>(),
static_cast<float>(0));
} else {
PADDLE_THROW(paddle::errors::PreconditionNotMet(
PADDLE_THROW(platform::errors::PreconditionNotMet(
"The type of dense var should be in [LoDTensor, Tensor]"));
}
}
Expand All @@ -260,14 +260,14 @@ void ListenAndServOp::RunAsyncLoop(framework::Executor *executor,
split(grad_and_id, ':', &pieces);
VLOG(3) << "after split, key = " << pieces[0] << ", id=" << pieces[1];
PADDLE_ENFORCE_EQ(pieces.size(), 2,
paddle::errors::PreconditionNotMet(
platform::errors::PreconditionNotMet(
"Invalid format of grad_and_id argument. "
"Expected \"grad:block_id\". Recieved %s",
grad_and_id.c_str()));
PADDLE_ENFORCE_EQ(out_map->count(pieces[0]), 0,
paddle::errors::AlreadyExists(
platform::errors::AlreadyExists(
"The gradient name %s has already existed in out_map",
piece[0].c_str()));
pieces[0].c_str()));

int block_id = std::stoi(pieces[1]);
(*out_map)[pieces[0]] = block_id;
Expand All @@ -279,7 +279,7 @@ void ListenAndServOp::RunAsyncLoop(framework::Executor *executor,

size_t num_blocks = program->Size();
PADDLE_ENFORCE_GE(num_blocks, 2,
paddle::error::PreconditionNotMet(
platform::errors::PreconditionNotMet(
"Invalid number of blocks in server program. Expected "
"equal or greater than 2. Recieved %zu",
num_blocks));
Expand Down Expand Up @@ -357,7 +357,7 @@ void ListenAndServOp::CacheVarsType(const std::vector<std::string> &varnames,
var->IsType<framework::Tensor>()) {
dense_vars_.push_back(varname);
} else {
PADDLE_THROW(paddle::errors::PreconditionNotMet(
PADDLE_THROW(platform::errors::PreconditionNotMet(
"The type of received var should be in [SelectedRows, LoDTensor, "
"Tensor]."));
}
Expand Down Expand Up @@ -467,7 +467,7 @@ void ListenAndServOp::RunImpl(const framework::Scope &scope,
<< ", id=" << pieces[1];
PADDLE_ENFORCE_EQ(
pieces.size(), 2,
paddle::errors::PreconditionNotMet(
platform::errors::PreconditionNotMet(
"Invalid format of prefetch_var_name_and_id argument. "
"Expected \"xxx:xxx\". Recieved %s",
prefetch_var_name_and_id.c_str()));
Expand Down Expand Up @@ -498,7 +498,7 @@ void ListenAndServOp::RunImpl(const framework::Scope &scope,
split(sparse_grad_name_and_param_name, ':', &pieces);
PADDLE_ENFORCE_EQ(
pieces.size(), 2,
paddle::errors::PreconditionNotMet(
platform::errors::PreconditionNotMet(
"Invalid format of sparse_grad_name_and_param_name argument. "
"Expected \"xxx:xxx\". Recieved %s",
sparse_grad_name_and_param_name.c_str()));
Expand Down