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.

Parameters

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.

Returns

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.

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

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

Returns

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.

Parameters
  • 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.

Parameters
  • 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.

Parameters

node[in] The node.

Returns

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.

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

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

Returns

The manager that manages the given function graph.