Skip to content
Snippets Groups Projects
Commit 127c621d authored by Grégoire Kubler's avatar Grégoire Kubler
Browse files

fix : previous fix was incorrect. mRootNode is set in updateinputsoutputsdelete

parent 0c0bdc63
No related branches found
No related tags found
2 merge requests!105version 0.2.0,!91Feat/operator global average pooling
...@@ -923,11 +923,7 @@ bool Aidge::GraphView::replace(const std::shared_ptr<GraphView>& oldGraph, const ...@@ -923,11 +923,7 @@ bool Aidge::GraphView::replace(const std::shared_ptr<GraphView>& oldGraph, const
for (std::size_t i = 0; i < oldOIn.size(); ++i) { for (std::size_t i = 0; i < oldOIn.size(); ++i) {
if (inputParents[i].first) { if (inputParents[i].first) {
inputParents[i].first -> addChild(outputChildren[i].first, inputParents[i].second, outputChildren[i].second); inputParents[i].first -> addChild(outputChildren[i].first, inputParents[i].second, outputChildren[i].second);
} else { }
for (auto & view : commonGraphViews){
view->setRootNode( outputChildren[i].first);
}
}
} }
} }
else if ((oldOIn.size() == 1) && (inputParents[0].first)) { else if ((oldOIn.size() == 1) && (inputParents[0].first)) {
...@@ -937,7 +933,7 @@ bool Aidge::GraphView::replace(const std::shared_ptr<GraphView>& oldGraph, const ...@@ -937,7 +933,7 @@ bool Aidge::GraphView::replace(const std::shared_ptr<GraphView>& oldGraph, const
} }
} }
else if ( // for tiling-like cases. The number of inputNodes changes but not outputNodes else if ( // for tiling-like cases. The number of inputNodes changes but not outputNodes
((oldOIn.size() == 1) || (newOIn.size() == 1)) && // (oldOI.size() == newOI.size()) already handled in Case 1 ((oldOIn.size() == 1) || (newOIn.size() == 1)) && // (oldOIn.size() == newOI.size()) already handled in Case 1
((oldOOut.size() == newOOut.size())) ((oldOOut.size() == newOOut.size()))
) { ) {
// Case 2 // Case 2
...@@ -1201,7 +1197,14 @@ void Aidge::GraphView::updateInputsOutputsDelete(std::shared_ptr<Node> deletedNo ...@@ -1201,7 +1197,14 @@ void Aidge::GraphView::updateInputsOutputsDelete(std::shared_ptr<Node> deletedNo
} }
if (deletedNode == mRootNode) { if (deletedNode == mRootNode) {
mRootNode = nullptr; const std::pair<std::vector<NodePtr>, size_t> ranked_nodes = getRankedNodes();
if(ranked_nodes.second== 0 )
{
mRootNode = nullptr;
} else {
// The new root node will be the second node in the order of ranked nodes
setRootNode(*std::next(ranked_nodes.first.cbegin(),1));
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment