diff --git a/paddle/fluid/framework/ir/graph.cc b/paddle/fluid/framework/ir/graph.cc index 167e65da1cba1b3b93e77683ed2fc6647acb7c49..4be165e7a10dae00f54b5976e375021f03bad4f8 100644 --- a/paddle/fluid/framework/ir/graph.cc +++ b/paddle/fluid/framework/ir/graph.cc @@ -38,10 +38,11 @@ void CheckProgram(const ProgramDesc &program) { visit[role_id] = true; switch (role_id) { case _INT(OpRole::kForward): - PADDLE_ENFORCE( - visit.find(_INT(OpRole::kBackward)) == visit.end(), - "Cannot add backward operator before forward operator %s.", - op->Type()); + if (visit.find(_INT(OpRole::kBackward)) != visit.end()) { + LOG(ERROR) + << "Cannot add backward operator before forward operator %s." + << op->Type(); + } break; case _INT(OpRole::kBackward): case _INT(OpRole::kBackward) | _INT(OpRole::kLoss):