mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
ONNX: upsample subgraph fusion added
This commit is contained in:
@@ -69,8 +69,12 @@ int Subgraph::getInputNodeId(const Ptr<ImportGraphWrapper>& net,
|
||||
const int numNodes = net->getNumNodes();
|
||||
for (int i = 0; i < numNodes; ++i)
|
||||
{
|
||||
if (net->getNodeName(i) == name)
|
||||
return i;
|
||||
const int numOutputs = net->getNumOutputs(i);
|
||||
for (int j = 0; j < numOutputs; j++)
|
||||
{
|
||||
if (net->getOutputName(i, j) == name)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
CV_Error(Error::StsParseError, "Input node with name " + name + " not found");
|
||||
}
|
||||
@@ -111,12 +115,12 @@ bool Subgraph::match(const Ptr<ImportGraphWrapper>& net, int nodeId,
|
||||
continue;
|
||||
nodeId = getInputNodeId(net, node, j);
|
||||
const Ptr<ImportNodeWrapper> inpNode = net->getNode(nodeId);
|
||||
if (inpNode->getType() != "Const")
|
||||
if (inpNode->getType() != "Const" && inpNode->getType() != "Constant")
|
||||
{
|
||||
nodesToMatch.push(nodeId);
|
||||
targetNodes.push(inputNodes[j]);
|
||||
}
|
||||
else if (nodes[inputNodes[j]] != "Const")
|
||||
else if (nodes[inputNodes[j]] != "Const" && nodes[inputNodes[j]] != "Constant")
|
||||
return false;
|
||||
}
|
||||
matchedNodesIds.push_back(nodeToMatch);
|
||||
|
||||
Reference in New Issue
Block a user