未验证 提交 a4f60034 编写于 作者: C Chen Weihang 提交者: GitHub

append try-catch to opbase run, test=develop (#24870)

上级 63fedfd4
......@@ -53,7 +53,23 @@ void Tracer::TraceOp(const std::string& type, const NameVarBaseMap& ins,
attr_checker->Check(&attrs, true);
}
OpBase::Run(*op, ins, outs, attrs, place);
try {
OpBase::Run(*op, ins, outs, attrs, place);
} catch (platform::EnforceNotMet& exception) {
framework::AppendErrorOpHint(type, &exception);
throw std::move(exception);
} catch (std::exception& ex) {
PADDLE_THROW(platform::errors::Fatal(
"Operator %s raises an %s exception.\n"
"The exception content is\n:%s.",
type, platform::demangle(typeid(ex).name()), ex.what()));
} catch (...) {
// NOTE: this branch represents a very serious bug with
// low probability of occurrence, and we can't get its
// exception content here.
PADDLE_THROW(platform::errors::Fatal(
"Operator %s raises an unknown exception.", type));
}
if (enable_program_desc_tracing_) {
VLOG(5) << "Trace op " << type << " into ProgramDesc";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册