Merge pull request #25739 from alexlyulkov:al/openvino2022-fixed-blank

Fixed blank layer for OpenVINO 2022.1 #25739

Changed blank layer because it didn't work with old OpenVINO versions(2022.1). The blank layer was implemented using ConvertLike layer, now it is implemented using ShapeOf and Reshape layers.

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
alexlyulkov 2024-06-27 18:51:35 +03:00 committed by GitHub
parent 719b49ffa9
commit fd7cb1be85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -161,7 +161,11 @@ public:
const std::vector<Ptr<BackendNode> >& nodes) CV_OVERRIDE
{
auto ieInpNode = nodes[0].dynamicCast<InfEngineNgraphNode>()->node;
auto blank = std::make_shared<ov::op::v1::ConvertLike>(ieInpNode, ieInpNode);
// We use Reshape as blank layer.
// Previously, we used Concat layer, but it didn't work with scalar tensor.
// Also we used ConvertLike layer, but it did't work with old OpenVINO versions.
auto shape = std::make_shared<ov::op::v0::ShapeOf>(ieInpNode);
auto blank = std::make_shared<ov::op::v1::Reshape>(ieInpNode, shape, false);
return Ptr<BackendNode>(new InfEngineNgraphNode(blank));
}
#endif // HAVE_DNN_NGRAPH