Browse Source

Add 'Create' method for api::FuncGraph

tags/v1.5.0-rc1
He Wei 4 years ago
parent
commit
c1f124cecd
2 changed files with 5 additions and 0 deletions
  1. +2
    -0
      mindspore/core/api/ir/func_graph.h
  2. +3
    -0
      mindspore/core/ir/func_graph.cc

+ 2
- 0
mindspore/core/api/ir/func_graph.h View File

@@ -48,6 +48,8 @@ class MS_CORE_API FuncGraph {
virtual FuncGraphManagerPtr get_manager() const = 0;

static std::vector<AnfNodePtr> TopoSort(const AnfNodePtr &node);

static FuncGraphPtr Create();
};
} // namespace mindspore::api
#endif // MINDSPORE_CORE_API_IR_FUNC_GRAPH_H_

+ 3
- 0
mindspore/core/ir/func_graph.cc View File

@@ -743,5 +743,8 @@ size_t NewFgSeenGeneration() {
// Implement TopoSort api.
std::vector<AnfNodePtr> api::FuncGraph::TopoSort(const AnfNodePtr &node) { return mindspore::TopoSort(node); }

// Create an api::FuncGraph instance.
api::FuncGraphPtr api::FuncGraph::Create() { return std::make_shared<mindspore::FuncGraph>(); }

const PrimitivePtr FuncGraphTransform::func_graph_prim_ = std::make_shared<Primitive>("FuncGraph");
} // namespace mindspore

Loading…
Cancel
Save