Skip to content
Snippets Groups Projects

[Upd] replace() instead of replaceWith() in GraphView

Merged Maxence Naud requested to merge fix/replaceWith into main
All threads resolved!
Files
3
@@ -322,17 +322,17 @@ public:
@@ -322,17 +322,17 @@ public:
/**
/**
* @brief Insert a node (newParentNode) as a parent of the passed node (childNode).
* @brief Insert a node (newParentNode) as a parent of the passed node (childNode).
*
*
* @param childNode Node that gets a new parent.
* @param childNode Node that gets a new parent.
* @param newParentNode Inserted Node.
* @param newParentNode Inserted Node.
* @param childInputTensorIdx Index of the input Tensor for the childNode linked to the inserted Node output.
* @param childInputTensorIdx Index of the input Tensor for the childNode linked to the inserted Node output.
* @param newParentInputTensorIdx Index of the input Tensor for the newParentNode linked to the former parent of childNode.
* @param newParentInputTensorIdx Index of the input Tensor for the newParentNode linked to the former parent of childNode.
* @param newParentOutputTensorIdx Index of the output Tensor for the newParentNode linked to the childNode's input Tensor.
* @param newParentOutputTensorIdx Index of the output Tensor for the newParentNode linked to the childNode's input Tensor.
*/
*/
void insertParent(NodePtr childNode,
void insertParent(NodePtr childNode,
NodePtr newParentNode,
NodePtr newParentNode,
IOIndex_t childInputTensorIdx,
IOIndex_t childInputTensorIdx,
IOIndex_t newParentInputTensorIdx,
IOIndex_t newParentInputTensorIdx,
IOIndex_t newParentOutputTensorIdx);
IOIndex_t newParentOutputTensorIdx);
/**
/**
@@ -342,6 +342,20 @@ public:
@@ -342,6 +342,20 @@ public:
* @return false
* @return false
*/
*/
bool replaceWith(std::set<NodePtr> newNodes);
bool replaceWith(std::set<NodePtr> newNodes);
 
 
/**
 
* @brief Replace a set of Nodes in the current GraphView with a new set of Nodes if possible.
 
* Both sets should include all the necessary Producers.
 
* @details Replaced Nodes are only removed from the current GraphView. Other GraphView containing
 
* them will not be affected by the replacement. The oldNodes set should have only one input/output
 
* Node for automatic connections of newNodes set.
 
* @param oldNodes actual set of shared_ptr<Node> to replace.
 
* @param newNodes new set of shared_ptr<Node>.
 
* @return true
 
* @return false
 
*/
 
bool replace(std::set<NodePtr>& oldNodes, std::set<NodePtr>& newNodes);
 
void updateInputNodes();
void updateInputNodes();
/**
/**
* @brief Process from zero the set of output Nodes.
* @brief Process from zero the set of output Nodes.
@@ -379,6 +393,12 @@ public:
@@ -379,6 +393,12 @@ public:
*/
*/
std::shared_ptr<GraphView> cloneCallback(NodePtr(*cloneNode)(NodePtr)) const;
std::shared_ptr<GraphView> cloneCallback(NodePtr(*cloneNode)(NodePtr)) const;
 
/**
 
* @brief Get the sum of the number of free dataInput connection for all inputNodes of the GraphView object.
 
* @return IOIndex_t
 
*/
 
IOIndex_t getNbFreeDataInputs() const;
 
private:
private:
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
// TENSOR MANAGEMENT
// TENSOR MANAGEMENT
@@ -390,12 +410,6 @@ private:
@@ -390,12 +410,6 @@ private:
*/
*/
IOIndex_t getNbDataInputs() const;
IOIndex_t getNbDataInputs() const;
/**
* @brief Get the sum of the number of free dataInput connection for all inputNodes of the GraphView object.
* @return IOIndex_t
*/
IOIndex_t getNbFreeDataInputs() const;
/**
/**
* @brief Update the set of inputNodes with a new Node, checking if it can be
* @brief Update the set of inputNodes with a new Node, checking if it can be
* added and removing any Node not part of mInputNode anymore.
* added and removing any Node not part of mInputNode anymore.
Loading