Merge pull request #24275 from alexlyulkov:al/fix-tf-graph-simplifier

Fixed removePhaseSwitches in tf_graph_simplifier
pull/24290/head
Alexander Smorkalov 1 year ago committed by GitHub
commit 157b0e7760
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      modules/dnn/src/tensorflow/tf_graph_simplifier.cpp

@ -1120,15 +1120,16 @@ void removePhaseSwitches(tensorflow::GraphDef& net)
inpName = inpName.substr(1 + (int)inpName.find('^'), inpName.rfind(':'));
nodesMapIt = nodesMap.find(inpName);
CV_Assert(nodesMapIt != nodesMap.end());
int inpNodeId = nodesMapIt->second;
CV_CheckGT(numConsumers[inpNodeId], 0,
"Input node of the current node should have at least one output node");
if (numConsumers[inpNodeId] == 1)
{
mergeOpSubgraphNodes.push(inpNodeId);
nodesToRemove.push_back(inpNodeId);
}
else if (numConsumers[inpNodeId] > 0)
numConsumers[inpNodeId] -= 1;
numConsumers[inpNodeId] -= 1;
}
}
std::sort(nodesToRemove.begin(), nodesToRemove.end());

Loading…
Cancel
Save