mirror of
https://github.com/opencv/opencv.git
synced 2024-11-28 05:06:29 +08:00
dnn(ngraph): fixup get_output_as_single_output_node() replacement patch
This commit is contained in:
parent
441b6dbda0
commit
aa5bc20c83
@ -2196,9 +2196,22 @@ struct Net::Impl : public detail::NetImplBase
|
||||
continue;
|
||||
|
||||
auto ieInpNode = inputNodes[i].dynamicCast<InfEngineNgraphNode>();
|
||||
CV_Assert(oid < ieInpNode->node->get_output_size());
|
||||
const auto& ngraph_input_node = ieInpNode->node;
|
||||
CV_LOG_DEBUG(NULL, "DNN/IE: bind output port " << lid << ":" << oid << " (" << ngraph_input_node->get_friendly_name() << ":" << ngraph_input_node->get_type_info().name << ")");
|
||||
|
||||
// Handle parameters from other subnets. Output port is not used in this case
|
||||
if ((ngraph::op::is_parameter(ngraph_input_node) || ngraph::op::is_constant(ngraph_input_node)) &&
|
||||
ngraph_input_node->get_output_size() == 1)
|
||||
{
|
||||
inputNodes[i] = Ptr<BackendNode>(new InfEngineNgraphNode(ngraph_input_node));
|
||||
continue;
|
||||
}
|
||||
CV_CheckLT((size_t)oid, ngraph_input_node->get_output_size(), "");
|
||||
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2020_4)
|
||||
inputNodes[i] = Ptr<BackendNode>(new InfEngineNgraphNode(ieInpNode->node));
|
||||
// FIXIT refactor ".initNgraph()" API to use Output<Node>
|
||||
// WA: use Concat to emulate Identity operation with requested output port
|
||||
auto oid_node = std::make_shared<ngraph::op::Concat>(ngraph::OutputVector {ngraph_input_node->output(oid)}, 0);
|
||||
inputNodes[i] = Ptr<BackendNode>(new InfEngineNgraphNode(oid_node));
|
||||
#elif INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2020_3)
|
||||
inputNodes[i] = Ptr<BackendNode>(new InfEngineNgraphNode(ieInpNode->node->get_output_as_single_output_node(oid)));
|
||||
#else
|
||||
|
@ -330,7 +330,7 @@ public:
|
||||
InfEngineNgraphNode::InfEngineNgraphNode(std::shared_ptr<ngraph::Node>&& _node)
|
||||
: BackendNode(DNN_BACKEND_INFERENCE_ENGINE_NGRAPH), node(std::move(_node)) {}
|
||||
|
||||
InfEngineNgraphNode::InfEngineNgraphNode(std::shared_ptr<ngraph::Node>& _node)
|
||||
InfEngineNgraphNode::InfEngineNgraphNode(const std::shared_ptr<ngraph::Node>& _node)
|
||||
: BackendNode(DNN_BACKEND_INFERENCE_ENGINE_NGRAPH), node(_node) {}
|
||||
|
||||
InfEngineNgraphNode::InfEngineNgraphNode(const std::vector<Ptr<BackendNode> >& nodes,
|
||||
|
@ -102,7 +102,7 @@ public:
|
||||
std::vector<Mat>& internals);
|
||||
|
||||
InfEngineNgraphNode(std::shared_ptr<ngraph::Node>&& _node);
|
||||
InfEngineNgraphNode(std::shared_ptr<ngraph::Node>& _node);
|
||||
InfEngineNgraphNode(const std::shared_ptr<ngraph::Node>& _node);
|
||||
|
||||
void setName(const std::string& name);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user