Class FuncGraphManager

Class Documentation

class FuncGraphManager

FuncGraphManager defines interface for function graph management.

Public Functions

explicit FuncGraphManager(const std::shared_ptr<mindspore::FuncGraphManager> &impl)

Create FuncGraphManager with the given implementor object.

参数

impl[in] The pointer to the implementor object.

inline const std::shared_ptr<mindspore::FuncGraphManager> &impl() const

Get the shared_ptr to the underly implementation object.

返回

The shared_ptr to the underly implementation object.

bool Replace(const AnfNodePtr &old_node, const AnfNodePtr &new_node)

Replace an old node with a new node, related edges are all updated.

参数
  • old_node[in] The old node to be replaced.

  • new_node[in] The new node that replace the old one.

返回

True if the node is successfully replaced, false otherwise.

void SetEdge(const AnfNodePtr &node, int index, const AnfNodePtr &value)

Change an existed edge by replace its input node.

参数
  • node[in] The output node of the edge.

  • index[in] The input index in output node.

  • value[in] The new input node of the edge.

void AddEdge(const AnfNodePtr &node, const AnfNodePtr &value)

Adds a new edge between the given two nodes.

参数
  • node[in] The output node of the edge.

  • value[in] The input node of the edge.

std::vector<std::pair<AnfNodePtr, int>> GetUsers(const AnfNodePtr &node) const

Find users of the given node.

参数

node[in] The node.

返回

Users of the given node, empty if user not found.

Public Static Functions

static FuncGraphManagerPtr Manage(const FuncGraphPtr &func_graph, bool manage = true)

Manage the give function graph.

参数
  • func_graph[in] The function graph to be managed.

  • manage[in] If true, the created manager will be set in the graph.

返回

The manager that manages the given function graph.