Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

Revert "Add stable parameter for topk" (#33646)

Denis Orlov43018d2c33bb
diff --git a/src/frontends/onnx/frontend/src/op/topk.cpp b/src/frontends/onnx/frontend/src/op/topk.cpp
index 24d915a5a58..a6f3fde00aa 100644
--- a/src/frontends/onnx/frontend/src/op/topk.cpp
+++ b/src/frontends/onnx/frontend/src/op/topk.cpp
@@ -38,8 +38,7 @@ ov::OutputVector topk(const ov::frontend::onnx::Node& node) {
axis,
v11::TopK::Mode::MAX,
v11::TopK::SortType::SORT_VALUES,
- ov::element::i64,
- true);
+ ov::element::i64);
return {top_k->output(0), top_k->output(1)};
}
@@ -57,8 +56,7 @@ ov::OutputVector topk(const ov::frontend::onnx::Node& node) {
axis,
v11::TopK::Mode::MAX,
v11::TopK::SortType::SORT_VALUES,
- ov::element::i64,
- true);
+ ov::element::i64);
return {top_k->output(0), top_k->output(1)};
}
@@ -78,13 +76,11 @@ ov::OutputVector topk(const ov::frontend::onnx::Node& node) {
// Map attribute values to OpenVINO enums
const auto sort_type = sorted ? v11::TopK::SortType::SORT_VALUES : v11::TopK::SortType::NONE;
- const auto stable_sort = (sort_type != v11::TopK::SortType::NONE);
const auto compute_max = static_cast<bool>(largest);
const auto mode = compute_max ? v11::TopK::Mode::MAX : v11::TopK::Mode::MIN;
- std::shared_ptr<ov::Node> top_k =
- std::make_shared<v11::TopK>(data, k, axis, mode, sort_type, ov::element::i64, stable_sort);
+ std::shared_ptr<ov::Node> top_k = std::make_shared<v11::TopK>(data, k, axis, mode, sort_type, ov::element::i64);
return {top_k->output(0), top_k->output(1)};
}
diff --git a/src/frontends/onnx/tests/models/top_3_all_same.prototxt b/src/frontends/onnx/tests/models/top_3_all_same.prototxt
deleted file mode 100644
index f003a21e6d2..00000000000
--- a/src/frontends/onnx/tests/models/top_3_all_same.prototxt
+++ /dev/null
@@ -1,85 +0,0 @@
-ir_version: 12
-producer_name: ""
-producer_version: ""
-model_version: 0
-graph {
- name: "test"
- node {
- input: "X"
- input: "K"
- output: "Values"
- output: "Indices"
- name: "node1"
- op_type: "TopK"
- attribute {
- name: "axis"
- i: -1
- type: INT
- }
- doc_string: "TopK"
- }
- input {
- name: "X"
- type {
- tensor_type {
- elem_type: 1
- shape {
- dim {
- dim_value: 2
- }
- dim {
- dim_value: 4
- }
- }
- }
- }
- }
- input {
- name: "K"
- type {
- tensor_type {
- elem_type: 7
- shape {
- dim {
- dim_value: 1
- }
- }
- }
- }
- }
- output {
- name: "Values"
- type {
- tensor_type {
- elem_type: 1
- shape {
- dim {
- dim_value: 2
- }
- dim {
- dim_value: 3
- }
- }
- }
- }
- }
- output {
- name: "Indices"
- type {
- tensor_type {
- elem_type: 7
- shape {
- dim {
- dim_value: 2
- }
- dim {
- dim_value: 3
- }
- }
- }
- }
- }
-}
-opset_import {
- version: 10
-}
diff --git a/src/frontends/onnx/tests/onnx_import.in.cpp b/src/frontends/onnx/tests/onnx_import.in.cpp
index a90a5f99c9f..ff739822f71 100644
--- a/src/frontends/onnx/tests/onnx_import.in.cpp
+++ b/src/frontends/onnx/tests/onnx_import.in.cpp
@@ -2907,18 +2907,6 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_top_k_repeating_unsorted) {
test_case.run();
}
-OPENVINO_TEST(${BACKEND_NAME}, onnx_model_top_3_all_same) {
- auto model = convert_model("top_3_all_same.onnx");
-
- auto test_case = ov::test::TestCase(model, s_device);
- test_case.add_input<float>(Shape{2, 4}, {0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f});
- test_case.add_input<int64_t>({3});
-
- test_case.add_expected_output<float>(Shape{2, 3}, {0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f});
- test_case.add_expected_output<int64_t>(Shape{2, 3}, {0, 1, 2, 0, 1, 2});
- test_case.run();
-}
-
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_acosh) {
auto model = convert_model("acosh.onnx");