diff --git a/paddle/fluid/framework/ir/graph_viz_pass.cc b/paddle/fluid/framework/ir/graph_viz_pass.cc index 5503c173403078e7a468e07edb0fb5226f1f4b0a..4c7ffe69e933de3d52c8f762a1eeb73de17e0561 100644 --- a/paddle/fluid/framework/ir/graph_viz_pass.cc +++ b/paddle/fluid/framework/ir/graph_viz_pass.cc @@ -27,14 +27,14 @@ using inference::analysis::Dot; namespace { const char kGraphVizPath[] = "graph_viz_path"; -std::string FormatName(const Node* op) { - if (!op->Op() || - !op->Op()->HasAttr(OpProtoAndCheckerMaker::OpNamescopeAttrName())) { - return op->Name(); +std::string FormatName(const Node* node) { + if (!node->IsOp() || !node->Op() || + !node->Op()->HasAttr(OpProtoAndCheckerMaker::OpNamescopeAttrName())) { + return node->Name(); } const std::string full_scope = boost::get( - op->Op()->GetAttr(OpProtoAndCheckerMaker::OpNamescopeAttrName())); - return string::Sprintf("%s%s", full_scope.c_str(), op->Name().c_str()); + node->Op()->GetAttr(OpProtoAndCheckerMaker::OpNamescopeAttrName())); + return string::Sprintf("%s%s", full_scope.c_str(), node->Name().c_str()); } } // namespace diff --git a/paddle/fluid/framework/ir/node.h b/paddle/fluid/framework/ir/node.h index 545ff3b4a4b713a49f0e52b5df10ce40d5112352..e8f084d20a279e8e1d76dffd442f3e17acffa814 100644 --- a/paddle/fluid/framework/ir/node.h +++ b/paddle/fluid/framework/ir/node.h @@ -55,7 +55,7 @@ class Node { std::string Name() const { return name_; } VarDesc* Var() { - PADDLE_ENFORCE(type_ == Type::kVariable); + PADDLE_ENFORCE(IsVar()); return var_desc_.get(); }