mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 06:03:15 +08:00
Merge pull request #18027 from dkurt:dnn_backport_ngraph
This commit is contained in:
commit
5b5c42d2c7
@ -109,6 +109,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
#if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2020_4)
|
||||
std::shared_ptr<ngraph::Node> clone_with_new_inputs(const ngraph::OutputVector& new_args) const override
|
||||
{
|
||||
return std::make_shared<NgraphCustomOp>(new_args, params);
|
||||
}
|
||||
#else
|
||||
std::shared_ptr<ngraph::Node> copy_with_new_args(const ngraph::NodeVector& new_args) const override
|
||||
{
|
||||
#if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2020_3)
|
||||
@ -117,6 +123,7 @@ public:
|
||||
return std::make_shared<NgraphCustomOp>(new_args, params);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
bool visit_attributes(ngraph::AttributeVisitor& visitor) override
|
||||
{
|
||||
@ -380,7 +387,11 @@ void InfEngineNgraphNet::setNodePtr(std::shared_ptr<ngraph::Node>* ptr) {
|
||||
|
||||
void InfEngineNgraphNet::release() {
|
||||
for (auto& node : components.back()) {
|
||||
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2020_4)
|
||||
if (!(ngraph::op::is_parameter(node) || ngraph::op::is_output(node) || ngraph::op::is_constant(node)) ) {
|
||||
#else
|
||||
if (!(node->is_parameter() || node->is_output() || node->is_constant()) ) {
|
||||
#endif
|
||||
auto it = all_nodes.find(node->get_friendly_name());
|
||||
if (it != all_nodes.end()) {
|
||||
unconnectedNodes.erase(*(it->second));
|
||||
@ -447,11 +458,19 @@ void InfEngineNgraphNet::createNet(Target targetId) {
|
||||
ngraph::ResultVector outputs;
|
||||
ngraph::ParameterVector inps;
|
||||
for (auto& node : components.back()) {
|
||||
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2020_4)
|
||||
if (ngraph::op::is_parameter(node)) {
|
||||
#else
|
||||
if (node->is_parameter()) {
|
||||
#endif
|
||||
auto parameter = std::dynamic_pointer_cast<ngraph::op::Parameter>(node);
|
||||
inps.push_back(parameter);
|
||||
}
|
||||
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2020_4)
|
||||
else if (ngraph::op::is_output(node)) {
|
||||
#else
|
||||
else if (node->is_output()) {
|
||||
#endif
|
||||
auto result = std::dynamic_pointer_cast<ngraph::op::Result>(node);
|
||||
outputs.push_back(result);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user