Class FuncGraphManager

Inheritance Relationships

Derived Type

Class Documentation

class FuncGraphManager

FuncGraphManager defines interface for function graph management.

Subclassed by mindspore::FuncGraphManager

Public Functions

FuncGraphManager() = default

Constructor of FuncGraphManager.

virtual ~FuncGraphManager() = default

Destructor of FuncGraphManager.

virtual bool Replace(const AnfNodePtr &old_node, const AnfNodePtr &new_node) = 0

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.

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

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.

virtual void AddEdge(const AnfNodePtr &node, const AnfNodePtr &value) = 0

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.

virtual const NodeUsersMap &node_users() const = 0

Get the node to users map.

Returns

The node to users map.

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 graph.

Returns

The manager that manages the given function graph.