Review multiclass nms class for shape inference aspects (#18908)

* Review NMS shape inference

* Fix test issues

* Review MatrixNms shape inference

* Unregister NMS with dynamic output from CPU plugin

* Review MulticlassNms for shape inference
This commit is contained in:
Pawel Raasz authored and GitHub committed 2023-08-02 08:01:06 +00:00
1 parent a2039e8410
commit 1f08d3520c
10 files changed
+457 -619

No files matched your search

@@ -38,23 +38,17 @@ std::shared_ptr<Node> op::internal::MulticlassNmsIEInternal::clone_with_new_inpu
void op::internal::MulticlassNmsIEInternal::validate_and_infer_types() {
INTERNAL_OP_SCOPE(internal_MulticlassNmsIEInternal_validate_and_infer_types);
const auto output_type = get_attrs().output_type;
OPENVINO_SUPPRESS_DEPRECATED_START
const auto input_shapes = get_node_input_partial_shapes(*this);
OPENVINO_SUPPRESS_DEPRECATED_END
const auto output_shapes = shape_infer(this, input_shapes, false, true);
validate();
const auto& boxes_ps = get_input_partial_shape(0);
const auto& scores_ps = get_input_partial_shape(1);
std::vector<PartialShape> input_shapes = {boxes_ps, scores_ps};
if (get_input_size() == 3) {
const auto& roisnum_ps = get_input_partial_shape(2);
input_shapes.push_back(roisnum_ps);
}
std::vector<PartialShape> output_shapes = {{Dimension::dynamic(), 6},
{Dimension::dynamic(), 1},
{Dimension::dynamic()}};
shape_infer(this, input_shapes, output_shapes, true, true);
set_output_type(0, get_input_element_type(0), output_shapes[0]);
set_output_type(1, output_type, output_shapes[1]);
const auto& output_type = get_attrs().output_type;
set_output_type(0, get_input_element_type(0), output_shapes[0].get_max_shape());
set_output_type(1, output_type, output_shapes[1].get_max_shape());
set_output_type(2, output_type, output_shapes[2]);
}