提交 f2eed667 编写于 作者: S sneaxiy

test=develop

上级 cef8cc81
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
#include <vector> #include <vector>
#include "paddle/fluid/framework/op_proto_maker.h"
namespace paddle { namespace paddle {
namespace framework { namespace framework {
...@@ -28,7 +29,7 @@ static bool IsSameOpDesc(OpDesc *op1, OpDesc *op2) { ...@@ -28,7 +29,7 @@ static bool IsSameOpDesc(OpDesc *op1, OpDesc *op2) {
std::unique_ptr<ir::Graph> SequentialExecutionPass::ApplyImpl( std::unique_ptr<ir::Graph> SequentialExecutionPass::ApplyImpl(
std::unique_ptr<ir::Graph> graph) const { std::unique_ptr<ir::Graph> graph) const {
auto ops = this->Get<const std::vector<OpDesc *>>(kAllOpDescs); auto &ops = Get<const std::vector<OpDesc *>>(kAllOpDescs);
std::vector<ir::Node *> op_node_list; std::vector<ir::Node *> op_node_list;
op_node_list.reserve(ops.size()); op_node_list.reserve(ops.size());
...@@ -39,7 +40,6 @@ std::unique_ptr<ir::Graph> SequentialExecutionPass::ApplyImpl( ...@@ -39,7 +40,6 @@ std::unique_ptr<ir::Graph> SequentialExecutionPass::ApplyImpl(
for (ir::Node *node : graph->Nodes()) { for (ir::Node *node : graph->Nodes()) {
if (!node->IsOp()) continue; if (!node->IsOp()) continue;
std::unordered_set<ir::Node *> preceding_ops; std::unordered_set<ir::Node *> preceding_ops;
pending_ops[node];
for (auto *in : node->inputs) { for (auto *in : node->inputs) {
PADDLE_ENFORCE(in->IsVar(), PADDLE_ENFORCE(in->IsVar(),
"Preceding Node of Op Nodes must be Var Node"); "Preceding Node of Op Nodes must be Var Node");
...@@ -66,8 +66,8 @@ std::unique_ptr<ir::Graph> SequentialExecutionPass::ApplyImpl( ...@@ -66,8 +66,8 @@ std::unique_ptr<ir::Graph> SequentialExecutionPass::ApplyImpl(
} }
PADDLE_ENFORCE_NOT_NULL(found_node, "Cannot find op_desc in graph: %s", PADDLE_ENFORCE_NOT_NULL(found_node, "Cannot find op_desc in graph: %s",
found_node->Op()->Type()); op_desc->Type());
for (auto *pending_op : pending_ops.at(found_node)) { for (auto *pending_op : pending_ops[found_node]) {
if (--op_deps.at(pending_op) == 0) { if (--op_deps.at(pending_op) == 0) {
ready_ops.insert(pending_op); ready_ops.insert(pending_op);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册