[shape_infer]shape inference implement of Select Detectionoutput and Shufflechannels OPs (#8348)

* Implement detection_output shape infer

* revise and update the code flow

* update based on review.

* Update based on review

* Implement the shuffle_channels Op shape inference.

* Fix CI coding style issue.

* Implement the select OP shape inference.

* Update based on the review  comments

* Update based on the review comments.

* Add pragma once for the shape inference head.

* Add new shape_infer test file for detection_output OP.

* Ensure the header would only be included once.

* Add shuffle_channels OP shape infer test.

* Add shape_infer() invocations into shape_inference() API

shape_inference() API support Select, ShuffleChannels, DetectionOutput OPs
Fix extra pragma, unnecessary friend function declaration.

* Update based on the review comments.

* Move the shape infer API helpers into new folder.

* Applied review comments.

* Applied 2nd review comments

* Applied review comments

* Fix coding style.

* Update

* Applied review comments.

* Fix comipling issue of unused variable.

* Fix the CI issue.

* Update the coding style

* Move test cases into new folder

* Applied  review comments.
This commit is contained in:
Luwei Zhou authored and GitHub committed 2021-12-29 05:39:50 +03:00
1 parent a51a735d9f
commit ce753f41dc
18 files changed
+841 -329

No files matched your search

@@ -56,6 +56,9 @@
#include "roi_align_shape_inference.hpp"
#include "roll_shape_inference.hpp"
#include "proposal_shape_inference.hpp"
#include "detection_output_shape_inference.hpp"
#include "select_shape_inference.hpp"
#include "shuffle_channels_shape_inference.hpp"
#include "static_shape.hpp"
#include "tile_shape_inference.hpp"
#include "utils.hpp"
@@ -218,6 +221,14 @@ void shape_inference(ov::Node* op,
shape_infer(node, input_shapes, output_shapes);
} else if (auto node = ov::as_type<ov::opset3::ROIAlign>(op)) {
shape_infer(node, input_shapes, output_shapes);
} else if (auto node = ov::as_type<ov::opset1::DetectionOutput>(op)) {
shape_infer(node, input_shapes, output_shapes);
} else if (auto node = ov::as_type<ov::opset8::DetectionOutput>(op)) {
shape_infer(node, input_shapes, output_shapes);
} else if (auto node = ov::as_type<ov::opset1::Select>(op)) {
shape_infer(node, input_shapes, output_shapes);
} else if (auto node = ov::as_type<ov::opset1::ShuffleChannels>(op)) {
shape_infer(node, input_shapes, output_shapes);
} else {
ngraph::OutputVector new_inputs;
for (size_t i = 0; i < op->get_input_size(); ++i) {
@@ -124,6 +124,10 @@ bool ov::StaticShape::broadcast_merge_into(StaticShape& dst,
// Ranks are both static.
auto dst_rank = dst.rank().get_length();
auto src_rank = src.rank().get_length();
// source rank can't be bigger than destination rank according to
// PDPD broadcast rule.
if (src_rank > dst_rank)
return false;
if (dst_rank == src_rank && dst.compatible(src))
return true;