From fee68c066c9401e015b48d72105afe1ac89ed266 Mon Sep 17 00:00:00 2001 From: Georgy Krivoruchko Date: Thu, 25 Jan 2024 02:19:37 -0800 Subject: [PATCH 1/2] Refactoring operations Q-R (#22383) --- .../onnx/frontend/src/op/qlinear_conv.cpp | 16 ++- .../onnx/frontend/src/op/qlinear_conv.hpp | 5 +- .../onnx/frontend/src/op/qlinear_matmul.cpp | 10 +- .../onnx/frontend/src/op/qlinear_matmul.hpp | 3 +- .../onnx/frontend/src/op/quant_conv.hpp | 1 - .../onnx/frontend/src/op/quantize_linear.cpp | 105 ++++++++---------- .../onnx/frontend/src/op/quantize_linear.hpp | 8 +- .../onnx/frontend/src/op/random_normal.cpp | 9 +- .../onnx/frontend/src/op/random_normal.hpp | 1 - .../frontend/src/op/random_normal_like.cpp | 14 ++- .../frontend/src/op/random_normal_like.hpp | 1 - .../onnx/frontend/src/op/random_uniform.cpp | 18 +-- .../onnx/frontend/src/op/random_uniform.hpp | 1 - .../frontend/src/op/random_uniform_like.cpp | 21 ++-- .../frontend/src/op/random_uniform_like.hpp | 1 - src/frontends/onnx/frontend/src/op/range.cpp | 27 +++-- src/frontends/onnx/frontend/src/op/range.hpp | 3 - .../onnx/frontend/src/op/reciprocal.cpp | 10 +- .../onnx/frontend/src/op/reciprocal.hpp | 1 - src/frontends/onnx/frontend/src/op/reduce.cpp | 86 +++++++------- src/frontends/onnx/frontend/src/op/reduce.hpp | 22 ++-- src/frontends/onnx/frontend/src/op/relu.hpp | 7 +- .../onnx/frontend/src/op/reshape.cpp | 14 +-- .../onnx/frontend/src/op/reshape.hpp | 3 +- src/frontends/onnx/frontend/src/op/resize.cpp | 27 +++-- src/frontends/onnx/frontend/src/op/resize.hpp | 1 - .../onnx/frontend/src/op/reverse_sequence.cpp | 26 ++--- .../onnx/frontend/src/op/reverse_sequence.hpp | 1 - src/frontends/onnx/frontend/src/op/rnn.cpp | 30 ++--- src/frontends/onnx/frontend/src/op/rnn.hpp | 1 - .../onnx/frontend/src/op/roi_align.cpp | 52 ++++----- .../onnx/frontend/src/op/roi_align.hpp | 1 - src/frontends/onnx/frontend/src/op/round.cpp | 7 +- src/frontends/onnx/frontend/src/op/round.hpp | 1 - 34 files changed, 253 insertions(+), 281 deletions(-) diff --git a/src/frontends/onnx/frontend/src/op/qlinear_conv.cpp b/src/frontends/onnx/frontend/src/op/qlinear_conv.cpp index 91dd6ff10f4440..7f7f16d5b2ad34 100644 --- a/src/frontends/onnx/frontend/src/op/qlinear_conv.cpp +++ b/src/frontends/onnx/frontend/src/op/qlinear_conv.cpp @@ -7,10 +7,6 @@ #include "op/qlinear_conv.hpp" -#include -#include -#include - #include "conv.hpp" #include "dequantize_linear.hpp" #include "exceptions.hpp" @@ -19,6 +15,8 @@ #include "openvino/op/multiply.hpp" #include "quantize_linear.hpp" +using namespace ov::op; + OPENVINO_SUPPRESS_DEPRECATED_START namespace ngraph { namespace onnx_import { @@ -35,22 +33,22 @@ OutputVector qlinear_conv(const Node& node) { auto w_zero_point = inputs.at(5); auto y_scale = inputs.at(6); auto y_zero_point = inputs.at(7); - Output B = inputs.size() > 8 ? inputs.at(8) : std::make_shared()->output(0); + Output B = inputs.size() > 8 ? inputs.at(8) : std::make_shared()->output(0); x = set_13::detail::dequantize_linear(x, x_scale, - std::make_shared(x_zero_point, element::f32), + std::make_shared(x_zero_point, element::f32), 1, node)[0]; w = set_13::detail::dequantize_linear(w, w_scale, - std::make_shared(w_zero_point, element::f32), + std::make_shared(w_zero_point, element::f32), 1, node)[0]; if (!ov::op::util::is_null(B)) { - B = std::make_shared(std::make_shared(B, x_scale.get_element_type()), - std::make_shared(x_scale, w_scale)) + B = std::make_shared(std::make_shared(B, x_scale.get_element_type()), + std::make_shared(x_scale, w_scale)) ->output(0); } diff --git a/src/frontends/onnx/frontend/src/op/qlinear_conv.hpp b/src/frontends/onnx/frontend/src/op/qlinear_conv.hpp index 116f4b082fd961..e53ee621c2bc32 100644 --- a/src/frontends/onnx/frontend/src/op/qlinear_conv.hpp +++ b/src/frontends/onnx/frontend/src/op/qlinear_conv.hpp @@ -10,7 +10,6 @@ #include "openvino/core/deprecated.hpp" OPENVINO_SUPPRESS_DEPRECATED_START -#include "ngraph/node.hpp" #include "onnx_import/core/node.hpp" namespace ngraph { @@ -21,14 +20,12 @@ namespace set_1 { /// /// \param node The ONNX node object representing this operation. /// -/// \return The vector containing Ngraph nodes producing output of ONNX quantizied +/// \return The vector containing OV nodes producing output of ONNX quantizied /// convolution operation. OutputVector qlinear_conv(const Node& node); } // namespace set_1 - } // namespace op - } // namespace onnx_import } // namespace ngraph diff --git a/src/frontends/onnx/frontend/src/op/qlinear_matmul.cpp b/src/frontends/onnx/frontend/src/op/qlinear_matmul.cpp index 67dde8b5b8908a..04ed16c3d68a0c 100644 --- a/src/frontends/onnx/frontend/src/op/qlinear_matmul.cpp +++ b/src/frontends/onnx/frontend/src/op/qlinear_matmul.cpp @@ -4,16 +4,14 @@ #include "op/qlinear_matmul.hpp" -#include -#include -#include - #include "dequantize_linear.hpp" #include "matmul.hpp" #include "openvino/op/convert.hpp" #include "quantize_linear.hpp" #include "utils/reshape.hpp" +using namespace ov::op; + OPENVINO_SUPPRESS_DEPRECATED_START namespace ngraph { namespace onnx_import { @@ -34,13 +32,13 @@ OutputVector qlinear_matmul(const Node& node) { const auto& dequnatize_a = set_13::detail::dequantize_linear(a, a_scale, - std::make_shared(a_zero_point, element::f32), + std::make_shared(a_zero_point, element::f32), 1, node); const auto& dequnatize_b = set_13::detail::dequantize_linear(b, b_scale, - std::make_shared(b_zero_point, element::f32), + std::make_shared(b_zero_point, element::f32), 1, node); diff --git a/src/frontends/onnx/frontend/src/op/qlinear_matmul.hpp b/src/frontends/onnx/frontend/src/op/qlinear_matmul.hpp index 37b9a49b4e8c11..a25236a0833ab9 100644 --- a/src/frontends/onnx/frontend/src/op/qlinear_matmul.hpp +++ b/src/frontends/onnx/frontend/src/op/qlinear_matmul.hpp @@ -7,7 +7,6 @@ #include "openvino/core/deprecated.hpp" OPENVINO_SUPPRESS_DEPRECATED_START -#include "ngraph/node.hpp" #include "onnx_import/core/node.hpp" namespace ngraph { @@ -18,7 +17,7 @@ namespace set_1 { /// /// \param node The ONNX node object representing this operation. /// -/// \return The vector containing Ngraph nodes producing output of ONNX quantizied +/// \return The vector containing OV nodes producing output of ONNX quantizied /// matrix multiplication operation. OutputVector qlinear_matmul(const Node& node); } // namespace set_1 diff --git a/src/frontends/onnx/frontend/src/op/quant_conv.hpp b/src/frontends/onnx/frontend/src/op/quant_conv.hpp index 69f95fe1cafee2..b8063f685e5f44 100644 --- a/src/frontends/onnx/frontend/src/op/quant_conv.hpp +++ b/src/frontends/onnx/frontend/src/op/quant_conv.hpp @@ -10,7 +10,6 @@ #include "openvino/core/deprecated.hpp" OPENVINO_SUPPRESS_DEPRECATED_START -#include "ngraph/node.hpp" #include "onnx_import/core/node.hpp" namespace ngraph { diff --git a/src/frontends/onnx/frontend/src/op/quantize_linear.cpp b/src/frontends/onnx/frontend/src/op/quantize_linear.cpp index d1a117ebf88cba..19cb20ad3294f1 100644 --- a/src/frontends/onnx/frontend/src/op/quantize_linear.cpp +++ b/src/frontends/onnx/frontend/src/op/quantize_linear.cpp @@ -4,36 +4,34 @@ #include "op/quantize_linear.hpp" -#include -#include -#include -#include - -#include "default_opset.hpp" #include "exceptions.hpp" -#include "ngraph/axis_set.hpp" -#include "ngraph/shape.hpp" -#include "ngraph/type/element_type.hpp" -#include "ngraph/validation_util.hpp" +#include "openvino/core/validation_util.hpp" #include "openvino/frontend/exception.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/convert.hpp" +#include "openvino/op/fake_quantize.hpp" +#include "openvino/op/multiply.hpp" +#include "openvino/op/subtract.hpp" #include "ov_models/ov_builders/reshape.hpp" #include "utils/reshape.hpp" +using namespace ov::op; + OPENVINO_SUPPRESS_DEPRECATED_START namespace ngraph { namespace onnx_import { namespace op { namespace detail { namespace { -Output get_zero_point(const OutputVector& inputs) { +Output get_zero_point(const OutputVector& inputs) { if (inputs.size() > 2) { return inputs.at(2); } else { - return std::make_shared(element::u8, Shape{1}, std::uint8_t(0)); + return std::make_shared(element::u8, Shape{1}, std::uint8_t(0)); } } -void validate_zero_point_type(const Node& onnx_node, const Output& y_zero_point) { +void validate_zero_point_type(const Node& onnx_node, const Output& y_zero_point) { const auto& y_zero_point_et = y_zero_point.get_element_type(); CHECK_VALID_NODE( onnx_node, @@ -43,49 +41,48 @@ void validate_zero_point_type(const Node& onnx_node, const Output& "integer type."); } -Output validate_scale(const Node& onnx_node, const Output& y_scale) { +Output validate_scale(const Node& onnx_node, const Output& y_scale) { const auto& y_scale_et = y_scale.get_element_type(); CHECK_VALID_NODE(onnx_node, y_scale_et.is_static(), "\"y_scale\" input data type must be static."); if (y_scale_et != element::f32) { - return std::make_shared(y_scale, element::f32); + return std::make_shared(y_scale, element::f32); } return y_scale; } -Output validate_data(const Node& onnx_node, const Output& data) { +Output validate_data(const Node& onnx_node, const Output& data) { const auto& data_et = data.get_element_type(); CHECK_VALID_NODE(onnx_node, data_et.is_static(), "\"x\" input data type must be static."); if (data_et != element::f32) { - return std::make_shared(data, element::f32); + return std::make_shared(data, element::f32); } return data; } -std::tuple, std::shared_ptr> get_output_bands( - const element::Type& destination_type, - const element::Type& data_type) { - std::shared_ptr output_low; - std::shared_ptr output_high; +std::tuple, std::shared_ptr> get_output_bands(const element::Type& destination_type, + const element::Type& data_type) { + std::shared_ptr output_low; + std::shared_ptr output_high; // These values could be used in a ConvertQuantizeDequantize transformation and // should be aligned switch (destination_type) { case element::i8: - output_low = std::make_shared(data_type, Shape{1}, -128); - output_high = std::make_shared(data_type, Shape{1}, 127); + output_low = std::make_shared(data_type, Shape{1}, -128); + output_high = std::make_shared(data_type, Shape{1}, 127); break; case element::u8: - output_low = std::make_shared(data_type, Shape{1}, 0); - output_high = std::make_shared(data_type, Shape{1}, 255); + output_low = std::make_shared(data_type, Shape{1}, 0); + output_high = std::make_shared(data_type, Shape{1}, 255); break; case element::i16: - output_low = std::make_shared(data_type, Shape{1}, -32768); - output_high = std::make_shared(data_type, Shape{1}, 32767); + output_low = std::make_shared(data_type, Shape{1}, -32768); + output_high = std::make_shared(data_type, Shape{1}, 32767); break; case element::u16: - output_low = std::make_shared(data_type, Shape{1}, 0); - output_high = std::make_shared(data_type, Shape{1}, 65535); + output_low = std::make_shared(data_type, Shape{1}, 0); + output_high = std::make_shared(data_type, Shape{1}, 65535); break; default: OPENVINO_THROW("Unsupported element type for QuantizeLinear"); @@ -95,27 +92,23 @@ std::tuple, std::shared_ptr> get_out return std::make_tuple(output_low, output_high); } -std::tuple, std::shared_ptr> get_input_bands( - const Output& y_scale, - const Output& y_zero_point, - const std::shared_ptr& output_low, - const std::shared_ptr& output_high, +std::tuple, std::shared_ptr> get_input_bands( + const Output& y_scale, + const Output& y_zero_point, + const std::shared_ptr& output_low, + const std::shared_ptr& output_high, const element::Type& data_type) { - std::shared_ptr input_low; - std::shared_ptr input_high; - const auto& zero_point = std::make_shared(y_zero_point, data_type); + std::shared_ptr input_low; + std::shared_ptr input_high; + const auto& zero_point = std::make_shared(y_zero_point, data_type); - input_low = - std::make_shared(y_scale, - std::make_shared(output_low, zero_point)); + input_low = std::make_shared(y_scale, std::make_shared(output_low, zero_point)); OPENVINO_SUPPRESS_DEPRECATED_START if (auto constant = ov::get_constant_from_source(input_low)) { OPENVINO_SUPPRESS_DEPRECATED_END input_low = constant; } - input_high = - std::make_shared(y_scale, - std::make_shared(output_high, zero_point)); + input_high = std::make_shared(y_scale, std::make_shared(output_high, zero_point)); OPENVINO_SUPPRESS_DEPRECATED_START if (auto constant = ov::get_constant_from_source(input_high)) { OPENVINO_SUPPRESS_DEPRECATED_END @@ -125,25 +118,25 @@ std::tuple, std::shared_ptr> get_inp return std::make_tuple(input_low, input_high); } } // namespace -std::shared_ptr make_fake_quantize(const Output& y_scale, - const Output& y_zero_point, - const Output& data) { +std::shared_ptr make_fake_quantize(const Output& y_scale, + const Output& y_zero_point, + const Output& data) { const element::Type& destination_type = y_zero_point.get_element_type(); const element::Type& data_type = data.get_element_type(); - std::shared_ptr output_low; - std::shared_ptr output_high; + std::shared_ptr output_low; + std::shared_ptr output_high; std::tie(output_low, output_high) = detail::get_output_bands(destination_type, data_type); - std::shared_ptr input_low; - std::shared_ptr input_high; + std::shared_ptr input_low; + std::shared_ptr input_high; std::tie(input_low, input_high) = detail::get_input_bands(y_scale, y_zero_point, output_low, output_high, data_type); const std::size_t levels = static_cast(1) << destination_type.bitwidth(); - return std::make_shared( - std::make_shared(data, input_low, input_high, output_low, output_high, levels), + return std::make_shared( + std::make_shared(data, input_low, input_high, output_low, output_high, levels), destination_type); } } // namespace detail @@ -165,9 +158,9 @@ OutputVector quantize_linear(const Node& node) { namespace set_13 { namespace { -OutputVector quantize_linear(Output x, - Output y_scale, - Output y_zero_point, +OutputVector quantize_linear(Output x, + Output y_scale, + Output y_zero_point, int64_t axis, Node node) { namespace detail = ngraph::onnx_import::op::detail; diff --git a/src/frontends/onnx/frontend/src/op/quantize_linear.hpp b/src/frontends/onnx/frontend/src/op/quantize_linear.hpp index 01c52db094dc7c..7ad9df7406869f 100644 --- a/src/frontends/onnx/frontend/src/op/quantize_linear.hpp +++ b/src/frontends/onnx/frontend/src/op/quantize_linear.hpp @@ -7,16 +7,16 @@ #include "openvino/core/deprecated.hpp" OPENVINO_SUPPRESS_DEPRECATED_START -#include "ngraph/node.hpp" #include "onnx_import/core/node.hpp" +#include "openvino/core/node.hpp" namespace ngraph { namespace onnx_import { namespace op { namespace detail { -std::shared_ptr make_fake_quantize(const Output& y_scale, - const Output& y_zero_point, - const Output& data); +std::shared_ptr make_fake_quantize(const Output& y_scale, + const Output& y_zero_point, + const Output& data); } namespace set_1 { OutputVector quantize_linear(const Node& node); diff --git a/src/frontends/onnx/frontend/src/op/random_normal.cpp b/src/frontends/onnx/frontend/src/op/random_normal.cpp index 426311f0253d99..55bd4559d90b43 100644 --- a/src/frontends/onnx/frontend/src/op/random_normal.cpp +++ b/src/frontends/onnx/frontend/src/op/random_normal.cpp @@ -2,12 +2,15 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "op/random_normal.hpp" + #include "exceptions.hpp" -#include "ngraph/shape.hpp" #include "openvino/frontend/common/random_normal_helper.hpp" #include "openvino/op/constant.hpp" #include "utils/common.hpp" +using namespace ov::op; + OPENVINO_SUPPRESS_DEPRECATED_START namespace ngraph { namespace onnx_import { @@ -23,8 +26,8 @@ OutputVector random_normal(const Node& node) { const auto mean = node.get_attribute_value("mean", 0.0f); const auto scale = node.get_attribute_value("scale", 1.0f); - auto scale_node = ov::op::v0::Constant::create(target_type, Shape{1}, {scale}); - auto mean_node = ov::op::v0::Constant::create(target_type, Shape{1}, {mean}); + auto scale_node = v0::Constant::create(target_type, Shape{1}, {scale}); + auto mean_node = v0::Constant::create(target_type, Shape{1}, {mean}); const auto seed = node.get_attribute_value("seed", 0); const auto shape = node.get_attribute_as_constant>("shape"); diff --git a/src/frontends/onnx/frontend/src/op/random_normal.hpp b/src/frontends/onnx/frontend/src/op/random_normal.hpp index 453c65a3da4166..961d4280576155 100644 --- a/src/frontends/onnx/frontend/src/op/random_normal.hpp +++ b/src/frontends/onnx/frontend/src/op/random_normal.hpp @@ -7,7 +7,6 @@ #include "openvino/core/deprecated.hpp" OPENVINO_SUPPRESS_DEPRECATED_START -#include "ngraph/node.hpp" #include "onnx_import/core/node.hpp" namespace ngraph { diff --git a/src/frontends/onnx/frontend/src/op/random_normal_like.cpp b/src/frontends/onnx/frontend/src/op/random_normal_like.cpp index a9ecaf39a9c50a..fa70cce245c8de 100644 --- a/src/frontends/onnx/frontend/src/op/random_normal_like.cpp +++ b/src/frontends/onnx/frontend/src/op/random_normal_like.cpp @@ -2,12 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "ngraph/shape.hpp" -#include "op/random_uniform_like.hpp" +#include "op/random_normal_like.hpp" + #include "openvino/frontend/common/random_normal_helper.hpp" #include "openvino/op/shape_of.hpp" #include "utils/common.hpp" +using namespace ov::op; + OPENVINO_SUPPRESS_DEPRECATED_START namespace ngraph { namespace onnx_import { @@ -17,7 +19,7 @@ namespace set_1 { OutputVector random_normal_like(const Node& node) { const auto input = node.get_ng_inputs().at(0); - ngraph::element::Type target_type; + ov::element::Type target_type; if (node.has_attribute("dtype")) { const auto dtype = node.get_attribute_value("dtype"); target_type = common::get_ov_element_type(dtype); @@ -25,13 +27,13 @@ OutputVector random_normal_like(const Node& node) { target_type = input.get_element_type(); } - const auto shape = std::make_shared(input); + const auto shape = std::make_shared(input); const auto seed = node.get_attribute_value("seed", 0.0f); const auto mean = node.get_attribute_value("mean", 0.0f); const auto scale = node.get_attribute_value("scale", 1.0f); - auto scale_node = ov::op::v0::Constant::create(target_type, Shape{1}, {scale}); - auto mean_node = ov::op::v0::Constant::create(target_type, Shape{1}, {mean}); + auto scale_node = v0::Constant::create(target_type, Shape{1}, {scale}); + auto mean_node = v0::Constant::create(target_type, Shape{1}, {mean}); auto res = ov::frontend::make_random_normal(shape, target_type, mean_node, scale_node, seed); return res.first; diff --git a/src/frontends/onnx/frontend/src/op/random_normal_like.hpp b/src/frontends/onnx/frontend/src/op/random_normal_like.hpp index 71ccb3bae632af..d3d6c8e8d3925c 100644 --- a/src/frontends/onnx/frontend/src/op/random_normal_like.hpp +++ b/src/frontends/onnx/frontend/src/op/random_normal_like.hpp @@ -7,7 +7,6 @@ #include "openvino/core/deprecated.hpp" OPENVINO_SUPPRESS_DEPRECATED_START -#include "ngraph/node.hpp" #include "onnx_import/core/node.hpp" namespace ngraph { diff --git a/src/frontends/onnx/frontend/src/op/random_uniform.cpp b/src/frontends/onnx/frontend/src/op/random_uniform.cpp index 408c2e8ab4fe60..9a99b0a17914ce 100644 --- a/src/frontends/onnx/frontend/src/op/random_uniform.cpp +++ b/src/frontends/onnx/frontend/src/op/random_uniform.cpp @@ -4,12 +4,12 @@ #include "op/random_uniform.hpp" -#include "default_opset.hpp" #include "exceptions.hpp" -#include "ngraph/shape.hpp" -#include "openvino/opsets/opset8.hpp" +#include "openvino/op/random_uniform.hpp" #include "utils/common.hpp" +using namespace ov::op; + OPENVINO_SUPPRESS_DEPRECATED_START namespace ngraph { namespace onnx_import { @@ -31,12 +31,12 @@ OutputVector random_uniform(const Node& node) { // TODO: This multiplication leads to a mismatch in accuracy. Issue: 123003 const auto seed_uint64 = static_cast(seed * 1000); - return {std::make_shared(target_shape_const, - low_const, - high_const, - target_type, - global_seed, - seed_uint64)}; + return {std::make_shared(target_shape_const, + low_const, + high_const, + target_type, + global_seed, + seed_uint64)}; } } // namespace set_1 diff --git a/src/frontends/onnx/frontend/src/op/random_uniform.hpp b/src/frontends/onnx/frontend/src/op/random_uniform.hpp index ed92b2294baddf..9306d537ddde8c 100644 --- a/src/frontends/onnx/frontend/src/op/random_uniform.hpp +++ b/src/frontends/onnx/frontend/src/op/random_uniform.hpp @@ -7,7 +7,6 @@ #include "openvino/core/deprecated.hpp" OPENVINO_SUPPRESS_DEPRECATED_START -#include "ngraph/node.hpp" #include "onnx_import/core/node.hpp" namespace ngraph { diff --git a/src/frontends/onnx/frontend/src/op/random_uniform_like.cpp b/src/frontends/onnx/frontend/src/op/random_uniform_like.cpp index 0537d141ea3520..e0fc1cb1f6b678 100644 --- a/src/frontends/onnx/frontend/src/op/random_uniform_like.cpp +++ b/src/frontends/onnx/frontend/src/op/random_uniform_like.cpp @@ -4,12 +4,13 @@ #include "op/random_uniform_like.hpp" -#include "default_opset.hpp" #include "exceptions.hpp" -#include "ngraph/shape.hpp" #include "openvino/op/random_uniform.hpp" +#include "openvino/op/shape_of.hpp" #include "utils/common.hpp" +using namespace ov::op; + OPENVINO_SUPPRESS_DEPRECATED_START namespace ngraph { namespace onnx_import { @@ -20,7 +21,7 @@ OutputVector random_uniform_like(const Node& node) { OutputVector inputs{node.get_ng_inputs()}; const auto input = inputs.at(0); - ngraph::element::Type target_type; + ov::element::Type target_type; if (node.has_attribute("dtype")) { const auto dtype = node.get_attribute_value("dtype"); target_type = common::get_ov_element_type(dtype); @@ -28,7 +29,7 @@ OutputVector random_uniform_like(const Node& node) { target_type = input.get_element_type(); } - const auto target_shape = std::make_shared(input); + const auto target_shape = std::make_shared(input); const auto high_const = node.get_attribute_as_constant("high", 1.0f); const auto low_const = node.get_attribute_as_constant("low", 0.0f); @@ -37,12 +38,12 @@ OutputVector random_uniform_like(const Node& node) { const uint64_t global_seed = 0; const auto seed_uint64 = static_cast(seed * 1000); - return {std::make_shared(target_shape, - low_const, - high_const, - target_type, - global_seed, - seed_uint64)}; + return {std::make_shared(target_shape, + low_const, + high_const, + target_type, + global_seed, + seed_uint64)}; } } // namespace set_1 diff --git a/src/frontends/onnx/frontend/src/op/random_uniform_like.hpp b/src/frontends/onnx/frontend/src/op/random_uniform_like.hpp index eb4b8fcc1d6762..8385b7dba20518 100644 --- a/src/frontends/onnx/frontend/src/op/random_uniform_like.hpp +++ b/src/frontends/onnx/frontend/src/op/random_uniform_like.hpp @@ -7,7 +7,6 @@ #include "openvino/core/deprecated.hpp" OPENVINO_SUPPRESS_DEPRECATED_START -#include "ngraph/node.hpp" #include "onnx_import/core/node.hpp" namespace ngraph { diff --git a/src/frontends/onnx/frontend/src/op/range.cpp b/src/frontends/onnx/frontend/src/op/range.cpp index 14767584c1532b..eb44a54d7530dd 100644 --- a/src/frontends/onnx/frontend/src/op/range.cpp +++ b/src/frontends/onnx/frontend/src/op/range.cpp @@ -4,10 +4,11 @@ #include "op/range.hpp" -#include - -#include "default_opset.hpp" #include "exceptions.hpp" +#include "openvino/op/range.hpp" +#include "openvino/op/squeeze.hpp" + +using namespace ov::op; OPENVINO_SUPPRESS_DEPRECATED_START namespace ngraph { @@ -18,32 +19,30 @@ OutputVector range(const Node& node) { const auto inputs = node.get_ng_inputs(); CHECK_VALID_NODE(node, inputs.size() >= 3, "Minimum 3 inputs are required. Got: ", inputs.size()); - Output start{inputs[0]}; - Output stop{inputs[1]}; - Output step{inputs[2]}; + Output start{inputs[0]}; + Output stop{inputs[1]}; + Output step{inputs[2]}; - auto axes = - std::make_shared(ngraph::element::i64, ngraph::Shape{}, std::vector{0}); + auto axes = std::make_shared(ov::element::i64, ov::Shape{}, std::vector{0}); // Check if step is a tensor with a single value if (start.get_shape().size() == 1 && start.get_shape()[0] == 1) { - start = std::make_shared(start, axes); + start = std::make_shared(start, axes); } if (stop.get_shape().size() == 1 && stop.get_shape()[0] == 1) { - stop = std::make_shared(stop, axes); + stop = std::make_shared(stop, axes); } if (step.get_shape().size() == 1 && step.get_shape()[0] == 1) { - step = std::make_shared(step, axes); + step = std::make_shared(step, axes); } - return {std::make_shared(start, stop, step, start.get_element_type())}; + return {std::make_shared(start, stop, step, start.get_element_type())}; } -} // namespace set_1 +} // namespace set_1 } // namespace op - } // namespace onnx_import } // namespace ngraph diff --git a/src/frontends/onnx/frontend/src/op/range.hpp b/src/frontends/onnx/frontend/src/op/range.hpp index 0e9bb540c5729d..abbe24aece1d9a 100644 --- a/src/frontends/onnx/frontend/src/op/range.hpp +++ b/src/frontends/onnx/frontend/src/op/range.hpp @@ -7,7 +7,6 @@ #include "openvino/core/deprecated.hpp" OPENVINO_SUPPRESS_DEPRECATED_START -#include "ngraph/node.hpp" #include "onnx_import/core/node.hpp" namespace ngraph { @@ -17,9 +16,7 @@ namespace set_1 { OutputVector range(const Node& node); } // namespace set_1 - } // namespace op - } // namespace onnx_import } // namespace ngraph diff --git a/src/frontends/onnx/frontend/src/op/reciprocal.cpp b/src/frontends/onnx/frontend/src/op/reciprocal.cpp index ab530c0cdb6dc1..a1ec5a04d7d764 100644 --- a/src/frontends/onnx/frontend/src/op/reciprocal.cpp +++ b/src/frontends/onnx/frontend/src/op/reciprocal.cpp @@ -4,10 +4,10 @@ #include "op/reciprocal.hpp" -#include -#include +#include "openvino/op/constant.hpp" +#include "openvino/op/divide.hpp" -#include "default_opset.hpp" +using namespace ov::op; OPENVINO_SUPPRESS_DEPRECATED_START namespace ngraph { @@ -17,8 +17,8 @@ namespace set_1 { OutputVector reciprocal(const Node& node) { auto data = node.get_ng_inputs().at(0); - auto one_node = default_opset::Constant::create(data.get_element_type(), Shape{}, {1}); - return {std::make_shared(one_node, data)}; + auto one_node = v0::Constant::create(data.get_element_type(), Shape{}, {1}); + return {std::make_shared(one_node, data)}; } } // namespace set_1 diff --git a/src/frontends/onnx/frontend/src/op/reciprocal.hpp b/src/frontends/onnx/frontend/src/op/reciprocal.hpp index ef163f711714de..31e473322c6df1 100644 --- a/src/frontends/onnx/frontend/src/op/reciprocal.hpp +++ b/src/frontends/onnx/frontend/src/op/reciprocal.hpp @@ -7,7 +7,6 @@ #include "openvino/core/deprecated.hpp" OPENVINO_SUPPRESS_DEPRECATED_START -#include "ngraph/node.hpp" #include "onnx_import/core/node.hpp" namespace ngraph { diff --git a/src/frontends/onnx/frontend/src/op/reduce.cpp b/src/frontends/onnx/frontend/src/op/reduce.cpp index ad6fca92ac252e..c8231ef5d8b3e1 100644 --- a/src/frontends/onnx/frontend/src/op/reduce.cpp +++ b/src/frontends/onnx/frontend/src/op/reduce.cpp @@ -4,33 +4,44 @@ #include "op/reduce.hpp" -#include -#include - -#include "default_opset.hpp" #include "exceptions.hpp" -#include "ngraph/node.hpp" -#include "op/identity.hpp" +#include "identity.hpp" #include "openvino/frontend/exception.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/exp.hpp" +#include "openvino/op/log.hpp" +#include "openvino/op/multiply.hpp" +#include "openvino/op/range.hpp" +#include "openvino/op/reduce_l1.hpp" +#include "openvino/op/reduce_l2.hpp" +#include "openvino/op/reduce_max.hpp" +#include "openvino/op/reduce_mean.hpp" +#include "openvino/op/reduce_min.hpp" +#include "openvino/op/reduce_prod.hpp" +#include "openvino/op/reduce_sum.hpp" +#include "openvino/op/shape_of.hpp" +#include "openvino/op/squeeze.hpp" #include "utils/common.hpp" +using namespace ov::op; + OPENVINO_SUPPRESS_DEPRECATED_START namespace ngraph { namespace onnx_import { namespace op { namespace { -std::shared_ptr get_dynamic_all_axes_range(const Node& node) { +std::shared_ptr get_dynamic_all_axes_range(const Node& node) { const auto input = node.get_ng_inputs().at(0); - const auto shape_of_input = std::make_shared(input); - const auto scalar = default_opset::Constant::create(element::i32, Shape{1}, {0}); - const auto rank_of_input = std::make_shared(shape_of_input); - const auto rank_of_input_scalar = std::make_shared(rank_of_input, scalar); - const auto start = default_opset::Constant::create(element::i32, Shape{}, {0}); - const auto step = default_opset::Constant::create(element::i32, Shape{}, {1}); - return std::make_shared(start, rank_of_input_scalar, step, element::i64); + const auto shape_of_input = std::make_shared(input); + const auto scalar = v0::Constant::create(element::i32, Shape{1}, {0}); + const auto rank_of_input = std::make_shared(shape_of_input); + const auto rank_of_input_scalar = std::make_shared(rank_of_input, scalar); + const auto start = v0::Constant::create(element::i32, Shape{}, {0}); + const auto step = v0::Constant::create(element::i32, Shape{}, {1}); + return std::make_shared(start, rank_of_input_scalar, step, element::i64); } -std::shared_ptr get_reduction_axes_from_input(const Node& node) { +std::shared_ptr get_reduction_axes_from_input(const Node& node) { const std::int64_t noop_with_empty_axes = node.get_attribute_value("noop_with_empty_axes", 0); const auto input = node.get_ng_inputs().at(0); if (node.get_ng_inputs().size() > 1) { @@ -52,7 +63,7 @@ std::shared_ptr get_reduction_axes_from_input(const Node& node) { } } -std::shared_ptr get_reduction_axes_from_attr(const Node& node) { +std::shared_ptr get_reduction_axes_from_attr(const Node& node) { auto reduction_axes = node.get_attribute_value>("axes", {}); const auto input_rank = node.get_ng_inputs().at(0).get_partial_shape().rank(); @@ -75,75 +86,74 @@ std::shared_ptr get_reduction_axes_from_attr(const Node& node) { ")"); } - return default_opset::Constant::create(element::i64, Shape{reduction_axes.size()}, reduction_axes); + return v0::Constant::create(element::i64, Shape{reduction_axes.size()}, reduction_axes); } template -std::shared_ptr make_ng_reduction_op(const Node& node, - const Output& ng_input, - bool axes_as_attr = true) { +std::shared_ptr make_ng_reduction_op(const Node& node, + const Output& ng_input, + bool axes_as_attr = true) { const std::int64_t keepdims = node.get_attribute_value("keepdims", 1); const auto reduction_axes = axes_as_attr ? get_reduction_axes_from_attr(node) : get_reduction_axes_from_input(node); if (reduction_axes != nullptr) { return std::make_shared(ng_input, reduction_axes, static_cast(keepdims)); } else { - return op::set_1::identity(node).at(0).get_node_shared_ptr(); + return set_1::identity(node).at(0).get_node_shared_ptr(); } } } // namespace namespace set_13 { OutputVector reduce_sum(const Node& node) { - return {make_ng_reduction_op(node, node.get_ng_inputs().at(0), false)}; + return {make_ng_reduction_op(node, node.get_ng_inputs().at(0), false)}; } } // namespace set_13 namespace set_1 { OutputVector reduce_log_sum(const Node& node) { - const Output sum_node = - make_ng_reduction_op(node, node.get_ng_inputs().at(0)); - return {std::make_shared(sum_node)}; + const Output sum_node = make_ng_reduction_op(node, node.get_ng_inputs().at(0)); + return {std::make_shared(sum_node)}; } OutputVector reduce_log_sum_exp(const Node& node) { - const auto exp_node = std::make_shared(node.get_ng_inputs().at(0)); - const Output sum_node = make_ng_reduction_op(node, exp_node); - return {std::make_shared(sum_node)}; + const auto exp_node = std::make_shared(node.get_ng_inputs().at(0)); + const Output sum_node = make_ng_reduction_op(node, exp_node); + return {std::make_shared(sum_node)}; } OutputVector reduce_l1(const Node& node) { - return {make_ng_reduction_op(node, node.get_ng_inputs().at(0))}; + return {make_ng_reduction_op(node, node.get_ng_inputs().at(0))}; } OutputVector reduce_l2(const Node& node) { - return {make_ng_reduction_op(node, node.get_ng_inputs().at(0))}; + return {make_ng_reduction_op(node, node.get_ng_inputs().at(0))}; } OutputVector reduce_max(const Node& node) { - return {make_ng_reduction_op(node, node.get_ng_inputs().at(0))}; + return {make_ng_reduction_op(node, node.get_ng_inputs().at(0))}; } OutputVector reduce_mean(const Node& node) { - return {make_ng_reduction_op(node, node.get_ng_inputs().at(0))}; + return {make_ng_reduction_op(node, node.get_ng_inputs().at(0))}; } OutputVector reduce_min(const Node& node) { - return {make_ng_reduction_op(node, node.get_ng_inputs().at(0))}; + return {make_ng_reduction_op(node, node.get_ng_inputs().at(0))}; } OutputVector reduce_prod(const Node& node) { - return {make_ng_reduction_op(node, node.get_ng_inputs().at(0))}; + return {make_ng_reduction_op(node, node.get_ng_inputs().at(0))}; } OutputVector reduce_sum(const Node& node) { - return {make_ng_reduction_op(node, node.get_ng_inputs().at(0))}; + return {make_ng_reduction_op(node, node.get_ng_inputs().at(0))}; } OutputVector reduce_sum_square(const Node& node) { - const auto input = Output{node.get_ng_inputs().at(0)}; - const auto square_node = std::make_shared(input, input); - return {make_ng_reduction_op(node, square_node)}; + const auto input = Output{node.get_ng_inputs().at(0)}; + const auto square_node = std::make_shared(input, input); + return {make_ng_reduction_op(node, square_node)}; } } // namespace set_1 diff --git a/src/frontends/onnx/frontend/src/op/reduce.hpp b/src/frontends/onnx/frontend/src/op/reduce.hpp index 2abd29a98db308..2c295764fd7a88 100644 --- a/src/frontends/onnx/frontend/src/op/reduce.hpp +++ b/src/frontends/onnx/frontend/src/op/reduce.hpp @@ -23,7 +23,7 @@ namespace set_13 { /// /// \param[in] node The ONNX node representing operation. /// -/// \return The nGraph node equivalent of the ONNX operation. +/// \return The OV node equivalent of the ONNX operation. /// OutputVector reduce_sum(const Node& node); } // namespace set_13 @@ -38,7 +38,7 @@ namespace set_1 { /// /// \param[in] node The ONNX node representing operation. /// -/// \return The nGraph node equivalent of the ONNX operation. +/// \return The OV node equivalent of the ONNX operation. /// OutputVector reduce_log_sum(const Node& node); @@ -52,7 +52,7 @@ OutputVector reduce_log_sum(const Node& node); /// /// \param[in] node The ONNX node representing operation. /// -/// \return The nGraph node equivalent of the ONNX operation. +/// \return The OV node equivalent of the ONNX operation. /// OutputVector reduce_log_sum_exp(const Node& node); @@ -66,7 +66,7 @@ OutputVector reduce_log_sum_exp(const Node& node); /// /// \param[in] node The ONNX node representing operation. /// -/// \return The nGraph node equivalent of the ONNX operation. +/// \return The OV node equivalent of the ONNX operation. /// OutputVector reduce_l1(const Node& node); @@ -80,7 +80,7 @@ OutputVector reduce_l1(const Node& node); /// /// \param[in] node The ONNX node representing operation. /// -/// \return The nGraph node equivalent of the ONNX operation. +/// \return The OV node equivalent of the ONNX operation. /// OutputVector reduce_l2(const Node& node); @@ -94,7 +94,7 @@ OutputVector reduce_l2(const Node& node); /// /// \param[in] node The ONNX node representing operation. /// -/// \return The nGraph node equivalent of the ONNX operation. +/// \return The OV node equivalent of the ONNX operation. /// OutputVector reduce_max(const Node& node); @@ -108,7 +108,7 @@ OutputVector reduce_max(const Node& node); /// /// \param[in] node The ONNX node representing operation. /// -/// \return The nGraph node equivalent of the ONNX operation. +/// \return The OV node equivalent of the ONNX operation. /// OutputVector reduce_mean(const Node& node); @@ -122,7 +122,7 @@ OutputVector reduce_mean(const Node& node); /// /// \param[in] node The ONNX node representing operation. /// -/// \return The nGraph node equivalent of the ONNX operation. +/// \return The OV node equivalent of the ONNX operation. /// OutputVector reduce_min(const Node& node); @@ -136,7 +136,7 @@ OutputVector reduce_min(const Node& node); /// /// \param[in] node The ONNX node representing operation. /// -/// \return The nGraph node equivalent of the ONNX operation. +/// \return The OV node equivalent of the ONNX operation. /// OutputVector reduce_prod(const Node& node); @@ -150,7 +150,7 @@ OutputVector reduce_prod(const Node& node); /// /// \param[in] node The ONNX node representing operation. /// -/// \return The nGraph node equivalent of the ONNX operation. +/// \return The OV node equivalent of the ONNX operation. /// OutputVector reduce_sum(const Node& node); @@ -164,7 +164,7 @@ OutputVector reduce_sum(const Node& node); /// /// \param[in] node The ONNX node representing operation. /// -/// \return The nGraph node equivalent of the ONNX operation. +/// \return The OV node equivalent of the ONNX operation. /// OutputVector reduce_sum_square(const Node& node); diff --git a/src/frontends/onnx/frontend/src/op/relu.hpp b/src/frontends/onnx/frontend/src/op/relu.hpp index 969ee010589ccb..91370a0d0cc468 100644 --- a/src/frontends/onnx/frontend/src/op/relu.hpp +++ b/src/frontends/onnx/frontend/src/op/relu.hpp @@ -7,11 +7,8 @@ #include "openvino/core/deprecated.hpp" OPENVINO_SUPPRESS_DEPRECATED_START -#include - -#include "default_opset.hpp" -#include "ngraph/node.hpp" #include "onnx_import/core/node.hpp" +#include "openvino/op/relu.hpp" namespace ngraph { namespace onnx_import { @@ -19,7 +16,7 @@ namespace op { namespace set_1 { inline OutputVector relu(const Node& node) { OutputVector ng_inputs{node.get_ng_inputs()}; - return {std::make_shared(ng_inputs.at(0))}; + return {std::make_shared(ng_inputs.at(0))}; } } // namespace set_1 diff --git a/src/frontends/onnx/frontend/src/op/reshape.cpp b/src/frontends/onnx/frontend/src/op/reshape.cpp index 15cc07a5719f82..f66a2a3b41891b 100644 --- a/src/frontends/onnx/frontend/src/op/reshape.cpp +++ b/src/frontends/onnx/frontend/src/op/reshape.cpp @@ -4,16 +4,12 @@ #include "op/reshape.hpp" -#include -#include -#include - -#include "default_opset.hpp" #include "exceptions.hpp" -#include "ngraph/axis_vector.hpp" -#include "ngraph/shape.hpp" +#include "openvino/op/reshape.hpp" #include "utils/reshape.hpp" +using namespace ov::op; + OPENVINO_SUPPRESS_DEPRECATED_START namespace ngraph { namespace onnx_import { @@ -23,7 +19,7 @@ OutputVector reshape(const Node& node) { OutputVector ng_inputs{node.get_ng_inputs()}; const auto data = ng_inputs.at(0); - Output pattern; + Output pattern; bool special_zero = true; // Since opset 5 the target shape is provided as input if (ng_inputs.size() == 2) { @@ -35,7 +31,7 @@ OutputVector reshape(const Node& node) { pattern = node.get_attribute_as_constant>("shape", {}); } - return {std::make_shared(data, pattern, special_zero)}; + return {std::make_shared(data, pattern, special_zero)}; } } // namespace set_1 diff --git a/src/frontends/onnx/frontend/src/op/reshape.hpp b/src/frontends/onnx/frontend/src/op/reshape.hpp index c8e39cdd5b4ffa..4bb3c8e9a1cd73 100644 --- a/src/frontends/onnx/frontend/src/op/reshape.hpp +++ b/src/frontends/onnx/frontend/src/op/reshape.hpp @@ -7,7 +7,6 @@ #include "openvino/core/deprecated.hpp" OPENVINO_SUPPRESS_DEPRECATED_START -#include "ngraph/node.hpp" #include "onnx_import/core/node.hpp" namespace ngraph { @@ -19,7 +18,7 @@ namespace set_1 { /// /// \param[in] node The ONNX node representing this operation. /// -/// \return Ngraph node representing this operation. +/// \return OV node representing this operation. /// OutputVector reshape(const Node& node); diff --git a/src/frontends/onnx/frontend/src/op/resize.cpp b/src/frontends/onnx/frontend/src/op/resize.cpp index 10a2c570a9729b..373e5a05a81cb3 100644 --- a/src/frontends/onnx/frontend/src/op/resize.cpp +++ b/src/frontends/onnx/frontend/src/op/resize.cpp @@ -4,14 +4,13 @@ #include "op/resize.hpp" -#include - -#include "default_opset.hpp" #include "exceptions.hpp" -#include "ngraph/op/util/op_types.hpp" #include "onnx_import/core/null_node.hpp" +#include "openvino/op/interpolate.hpp" #include "utils/common.hpp" +using namespace ov::op; + OPENVINO_SUPPRESS_DEPRECATED_START namespace ngraph { namespace onnx_import { @@ -25,12 +24,12 @@ static const std::unordered_set supported_transforms = {"half_pixel "asymmetric", "tf_half_pixel_for_nn"}; -using InterpolateMode = default_opset::Interpolate::InterpolateMode; +using InterpolateMode = v11::Interpolate::InterpolateMode; static const std::map interp_mode_map = {{"nearest", static_cast(InterpolateMode::NEAREST)}, {"linear", static_cast(InterpolateMode::LINEAR_ONNX)}, {"cubic", static_cast(InterpolateMode::CUBIC)}}; -using Transform_mode = default_opset::Interpolate::CoordinateTransformMode; +using Transform_mode = v11::Interpolate::CoordinateTransformMode; static const std::map transform_mode_map = { {"half_pixel", static_cast(Transform_mode::HALF_PIXEL)}, {"pytorch_half_pixel", static_cast(Transform_mode::PYTORCH_HALF_PIXEL)}, @@ -38,7 +37,7 @@ static const std::map transform_mode_map = { {"asymmetric", static_cast(Transform_mode::ASYMMETRIC)}, {"tf_half_pixel_for_nn", static_cast(Transform_mode::TF_HALF_PIXEL_FOR_NN)}}; -using Nearest_mode = default_opset::Interpolate::NearestMode; +using Nearest_mode = v11::Interpolate::NearestMode; static const std::map nearest_mode_map = { {"round_prefer_floor", static_cast(Nearest_mode::ROUND_PREFER_FLOOR)}, {"round_prefer_ceil", static_cast(Nearest_mode::ROUND_PREFER_CEIL)}, @@ -58,7 +57,7 @@ static int mode_as_int(const std::map& converting_map, const s return result; } -using InterpolateAttrs = default_opset::Interpolate::InterpolateAttrs; +using InterpolateAttrs = v11::Interpolate::InterpolateAttrs; InterpolateAttrs get_resize_attrs(const onnx_import::Node& node) { auto get_str_attr = [&node](const std::string& name, const std::string& default_value) { @@ -122,13 +121,13 @@ OutputVector resize(const onnx_import::Node& node) { auto attrs = get_resize_attrs(node); if (inputs.size() == 4 && !ov::op::util::is_null(inputs[3])) { - attrs.shape_calculation_mode = default_opset::Interpolate::ShapeCalcMode::SIZES; + attrs.shape_calculation_mode = v11::Interpolate::ShapeCalcMode::SIZES; const auto& sizes = inputs.at(3); - return {std::make_shared(data, sizes, attrs)}; + return {std::make_shared(data, sizes, attrs)}; } else { - attrs.shape_calculation_mode = default_opset::Interpolate::ShapeCalcMode::SCALES; + attrs.shape_calculation_mode = v11::Interpolate::ShapeCalcMode::SCALES; const auto& scales = inputs.at(2); - return {std::make_shared(data, scales, attrs)}; + return {std::make_shared(data, scales, attrs)}; } } } // namespace set_11 @@ -140,7 +139,7 @@ OutputVector resize(const onnx_import::Node& node) { const auto& scales = inputs.at(1); auto attrs = get_resize_attrs(node); - attrs.shape_calculation_mode = default_opset::Interpolate::ShapeCalcMode::SCALES; + attrs.shape_calculation_mode = v11::Interpolate::ShapeCalcMode::SCALES; if (attrs.mode == InterpolateMode::NEAREST) { attrs.nearest_mode = Nearest_mode::SIMPLE; @@ -148,7 +147,7 @@ OutputVector resize(const onnx_import::Node& node) { } else if (attrs.mode == InterpolateMode::LINEAR_ONNX) { attrs.coordinate_transformation_mode = Transform_mode::ASYMMETRIC; } - return {std::make_shared(data, scales, attrs)}; + return {std::make_shared(data, scales, attrs)}; } } // namespace set_1 diff --git a/src/frontends/onnx/frontend/src/op/resize.hpp b/src/frontends/onnx/frontend/src/op/resize.hpp index bdc78309b4f7c1..220ead533d0e9f 100644 --- a/src/frontends/onnx/frontend/src/op/resize.hpp +++ b/src/frontends/onnx/frontend/src/op/resize.hpp @@ -7,7 +7,6 @@ #include "openvino/core/deprecated.hpp" OPENVINO_SUPPRESS_DEPRECATED_START -#include "ngraph/node.hpp" #include "onnx_import/core/node.hpp" namespace ngraph { diff --git a/src/frontends/onnx/frontend/src/op/reverse_sequence.cpp b/src/frontends/onnx/frontend/src/op/reverse_sequence.cpp index e56b8decd1f4b3..15747bb7f8d9ed 100644 --- a/src/frontends/onnx/frontend/src/op/reverse_sequence.cpp +++ b/src/frontends/onnx/frontend/src/op/reverse_sequence.cpp @@ -4,14 +4,13 @@ #include "op/reverse_sequence.hpp" -#include - -#include "default_opset.hpp" -#include "ngraph/node.hpp" -#include "ngraph/type/element_type.hpp" -#include "ngraph/validation_util.hpp" #include "onnx_import/core/node.hpp" +#include "openvino/core/validation_util.hpp" #include "openvino/frontend/exception.hpp" +#include "openvino/op/convert.hpp" +#include "openvino/op/reverse_sequence.hpp" + +using namespace ov::op; OPENVINO_SUPPRESS_DEPRECATED_START namespace ngraph { @@ -22,18 +21,17 @@ OutputVector reverse_sequence(const Node& node) { const auto data = node.get_ng_inputs().at(0); const auto sequence_lengths = node.get_ng_inputs().at(1); - // nGraph supports only int32 type of sequence_lengths - const auto sequence_lengths_i32 = - std::make_shared(node.get_ng_inputs().at(1), element::i32); + // OpenVINO supports only int32 type of sequence_lengths + const auto sequence_lengths_i32 = std::make_shared(node.get_ng_inputs().at(1), element::i32); const auto data_rank = data.get_partial_shape().rank(); const auto batch_axis = node.get_attribute_value("batch_axis", 1); OPENVINO_SUPPRESS_DEPRECATED_START - const auto normalized_batch_axis = ngraph::normalize_axis(node.get_description(), batch_axis, data_rank); + const auto normalized_batch_axis = ov::normalize_axis(node.get_description(), batch_axis, data_rank); OPENVINO_SUPPRESS_DEPRECATED_END const auto time_axis = node.get_attribute_value("time_axis", 0); OPENVINO_SUPPRESS_DEPRECATED_START - const auto normalized_time_axis = ngraph::normalize_axis(node.get_description(), time_axis, data_rank); + const auto normalized_time_axis = ov::normalize_axis(node.get_description(), time_axis, data_rank); OPENVINO_SUPPRESS_DEPRECATED_END FRONT_END_GENERAL_CHECK(normalized_batch_axis == 0 || normalized_batch_axis == 1, @@ -48,10 +46,8 @@ OutputVector reverse_sequence(const Node& node) { "'batch_axis' and 'time_axis' attributes of the ReverseSequence " "operator can't point to the same dimension"); - return {std::make_shared(data, - sequence_lengths_i32, - normalized_batch_axis, - normalized_time_axis)}; + return { + std::make_shared(data, sequence_lengths_i32, normalized_batch_axis, normalized_time_axis)}; } } // namespace set_1 diff --git a/src/frontends/onnx/frontend/src/op/reverse_sequence.hpp b/src/frontends/onnx/frontend/src/op/reverse_sequence.hpp index 36944be683003f..a21b8f7c9fcbed 100644 --- a/src/frontends/onnx/frontend/src/op/reverse_sequence.hpp +++ b/src/frontends/onnx/frontend/src/op/reverse_sequence.hpp @@ -7,7 +7,6 @@ #include "openvino/core/deprecated.hpp" OPENVINO_SUPPRESS_DEPRECATED_START -#include "ngraph/node.hpp" #include "onnx_import/core/node.hpp" namespace ngraph { diff --git a/src/frontends/onnx/frontend/src/op/rnn.cpp b/src/frontends/onnx/frontend/src/op/rnn.cpp index 26f8349223b8f7..4b800cca99d45c 100644 --- a/src/frontends/onnx/frontend/src/op/rnn.cpp +++ b/src/frontends/onnx/frontend/src/op/rnn.cpp @@ -4,12 +4,12 @@ #include "op/rnn.hpp" -#include - -#include "default_opset.hpp" +#include "openvino/op/rnn_sequence.hpp" #include "ov_models/ov_builders/reshape.hpp" #include "utils/recurrent.hpp" +using namespace ov::op; + OPENVINO_SUPPRESS_DEPRECATED_START namespace ngraph { namespace onnx_import { @@ -34,18 +34,18 @@ OutputVector rnn(const Node& node) { RNNInputMap input_map{node, gates_count}; RNNAttributes attributes{node}; - auto rnn_sequence = std::make_shared(input_map.at(recurrent::OpInput::X), - input_map.at(recurrent::OpInput::INIT_H), - input_map.at(recurrent::OpInput::SEQ_LENGTHS), - input_map.at(recurrent::OpInput::W), - input_map.at(recurrent::OpInput::R), - input_map.at(recurrent::OpInput::B), - attributes.m_hidden_size, - attributes.m_direction, - attributes.m_activations, - attributes.m_activations_alpha, - attributes.m_activations_beta, - attributes.m_clip_threshold); + auto rnn_sequence = std::make_shared(input_map.at(recurrent::OpInput::X), + input_map.at(recurrent::OpInput::INIT_H), + input_map.at(recurrent::OpInput::SEQ_LENGTHS), + input_map.at(recurrent::OpInput::W), + input_map.at(recurrent::OpInput::R), + input_map.at(recurrent::OpInput::B), + attributes.m_hidden_size, + attributes.m_direction, + attributes.m_activations, + attributes.m_activations_alpha, + attributes.m_activations_beta, + attributes.m_clip_threshold); const auto Y = rnn_sequence->output(0); const auto Y_h = rnn_sequence->output(1); diff --git a/src/frontends/onnx/frontend/src/op/rnn.hpp b/src/frontends/onnx/frontend/src/op/rnn.hpp index 24c15054adca5f..e243507f03395e 100644 --- a/src/frontends/onnx/frontend/src/op/rnn.hpp +++ b/src/frontends/onnx/frontend/src/op/rnn.hpp @@ -7,7 +7,6 @@ #include "openvino/core/deprecated.hpp" OPENVINO_SUPPRESS_DEPRECATED_START -#include "ngraph/node.hpp" #include "onnx_import/core/node.hpp" namespace ngraph { diff --git a/src/frontends/onnx/frontend/src/op/roi_align.cpp b/src/frontends/onnx/frontend/src/op/roi_align.cpp index 7997b781ea6414..1f3909bd4cef61 100644 --- a/src/frontends/onnx/frontend/src/op/roi_align.cpp +++ b/src/frontends/onnx/frontend/src/op/roi_align.cpp @@ -4,11 +4,11 @@ #include "op/roi_align.hpp" -#include - #include "openvino/frontend/exception.hpp" #include "openvino/op/roi_align.hpp" +using namespace ov::op; + OPENVINO_SUPPRESS_DEPRECATED_START namespace ngraph { namespace onnx_import { @@ -30,18 +30,18 @@ OutputVector roi_align(const Node& node) { const auto sampling_ratio = static_cast(node.get_attribute_value("sampling_ratio", 1)); const auto spatial_scale = node.get_attribute_value("spatial_scale", 1.0f); const auto mode = node.get_attribute_value("mode", "avg"); - const auto pooling_mode = ov::EnumNames::as_enum(mode); - const auto aligned_mode = ov::op::v9::ROIAlign::AlignedMode::ASYMMETRIC; // Compatible up to ONNX-opset16 - - return {std::make_shared(data, - rois, - num_rois, - pooled_h, - pooled_w, - sampling_ratio, - spatial_scale, - pooling_mode, - aligned_mode)}; + const auto pooling_mode = ov::EnumNames::as_enum(mode); + const auto aligned_mode = v9::ROIAlign::AlignedMode::ASYMMETRIC; // Compatible up to ONNX-opset16 + + return {std::make_shared(data, + rois, + num_rois, + pooled_h, + pooled_w, + sampling_ratio, + spatial_scale, + pooling_mode, + aligned_mode)}; } } // namespace set_1 namespace set_16 { @@ -59,25 +59,25 @@ OutputVector roi_align(const Node& node) { const auto sampling_ratio = node.get_attribute_value("sampling_ratio", 1); const auto spatial_scale = node.get_attribute_value("spatial_scale", 1.0f); const auto mode = node.get_attribute_value("mode", "avg"); - const auto pooling_mode = ov::EnumNames::as_enum(mode); + const auto pooling_mode = ov::EnumNames::as_enum(mode); const auto coordinate_transformation_mode = node.get_attribute_value("coordinate_transformation_mode", ""); - auto aligned_mode = ov::op::v9::ROIAlign::AlignedMode::HALF_PIXEL_FOR_NN; // Match ONNX ROIAlign-16 default + auto aligned_mode = v9::ROIAlign::AlignedMode::HALF_PIXEL_FOR_NN; // Match ONNX ROIAlign-16 default if (coordinate_transformation_mode == "output_half_pixel") { - aligned_mode = ov::op::v9::ROIAlign::AlignedMode::ASYMMETRIC; + aligned_mode = v9::ROIAlign::AlignedMode::ASYMMETRIC; } - return {std::make_shared(data, - rois, - num_rois, - static_cast(pooled_h), - static_cast(pooled_w), - static_cast(sampling_ratio), - spatial_scale, - pooling_mode, - aligned_mode)}; + return {std::make_shared(data, + rois, + num_rois, + static_cast(pooled_h), + static_cast(pooled_w), + static_cast(sampling_ratio), + spatial_scale, + pooling_mode, + aligned_mode)}; } } // namespace set_16 diff --git a/src/frontends/onnx/frontend/src/op/roi_align.hpp b/src/frontends/onnx/frontend/src/op/roi_align.hpp index 05367c7ed52ca1..3124e6f1322f31 100644 --- a/src/frontends/onnx/frontend/src/op/roi_align.hpp +++ b/src/frontends/onnx/frontend/src/op/roi_align.hpp @@ -7,7 +7,6 @@ #include "openvino/core/deprecated.hpp" OPENVINO_SUPPRESS_DEPRECATED_START -#include "ngraph/node.hpp" #include "onnx_import/core/node.hpp" namespace ngraph { diff --git a/src/frontends/onnx/frontend/src/op/round.cpp b/src/frontends/onnx/frontend/src/op/round.cpp index 97eeb241ce88ed..1611b96e0df5e3 100644 --- a/src/frontends/onnx/frontend/src/op/round.cpp +++ b/src/frontends/onnx/frontend/src/op/round.cpp @@ -7,9 +7,9 @@ #include "op/round.hpp" -#include +#include "openvino/op/round.hpp" -#include "default_opset.hpp" +using namespace ov::op; OPENVINO_SUPPRESS_DEPRECATED_START namespace ngraph { @@ -17,8 +17,7 @@ namespace onnx_import { namespace op { namespace set_1 { OutputVector round(const Node& node) { - return {std::make_shared(node.get_ng_inputs().at(0), - default_opset::Round::RoundMode::HALF_TO_EVEN)}; + return {std::make_shared(node.get_ng_inputs().at(0), v5::Round::RoundMode::HALF_TO_EVEN)}; } } // namespace set_1 diff --git a/src/frontends/onnx/frontend/src/op/round.hpp b/src/frontends/onnx/frontend/src/op/round.hpp index 38ea015d89044e..212ae305100bc3 100644 --- a/src/frontends/onnx/frontend/src/op/round.hpp +++ b/src/frontends/onnx/frontend/src/op/round.hpp @@ -10,7 +10,6 @@ #include "openvino/core/deprecated.hpp" OPENVINO_SUPPRESS_DEPRECATED_START -#include "ngraph/node.hpp" #include "onnx_import/core/node.hpp" namespace ngraph { From ff681ccf4c8d1b1c1710913cf93df4f00e6a4739 Mon Sep 17 00:00:00 2001 From: Xuejun Zhai Date: Thu, 25 Jan 2024 18:26:27 +0800 Subject: [PATCH 2/2] [AUTO Batch Plugin] clean 1.0 related def (#22300) * [AUTO Batch Plugin] clean 1.0 related def Signed-off-by: Zhai, Xuejun * Fix test error & clang format Signed-off-by: Zhai, Xuejun * Fix test error Signed-off-by: Zhai, Xuejun * Fix test error Signed-off-by: Zhai, Xuejun * Fix error Signed-off-by: Zhai, Xuejun * [AUTO Batch] fix review comments Signed-off-by: Zhai, Xuejun --------- Signed-off-by: Zhai, Xuejun --- src/plugins/auto_batch/src/compiled_model.cpp | 14 +--- src/plugins/auto_batch/src/plugin.cpp | 70 ++----------------- src/plugins/auto_batch/src/plugin.hpp | 1 - .../tests/unit/plugin_set_property_test.cpp | 5 +- .../ov_executable_network/exec_net_base.cpp | 4 +- .../behavior/ov_infer_request/io_tensor.cpp | 4 +- .../ov_executable_network/properties.cpp | 8 +-- .../behavior/ov_plugin/properties_tests.cpp | 4 +- .../behavior/ov_infer_request/io_tensor.cpp | 4 +- .../behavior/ov_plugin/properties_tests.cpp | 7 +- 10 files changed, 23 insertions(+), 98 deletions(-) diff --git a/src/plugins/auto_batch/src/compiled_model.cpp b/src/plugins/auto_batch/src/compiled_model.cpp index 8c44f48356a29f..8cc37d612c8518 100644 --- a/src/plugins/auto_batch/src/compiled_model.cpp +++ b/src/plugins/auto_batch/src/compiled_model.cpp @@ -195,15 +195,6 @@ ov::Any CompiledModel::get_property(const std::string& name) const { return num_request; } else if (name == ov::model_name.name()) { return m_compiled_model_without_batch->get_property(name); - OPENVINO_SUPPRESS_DEPRECATED_START - } else if (name == METRIC_KEY(SUPPORTED_METRICS)) { - return std::vector{ov::optimal_number_of_infer_requests.name(), - METRIC_KEY(SUPPORTED_METRICS), - ov::model_name.name(), - METRIC_KEY(SUPPORTED_CONFIG_KEYS), - ov::execution_devices.name()}; - } else if (name == METRIC_KEY(SUPPORTED_CONFIG_KEYS)) { - return std::vector{ov::auto_batch_timeout.name()}; } else if (name == ov::execution_devices) { return m_compiled_model_without_batch->get_property(name); } else if (name == ov::loaded_from_cache) { @@ -211,11 +202,9 @@ ov::Any CompiledModel::get_property(const std::string& name) const { } else if (name == ov::supported_properties) { return std::vector{ ov::PropertyName{ov::optimal_number_of_infer_requests.name(), ov::PropertyMutability::RO}, - ov::PropertyName{METRIC_KEY(SUPPORTED_METRICS), ov::PropertyMutability::RO}, ov::PropertyName{ov::model_name.name(), ov::PropertyMutability::RO}, - ov::PropertyName{METRIC_KEY(SUPPORTED_CONFIG_KEYS), ov::PropertyMutability::RO}, ov::PropertyName{ov::execution_devices.name(), ov::PropertyMutability::RO}, - ov::PropertyName{ov::auto_batch_timeout.name(), ov::PropertyMutability::RO}}; + ov::PropertyName{ov::auto_batch_timeout.name(), ov::PropertyMutability::RW}}; } else if (name == ov::auto_batch_timeout) { uint32_t time_out = m_time_out; return time_out; @@ -239,7 +228,6 @@ ov::Any CompiledModel::get_property(const std::string& name) const { OPENVINO_THROW("Unsupported Compiled Model Property: ", name); } } - OPENVINO_SUPPRESS_DEPRECATED_END } const std::vector>& CompiledModel::outputs() const { diff --git a/src/plugins/auto_batch/src/plugin.cpp b/src/plugins/auto_batch/src/plugin.cpp index d451dba5c49758..4024051f45c602 100644 --- a/src/plugins/auto_batch/src/plugin.cpp +++ b/src/plugins/auto_batch/src/plugin.cpp @@ -15,19 +15,11 @@ #include "transformations/common_optimizations/dimension_tracking.hpp" #include "transformations/init_node_info.hpp" #include "transformations/utils/utils.hpp" -OPENVINO_SUPPRESS_DEPRECATED_START -#include "ie_layouts.h" -OPENVINO_SUPPRESS_DEPRECATED_END namespace ov { namespace autobatch_plugin { -OPENVINO_SUPPRESS_DEPRECATED_START -std::vector supported_configKeys = {CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), - ov::device::priorities.name(), - ov::auto_batch_timeout.name(), - ov::cache_dir.name()}; -OPENVINO_SUPPRESS_DEPRECATED_END +std::vector supported_configKeys = {ov::device::priorities.name(), ov::auto_batch_timeout.name()}; inline ov::AnyMap merge_properties(ov::AnyMap config, const ov::AnyMap& user_config) { for (auto&& kvp : user_config) { @@ -69,11 +61,7 @@ DeviceInformation Plugin::parse_meta_device(const std::string& devices_batch_con ov::SoPtr Plugin::create_context(const ov::AnyMap& remote_properties) const { auto full_properties = remote_properties; - OPENVINO_SUPPRESS_DEPRECATED_START - auto it = full_properties.find(CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG)); - OPENVINO_SUPPRESS_DEPRECATED_END - if (it == full_properties.end()) - it = full_properties.find(ov::device::priorities.name()); + auto it = full_properties.find(ov::device::priorities.name()); if (it == full_properties.end()) OPENVINO_THROW("Value for ov::device::priorities is not set"); @@ -84,7 +72,6 @@ ov::SoPtr Plugin::create_context(const ov::AnyMap& remote_pr } ov::Any Plugin::get_property(const std::string& name, const ov::AnyMap& arguments) const { - OPENVINO_SUPPRESS_DEPRECATED_START if (supported_configKeys.end() != std::find(supported_configKeys.begin(), supported_configKeys.end(), name)) { auto it = m_plugin_config.find(name); if (it == m_plugin_config.end()) { @@ -92,10 +79,6 @@ ov::Any Plugin::get_property(const std::string& name, const ov::AnyMap& argument } else { return {it->second}; } - } else if (name == METRIC_KEY(SUPPORTED_METRICS)) { - return std::vector{METRIC_KEY(SUPPORTED_METRICS), - ov::device::full_name.name(), - METRIC_KEY(SUPPORTED_CONFIG_KEYS)}; } else if (name == ov::supported_properties.name()) { return std::vector{ ov::PropertyName{ov::supported_properties.name(), ov::PropertyMutability::RO}, @@ -104,12 +87,9 @@ ov::Any Plugin::get_property(const std::string& name, const ov::AnyMap& argument return decltype(ov::internal::supported_properties)::value_type{}; } else if (name == ov::device::full_name.name()) { return get_device_name(); - } else if (name == METRIC_KEY(SUPPORTED_CONFIG_KEYS)) { - return supported_configKeys; } else { OPENVINO_THROW("Unsupported property: ", name); } - OPENVINO_SUPPRESS_DEPRECATED_END } void Plugin::set_property(const ov::AnyMap& properties) { @@ -118,11 +98,9 @@ void Plugin::set_property(const ov::AnyMap& properties) { const auto& val = c.second; if (supported_configKeys.end() == std::find(supported_configKeys.begin(), supported_configKeys.end(), name)) OPENVINO_THROW("Unsupported config key: ", name); - OPENVINO_SUPPRESS_DEPRECATED_START - if (name == CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG) || name == ov::device::priorities.name()) { + if (name == ov::device::priorities.name()) { parse_batch_device(val.as()); } - OPENVINO_SUPPRESS_DEPRECATED_END m_plugin_config[name] = val; } } @@ -150,14 +128,10 @@ std::shared_ptr Plugin::compile_model(const std::shared_ptr< // merge configs from func properties and m_plugin_config auto full_properties = merge_properties(m_plugin_config, properties); - OPENVINO_SUPPRESS_DEPRECATED_START - auto device_batch = full_properties.find(CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG)); - if (device_batch == full_properties.end()) - device_batch = full_properties.find(ov::device::priorities.name()); + auto device_batch = full_properties.find(ov::device::priorities.name()); if (device_batch == full_properties.end()) { OPENVINO_THROW("ov::device::priorities key for AUTO NATCH is not set for BATCH device"); } - OPENVINO_SUPPRESS_DEPRECATED_END auto meta_device = parse_meta_device(device_batch->second.as(), properties); const auto& device_name = meta_device.device_name; @@ -302,29 +276,6 @@ std::shared_ptr Plugin::compile_model(const std::shared_ptr< } reshaped->reshape(partial_shapes); - - OPENVINO_SUPPRESS_DEPRECATED_START - for (auto&& input : reshaped->inputs()) { - auto& rt_info = input.get_rt_info(); - auto it = rt_info.find("ie_legacy_td"); - if (it != rt_info.end()) { - auto& td = it->second.as(); - rt_info["ie_legacy_td"] = - InferenceEngine::TensorDesc(td.getPrecision(), input.get_shape(), td.getLayout()); - } - } - for (auto&& result : reshaped->get_results()) { - auto output = result->input_value(0); - auto& rt_info = output.get_rt_info(); - auto it = rt_info.find("ie_legacy_td"); - if (it != rt_info.end()) { - auto& td = it->second.as(); - rt_info["ie_legacy_td"] = - InferenceEngine::TensorDesc(td.getPrecision(), output.get_shape(), td.getLayout()); - } - } - OPENVINO_SUPPRESS_DEPRECATED_END - compiled_model_with_batch = context ? core->compile_model(reshaped, context, device_config_no_auto_batch) : core->compile_model(reshaped, device_name, device_config_no_auto_batch); @@ -335,15 +286,12 @@ std::shared_ptr Plugin::compile_model(const std::shared_ptr< ov::SoPtr device_context; if (!context) { - OPENVINO_SUPPRESS_DEPRECATED_START try { device_context = compiled_model_without_batch->get_context(); if (!device_context._so) device_context._so = compiled_model_without_batch._so; } catch (const ov::NotImplemented&) { - } catch (const InferenceEngine::NotImplemented&) { } - OPENVINO_SUPPRESS_DEPRECATED_END } else { device_context = context; } @@ -365,24 +313,18 @@ ov::SupportedOpsMap Plugin::query_model(const std::shared_ptr& OPENVINO_ASSERT(get_core(), "Core is missing!"); auto cfg = properties; for (const auto& c : cfg) { - OPENVINO_SUPPRESS_DEPRECATED_START - if (c.first == CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG) || c.first == ov::device::priorities.name()) { + if (c.first == ov::device::priorities.name()) { auto val = c.second; cfg.erase(c.first); auto metaDevice = parse_meta_device(val.as(), cfg); return get_core()->query_model(model, metaDevice.device_name, cfg); } - OPENVINO_SUPPRESS_DEPRECATED_END } OPENVINO_THROW("Value for ov::device::priorities for AUTO BATCH PLUGIN is not set"); } ov::SoPtr Plugin::get_default_context(const ov::AnyMap& remote_properties) const { - OPENVINO_SUPPRESS_DEPRECATED_START - auto it = remote_properties.find(CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG)); - OPENVINO_SUPPRESS_DEPRECATED_END - if (it == remote_properties.end()) - it = remote_properties.find(ov::device::priorities.name()); + auto it = remote_properties.find(ov::device::priorities.name()); if (it == remote_properties.end()) OPENVINO_THROW("Value for ov::device::priorities is not set"); diff --git a/src/plugins/auto_batch/src/plugin.hpp b/src/plugins/auto_batch/src/plugin.hpp index 68f0edf34c8fb3..9ca950bcc624af 100644 --- a/src/plugins/auto_batch/src/plugin.hpp +++ b/src/plugins/auto_batch/src/plugin.hpp @@ -7,7 +7,6 @@ #include -#include "ie/ie_plugin_config.hpp" #include "openvino/runtime/iplugin.hpp" #include "openvino/runtime/properties.hpp" diff --git a/src/plugins/auto_batch/tests/unit/plugin_set_property_test.cpp b/src/plugins/auto_batch/tests/unit/plugin_set_property_test.cpp index ef67def84bf216..9da4d4baa94ff9 100644 --- a/src/plugins/auto_batch/tests/unit/plugin_set_property_test.cpp +++ b/src/plugins/auto_batch/tests/unit/plugin_set_property_test.cpp @@ -58,12 +58,9 @@ TEST_P(SetPropertyTest, SetPropertyTestCase) { const std::vector plugin_set_property_params_test = { set_property_params{{{ov::auto_batch_timeout(static_cast(200))}}, false}, set_property_params{{{ov::device::priorities("CPU(4)")}}, false}, - set_property_params{{{"CACHE_DIR", "./xyz"}}, false}, set_property_params{{{ov::auto_batch_timeout(static_cast(200))}, {ov::device::priorities("CPU(4)")}}, false}, - set_property_params{{{ov::auto_batch_timeout(static_cast(200))}, {ov::device::priorities("CPU(4)")}, {"CACHE_DIR", "./xyz"}}, - false}, set_property_params{{{"XYZ", "200"}}, true}, - set_property_params{{{"XYZ", "200"}, {ov::device::priorities("CPU(4)")}, {"CACHE_DIR", "./xyz"}}, true}, + set_property_params{{{"XYZ", "200"}, {ov::device::priorities("CPU(4)")}}, true}, }; INSTANTIATE_TEST_SUITE_P(smoke_AutoBatch_BehaviorTests, diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_executable_network/exec_net_base.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_executable_network/exec_net_base.cpp index 8c39fd63103c24..f568096853e6d8 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_executable_network/exec_net_base.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_executable_network/exec_net_base.cpp @@ -16,9 +16,9 @@ auto configs = []() { auto autoBatchConfigs = []() { return std::vector{ // explicit batch size 4 to avoid fallback to no auto-batching (i.e. plain GPU) - {{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), std::string(ov::test::utils::DEVICE_GPU) + "(4)"}, + {{ov::device::priorities.name(), std::string(ov::test::utils::DEVICE_GPU) + "(4)"}, // no timeout to avoid increasing the test time - {CONFIG_KEY(AUTO_BATCH_TIMEOUT), "0 "}}}; + ov::auto_batch_timeout(0)}}; }; INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVCompiledModelBaseTest, diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp index 295da790320971..1d5abcbde1dcdf 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp @@ -26,9 +26,9 @@ auto configs = []() { auto AutoBatchConfigs = []() { return std::vector{ // explicit batch size 4 to avoid fallback to no auto-batching (i.e. plain GPU) - {{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), std::string(ov::test::utils::DEVICE_GPU) + "(4)"}, + {{ov::device::priorities.name(), std::string(ov::test::utils::DEVICE_GPU) + "(4)"}, // no timeout to avoid increasing the test time - {CONFIG_KEY(AUTO_BATCH_TIMEOUT), "0 "}}}; + ov::auto_batch_timeout(0)}}; }; INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestIOTensorTest, diff --git a/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_executable_network/properties.cpp b/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_executable_network/properties.cpp index d279e2154c2bce..4f0d107387042c 100644 --- a/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_executable_network/properties.cpp +++ b/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_executable_network/properties.cpp @@ -67,10 +67,10 @@ const std::vector multi_properties = { }; const std::vector auto_batch_properties = { - {{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), std::string(ov::test::utils::DEVICE_TEMPLATE) + "(4)"}}, - {{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), std::string(ov::test::utils::DEVICE_TEMPLATE) + "(4)"}, - {CONFIG_KEY(AUTO_BATCH_TIMEOUT), "1"}}, - {{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), std::string(ov::test::utils::DEVICE_TEMPLATE) + "(4)"}, + {{ov::device::priorities.name(), std::string(ov::test::utils::DEVICE_TEMPLATE) + "(4)"}}, + {{ov::device::priorities.name(), std::string(ov::test::utils::DEVICE_TEMPLATE) + "(4)"}, + {ov::auto_batch_timeout(1)}}, + {{ov::device::priorities.name(), std::string(ov::test::utils::DEVICE_TEMPLATE) + "(4)"}, {ov::auto_batch_timeout(10)}}, }; diff --git a/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_plugin/properties_tests.cpp b/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_plugin/properties_tests.cpp index f6d55269b6cbf2..43f2e9a61f8a98 100644 --- a/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_plugin/properties_tests.cpp +++ b/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_plugin/properties_tests.cpp @@ -55,8 +55,8 @@ const std::vector multi_properties = { }; const std::vector auto_batch_properties = { - {{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), ov::test::utils::DEVICE_TEMPLATE}}, - {{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), ov::test::utils::DEVICE_TEMPLATE}, {CONFIG_KEY(AUTO_BATCH_TIMEOUT), "1"}}, + {{ov::device::priorities.name(), ov::test::utils::DEVICE_TEMPLATE}}, + {{ov::device::priorities.name(), ov::test::utils::DEVICE_TEMPLATE}, {CONFIG_KEY(AUTO_BATCH_TIMEOUT), "1"}}, }; INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, diff --git a/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/io_tensor.cpp b/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/io_tensor.cpp index 4f55c443118208..c716486a369951 100644 --- a/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/io_tensor.cpp +++ b/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/io_tensor.cpp @@ -222,8 +222,8 @@ TEST_P(OVInferRequestIOTensorTest, canInferWithGetOut) { } TEST_P(OVInferRequestIOTensorTest, InferStaticNetworkSetChangedInputTensorThrow) { - const ov::Shape shape1 = {1, 2, 32, 32}; - const ov::Shape shape2 = {1, 2, 40, 40}; + const ov::Shape shape1 = {1, 2, 40, 40}; + const ov::Shape shape2 = {1, 2, 32, 32}; std::map shapes; shapes[function->inputs().back().get_any_name()] = shape1; OV_ASSERT_NO_THROW(function->reshape(shapes)); diff --git a/src/tests/functional/plugin/shared/src/behavior/ov_plugin/properties_tests.cpp b/src/tests/functional/plugin/shared/src/behavior/ov_plugin/properties_tests.cpp index 37c6e88ae6d6d5..1f95c73dba5861 100644 --- a/src/tests/functional/plugin/shared/src/behavior/ov_plugin/properties_tests.cpp +++ b/src/tests/functional/plugin/shared/src/behavior/ov_plugin/properties_tests.cpp @@ -93,10 +93,9 @@ void OVPropertiesTestsWithCompileModelProps::SetUp() { if (target_device == std::string(ov::test::utils::DEVICE_MULTI) || target_device == std::string(ov::test::utils::DEVICE_AUTO) || - target_device == std::string(ov::test::utils::DEVICE_HETERO)) { - compileModelProperties = { ov::device::priorities(hw_device) }; - } else if (target_device == std::string(ov::test::utils::DEVICE_BATCH)) { - compileModelProperties = {{ CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG) , hw_device}}; + target_device == std::string(ov::test::utils::DEVICE_HETERO) || + target_device == std::string(ov::test::utils::DEVICE_BATCH)) { + compileModelProperties = {ov::device::priorities(hw_device)}; } model = ov::test::utils::make_split_concat();