From e1fcafc16520263c7154ba69c8423e19fc2ca64f Mon Sep 17 00:00:00 2001 From: Pawel Raasz Date: Fri, 26 Jan 2024 12:56:14 +0100 Subject: [PATCH] Remove ngraph/type API (#22297) --- docs/snippets/lpt_intel_cpu_plugin.cpp | 30 +- src/core/include/ngraph/evaluator.hpp | 2 +- src/core/include/ngraph/ngraph.hpp | 5 +- src/core/include/ngraph/type/bfloat16.hpp | 21 -- src/core/include/ngraph/type/element_type.hpp | 64 ---- .../ngraph/type/element_type_traits.hpp | 24 -- src/core/include/ngraph/type/float16.hpp | 21 -- src/core/include/ngraph/util.hpp | 10 +- src/core/include/ngraph/validation_util.hpp | 5 + src/core/src/graph_util.cpp | 8 +- src/core/src/validation_util.cpp | 43 +-- src/core/tests/specialize_function.cpp | 1 + src/frontends/onnx/docs/how_to_add_op.md | 4 +- .../include/onnx_import/core/node.hpp | 30 +- src/frontends/onnx/frontend/src/core/node.cpp | 52 +-- .../onnx/frontend/src/core/sparse_tensor.hpp | 2 +- .../onnx/frontend/src/core/tensor.cpp | 4 +- .../onnx/frontend/src/core/tensor.hpp | 58 ++-- .../onnx/frontend/src/core/value_info.hpp | 2 +- src/frontends/onnx/frontend/src/editor.cpp | 10 +- src/frontends/onnx/frontend/src/editor.hpp | 4 +- .../onnx/frontend/src/input_model.cpp | 2 +- src/frontends/onnx/frontend/src/op/aten.cpp | 2 +- .../onnx/frontend/src/op/blackmanwindow.cpp | 4 +- src/frontends/onnx/frontend/src/op/cast.cpp | 2 +- src/frontends/onnx/frontend/src/op/clip.cpp | 2 +- .../src/op/com.microsoft/attention.cpp | 74 ++-- .../embed_layer_normalization.cpp | 16 +- .../src/op/com.microsoft/fused_conv.cpp | 6 +- .../skip_layer_normalization.cpp | 2 +- .../onnx/frontend/src/op/compress.cpp | 4 +- .../onnx/frontend/src/op/constant.cpp | 34 +- .../frontend/src/op/constant_of_shape.cpp | 2 +- .../onnx/frontend/src/op/conv_integer.cpp | 16 +- .../onnx/frontend/src/op/conv_transpose.cpp | 10 +- .../onnx/frontend/src/op/cum_sum.cpp | 2 +- .../frontend/src/op/dequantize_linear.cpp | 12 +- .../src/op/dynamic_quantize_linear.cpp | 20 +- src/frontends/onnx/frontend/src/op/expand.cpp | 2 +- .../onnx/frontend/src/op/eye_like.cpp | 2 +- src/frontends/onnx/frontend/src/op/gather.hpp | 2 +- .../frontend/src/op/global_average_pool.cpp | 8 +- .../onnx/frontend/src/op/global_max_pool.cpp | 8 +- .../frontend/src/op/group_normalization.cpp | 6 +- .../onnx/frontend/src/op/hammingwindow.cpp | 4 +- .../onnx/frontend/src/op/hannwindow.cpp | 4 +- .../onnx/frontend/src/op/hardmax.cpp | 11 +- .../onnx/frontend/src/op/instance_norm.cpp | 6 +- .../onnx/frontend/src/op/lp_norm.cpp | 2 +- .../onnx/frontend/src/op/lp_pool.cpp | 2 +- src/frontends/onnx/frontend/src/op/lstm.cpp | 28 +- .../onnx/frontend/src/op/matmul_integer.cpp | 8 +- .../onnx/frontend/src/op/max_roi_pool.cpp | 6 +- .../src/op/mean_variance_normalization.cpp | 2 +- .../onnx/frontend/src/op/nms_rotated.hpp | 6 +- .../frontend/src/op/non_max_suppression.cpp | 6 +- .../onnx/frontend/src/op/non_zero.cpp | 2 +- src/frontends/onnx/frontend/src/op/onehot.cpp | 6 +- .../generate_proposals.cpp | 4 +- .../src/op/org.openvinotoolkit/normalize.cpp | 4 +- .../src/op/org.openvinotoolkit/prior_box.cpp | 15 +- .../src/op/org.openvinotoolkit/swish.cpp | 2 +- src/frontends/onnx/frontend/src/op/pad.cpp | 8 +- .../onnx/frontend/src/op/qlinear_conv.cpp | 4 +- .../onnx/frontend/src/op/qlinear_matmul.cpp | 4 +- .../onnx/frontend/src/op/quant_conv.cpp | 14 +- .../onnx/frontend/src/op/quantize_linear.cpp | 33 +- src/frontends/onnx/frontend/src/op/reduce.cpp | 10 +- .../onnx/frontend/src/op/reverse_sequence.cpp | 3 +- src/frontends/onnx/frontend/src/op/scan.cpp | 4 +- src/frontends/onnx/frontend/src/op/shape.cpp | 2 +- src/frontends/onnx/frontend/src/op/size.cpp | 4 +- src/frontends/onnx/frontend/src/op/slice.cpp | 14 +- src/frontends/onnx/frontend/src/op/split.cpp | 4 +- .../onnx/frontend/src/op/squeeze.cpp | 2 +- src/frontends/onnx/frontend/src/op/stft.cpp | 20 +- src/frontends/onnx/frontend/src/op/tile.cpp | 2 +- src/frontends/onnx/frontend/src/op/topk.cpp | 8 +- src/frontends/onnx/frontend/src/op/trilu.cpp | 28 +- .../onnx/frontend/src/op/upsample.cpp | 4 +- .../src/utils/arg_min_max_factory.cpp | 17 +- .../onnx/frontend/src/utils/common.cpp | 40 +-- .../onnx/frontend/src/utils/common.hpp | 6 +- .../onnx/frontend/src/utils/convpool.cpp | 6 +- src/frontends/onnx/frontend/src/utils/dft.cpp | 4 +- .../frontend/src/utils/pooling_factory.cpp | 2 +- .../onnx/frontend/src/utils/recurrent.cpp | 12 +- .../onnx/frontend/src/utils/reshape.cpp | 4 +- .../onnx_common/include/onnx_common/utils.hpp | 12 +- src/frontends/onnx/onnx_common/src/utils.cpp | 38 +- src/frontends/onnx/tests/onnx_editor.cpp | 52 +-- .../onnx/tests/onnx_import_controlflow.in.cpp | 10 +- .../onnx/tests/onnx_import_with_editor.in.cpp | 20 +- .../onnx/tests/onnx_importer_test.cpp | 8 +- .../tests/tests_python/test_frontend_onnx.py | 328 +++++++++++------- src/inference/src/cnn_network_ngraph_impl.cpp | 14 +- src/inference/src/ie_network_reader.cpp | 2 +- .../multiply_to_group_convolution.cpp | 112 +++--- .../infer_request_dynamic.cpp | 2 +- .../behavior/ov_plugin/caching_tests.cpp | 126 +++---- .../fuse_convert_transformation.cpp | 6 +- ...ly_to_group_convolution_transformation.cpp | 64 ++-- .../mvn_transformation.cpp | 31 +- .../single_layer_tests/matrix_nms.cpp | 2 +- .../single_layer_tests/multiclass_nms.cpp | 2 +- .../single_layer_tests/nms_rotated.cpp | 2 +- .../single_layer_tests/pooling.cpp | 3 +- .../single_layer_tests/topk.cpp | 12 +- .../fuse_convert_transformation.hpp | 9 +- ...ly_to_group_convolution_transformation.hpp | 2 +- .../mvn_transformation.hpp | 7 +- .../include/single_layer_tests/loop.hpp | 14 +- .../functional/plugin/shared/src/precomp.hpp | 12 +- .../base/layer_test_utils.hpp | 20 +- .../shared_test_classes/single_layer/eye.hpp | 2 +- .../single_layer/multiclass_nms.hpp | 4 +- .../src/base/layer_test_utils.cpp | 245 ++++++++----- .../src/single_layer/adaptive_pooling.cpp | 4 +- .../src/single_layer/convolution_backprop.cpp | 2 +- .../convolution_backprop_data.cpp | 2 +- .../src/single_layer/eye.cpp | 8 +- .../src/single_layer/gather.cpp | 20 +- .../group_convolution_backprop_data.cpp | 2 +- .../src/single_layer/loop.cpp | 50 +-- .../src/single_layer/lrn.cpp | 2 +- .../src/single_layer/memory.cpp | 6 +- .../src/single_layer/non_max_suppression.cpp | 6 +- .../src/single_layer/proposal.cpp | 8 +- .../src/single_layer/random_uniform.cpp | 3 +- .../src/single_layer/reorg_yolo.cpp | 2 +- .../src/single_layer/roi_align.cpp | 4 +- .../src/single_layer/squeeze_unsqueeze.cpp | 2 +- .../src/single_layer/tensor_iterator.cpp | 2 +- .../src/single_layer/topk.cpp | 4 +- .../src/single_layer/transpose.cpp | 2 +- .../ov_lpt_models/assign_and_read_value.hpp | 4 +- .../include/ov_lpt_models/common/builders.hpp | 19 +- .../convolution_backprop_data.hpp | 16 +- .../include/ov_lpt_models/multiply.hpp | 2 +- .../multiply_partial_function.hpp | 4 +- .../include/ov_lpt_models/pad.hpp | 34 +- .../include/ov_lpt_models/reduce.hpp | 8 +- .../ov_helpers/ov_lpt_models/src/add.cpp | 176 +++++----- .../align_concat_quantization_parameters.cpp | 22 +- .../src/assign_and_read_value.cpp | 40 ++- .../ov_helpers/ov_lpt_models/src/avg_pool.cpp | 6 +- .../ov_lpt_models/src/common/builders.cpp | 90 +++-- .../ov_helpers/ov_lpt_models/src/concat.cpp | 124 +++---- .../ov_lpt_models/src/convolution.cpp | 64 ++-- .../src/convolution_backprop_data.cpp | 64 ++-- ...twise_with_multi_parent_dequantization.cpp | 18 +- .../ov_lpt_models/src/fake_quantize.cpp | 30 +- .../src/fake_quantize_and_convolution.cpp | 36 +- ...d_two_output_branches_with_convolution.cpp | 71 ++-- .../src/fake_quantize_precision_selection.cpp | 66 ++-- .../ov_lpt_models/src/fuse_fake_quantize.cpp | 19 +- .../src/fuse_subtract_to_fake_quantize.cpp | 2 +- .../ov_lpt_models/src/group_convolution.cpp | 28 +- .../src/markup_avg_pool_precisions.cpp | 4 +- .../ov_helpers/ov_lpt_models/src/mat_mul.cpp | 29 +- .../src/move_dequantization_after.cpp | 8 +- .../ov_lpt_models/src/move_fake_quantize.cpp | 7 +- .../ov_helpers/ov_lpt_models/src/multiply.cpp | 15 +- .../src/multiply_partial_function.cpp | 22 +- .../src/multiply_to_group_convolution.cpp | 8 +- .../ov_helpers/ov_lpt_models/src/mvn.cpp | 31 +- .../src/normalize_dequantization.cpp | 4 +- .../ov_lpt_models/src/normalize_l2.cpp | 6 +- .../ov_helpers/ov_lpt_models/src/pad.cpp | 53 +-- .../src/precision_propagation.cpp | 27 +- .../ov_lpt_models/src/recurrent_cell.cpp | 2 +- .../ov_helpers/ov_lpt_models/src/reshape.cpp | 6 +- .../ov_lpt_models/src/shuffle_channels.cpp | 2 +- .../ov_helpers/ov_lpt_models/src/split.cpp | 10 +- .../ov_helpers/ov_lpt_models/src/squeeze.cpp | 7 +- .../src/transformations_after_split.cpp | 100 +++--- .../ov_lpt_models/src/unsqueeze.cpp | 7 +- .../ov_lpt_models/src/variadic_split.cpp | 15 +- .../ov_models/include/ov_models/builders.hpp | 68 ++-- .../include/ov_models/pass/convert_prc.hpp | 2 +- .../preprocess/preprocess_builders.hpp | 90 ++--- .../include/ov_models/utils/ov_helpers.hpp | 4 +- .../ov_models/ov_builders/src/broadcast.cpp | 12 +- .../ov_models/ov_builders/src/reshape.cpp | 20 +- .../ov_models/ov_builders/src/split.cpp | 6 +- .../ov_helpers/ov_models/src/activation.cpp | 4 +- .../ov_models/src/batch_to_space.cpp | 2 +- .../ov_models/src/binary_convolution.cpp | 4 +- .../ov_helpers/ov_models/src/convolution.cpp | 4 +- .../src/convolution_backprop_data.cpp | 6 +- .../src/ctc_greedy_decoder_seq_len.cpp | 12 +- .../ov_helpers/ov_models/src/ctc_loss.cpp | 4 +- .../src/embedding_bag_offsets_sum.cpp | 4 +- .../ov_models/src/embedding_segments_sum.cpp | 4 +- .../ov_models/src/fake_quantize.cpp | 2 +- .../ov_models/src/fully_connected.cpp | 2 +- .../ov_helpers/ov_models/src/gather_nd.cpp | 8 +- .../ov_models/src/group_convolution.cpp | 4 +- .../src/group_convolution_backprop_data.cpp | 6 +- .../ov_helpers/ov_models/src/gru_cell.cpp | 5 +- .../ov_helpers/ov_models/src/input_layer.cpp | 2 +- .../ov_helpers/ov_models/src/lstm_cell.cpp | 5 +- .../ov_models/src/non_max_suppression.cpp | 8 +- .../ov_helpers/ov_models/src/proposal.cpp | 2 +- .../ov_helpers/ov_models/src/rnn_cell.cpp | 5 +- .../ov_models/src/space_to_batch.cpp | 2 +- src/tests/ov_helpers/ov_models/src/split.cpp | 2 +- .../ov_models/src/squeeze_unsqueeze.cpp | 2 +- .../ov_models/src/strided_slice.cpp | 2 +- .../ov_models/src/utils/ov_helpers.cpp | 192 +++++----- .../src/subgraph_matmul.cpp | 90 +++-- 211 files changed, 2141 insertions(+), 2055 deletions(-) delete mode 100644 src/core/include/ngraph/type/bfloat16.hpp delete mode 100644 src/core/include/ngraph/type/element_type.hpp delete mode 100644 src/core/include/ngraph/type/element_type_traits.hpp delete mode 100644 src/core/include/ngraph/type/float16.hpp diff --git a/docs/snippets/lpt_intel_cpu_plugin.cpp b/docs/snippets/lpt_intel_cpu_plugin.cpp index 564858e5f42..c4cd047f9a0 100644 --- a/docs/snippets/lpt_intel_cpu_plugin.cpp +++ b/docs/snippets/lpt_intel_cpu_plugin.cpp @@ -71,20 +71,16 @@ if (useLpt) { // Low precision transformations plugin specific configuration: restrictions definition auto supportedPrecisions = std::vector({ PrecisionsRestriction::create({ - {{0}, {ngraph::element::u8}}, - {{1}, {ngraph::element::i8}}, - }), - PrecisionsRestriction::create({ - {{0}, {ngraph::element::u8, ngraph::element::i8}}, - {{1}, {ngraph::element::i8}} - }), - PrecisionsRestriction::create({ - {{0}, {ngraph::element::u8}}, - {{1}, {ngraph::element::i8}} + {{0}, {ov::element::u8}}, + {{1}, {ov::element::i8}}, }), + PrecisionsRestriction::create( + {{{0}, {ov::element::u8, ov::element::i8}}, {{1}, {ov::element::i8}}}), + PrecisionsRestriction::create( + {{{0}, {ov::element::u8}}, {{1}, {ov::element::i8}}}), PrecisionsRestriction::create({ - {{0}, {ngraph::element::u8}}, - {{1}, {ngraph::element::i8}}, + {{0}, {ov::element::u8}}, + {{1}, {ov::element::i8}}, }), }); @@ -134,8 +130,8 @@ using namespace ov::pass::low_precision; //! [lpt_supported_precisions] auto supportedPrecisions = std::vector({ PrecisionsRestriction::create({ - {{0}, {ngraph::element::u8}}, - {{1}, {ngraph::element::i8}}, + {{0}, {ov::element::u8}}, + {{1}, {ov::element::i8}}, }), }); @@ -170,7 +166,7 @@ lptManager.run_passes(nGraphFunc); return 0; } -int asymmetric_quantization(const std::vector& defaultPrecisions) { +int asymmetric_quantization(const std::vector& defaultPrecisions) { std::shared_ptr nGraphFunc; ov::pass::Manager manager; auto pass_config = manager.get_pass_config(); @@ -198,8 +194,8 @@ using namespace ov::pass::low_precision; //! [lpt_markup_pipeline] auto supportedPrecisions = std::vector({ PrecisionsRestriction::create({ - {{0}, {ngraph::element::u8}}, - {{1}, {ngraph::element::i8}}, + {{0}, {ov::element::u8}}, + {{1}, {ov::element::i8}}, }), }); diff --git a/src/core/include/ngraph/evaluator.hpp b/src/core/include/ngraph/evaluator.hpp index b81028e20fb..6e1aecb325e 100644 --- a/src/core/include/ngraph/evaluator.hpp +++ b/src/core/include/ngraph/evaluator.hpp @@ -21,7 +21,7 @@ #include "ngraph/deprecated.hpp" #include "ngraph/node.hpp" #include "ngraph/shape.hpp" -#include "ngraph/type/element_type_traits.hpp" +#include "openvino/core/type/element_type_traits.hpp" namespace ngraph { /// \brief Execute handlers on a subgraph to compute values diff --git a/src/core/include/ngraph/ngraph.hpp b/src/core/include/ngraph/ngraph.hpp index 9acaf23c575..163094d3284 100644 --- a/src/core/include/ngraph/ngraph.hpp +++ b/src/core/include/ngraph/ngraph.hpp @@ -53,15 +53,14 @@ #include "ngraph/factory.hpp" #include "ngraph/function.hpp" #include "ngraph/node.hpp" -#include "ngraph/ops.hpp" #include "ngraph/partial_shape.hpp" #include "ngraph/rt_info.hpp" #include "ngraph/shape.hpp" #include "ngraph/specialize_function.hpp" -#include "ngraph/type/element_type.hpp" #include "openvino/core/descriptor/input.hpp" #include "openvino/core/descriptor/output.hpp" #include "openvino/core/descriptor/tensor.hpp" +#include "openvino/core/type/element_type.hpp" // nGraph opsets -#include "ngraph/opsets/opset.hpp" \ No newline at end of file +#include "ngraph/opsets/opset.hpp" diff --git a/src/core/include/ngraph/type/bfloat16.hpp b/src/core/include/ngraph/type/bfloat16.hpp deleted file mode 100644 index 1a20346438c..00000000000 --- a/src/core/include/ngraph/type/bfloat16.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2018-2023 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#if !defined(IN_OV_COMPONENT) && !defined(NGRAPH_LEGACY_HEADER_INCLUDED) -# define NGRAPH_LEGACY_HEADER_INCLUDED -# ifdef _MSC_VER -# pragma message( \ - "The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html") -# else -# warning("The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html") -# endif -#endif - -#include "openvino/core/type/bfloat16.hpp" - -namespace ngraph { -using ov::bfloat16; -} // namespace ngraph diff --git a/src/core/include/ngraph/type/element_type.hpp b/src/core/include/ngraph/type/element_type.hpp deleted file mode 100644 index 3ff94063d82..00000000000 --- a/src/core/include/ngraph/type/element_type.hpp +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (C) 2018-2023 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -//================================================================================================ -// ElementType -//================================================================================================ - -#pragma once - -#if !defined(IN_OV_COMPONENT) && !defined(NGRAPH_LEGACY_HEADER_INCLUDED) -# define NGRAPH_LEGACY_HEADER_INCLUDED -# ifdef _MSC_VER -# pragma message( \ - "The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html") -# else -# warning("The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html") -# endif -#endif - -#include "ngraph/deprecated.hpp" -#include "ngraph/type/bfloat16.hpp" -#include "ngraph/type/float16.hpp" -#include "openvino/core/type/element_type.hpp" - -namespace ngraph { -namespace element { -using ov::element::Type; -using ov::element::Type_t; -using TypeVector = std::vector; - -using ov::element::bf16; -using ov::element::boolean; -using ov::element::dynamic; -using ov::element::f16; -using ov::element::f32; -using ov::element::f64; -using ov::element::f8e4m3; -using ov::element::f8e5m2; -using ov::element::i16; -using ov::element::i32; -using ov::element::i4; -using ov::element::i64; -using ov::element::i8; -using ov::element::nf4; -using ov::element::string; -using ov::element::u1; -using ov::element::u16; -using ov::element::u32; -using ov::element::u4; -using ov::element::u64; -using ov::element::u8; -using ov::element::undefined; - -template -NGRAPH_API_DEPRECATED Type from() { - return ov::element::from(); -} -} // namespace element - -/// \brief Return the number of bytes in the compile-time representation of the element type. -NGRAPH_API_DEPRECATED -size_t compiler_byte_size(element::Type_t et); -} // namespace ngraph diff --git a/src/core/include/ngraph/type/element_type_traits.hpp b/src/core/include/ngraph/type/element_type_traits.hpp deleted file mode 100644 index 679b9aa025a..00000000000 --- a/src/core/include/ngraph/type/element_type_traits.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2018-2023 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#if !defined(IN_OV_COMPONENT) && !defined(NGRAPH_LEGACY_HEADER_INCLUDED) -# define NGRAPH_LEGACY_HEADER_INCLUDED -# ifdef _MSC_VER -# pragma message( \ - "The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html") -# else -# warning("The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html") -# endif -#endif - -#include "openvino/core/type/element_type_traits.hpp" - -namespace ngraph { -using ov::element_type_traits; - -using ov::fundamental_type_for; - -} // namespace ngraph diff --git a/src/core/include/ngraph/type/float16.hpp b/src/core/include/ngraph/type/float16.hpp deleted file mode 100644 index 93369ce3223..00000000000 --- a/src/core/include/ngraph/type/float16.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2018-2023 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#if !defined(IN_OV_COMPONENT) && !defined(NGRAPH_LEGACY_HEADER_INCLUDED) -# define NGRAPH_LEGACY_HEADER_INCLUDED -# ifdef _MSC_VER -# pragma message( \ - "The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html") -# else -# warning("The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html") -# endif -#endif - -#include "openvino/core/type/float16.hpp" - -namespace ngraph { -using ov::float16; -} // namespace ngraph diff --git a/src/core/include/ngraph/util.hpp b/src/core/include/ngraph/util.hpp index 372347e6866..3fdbd022edd 100644 --- a/src/core/include/ngraph/util.hpp +++ b/src/core/include/ngraph/util.hpp @@ -33,9 +33,9 @@ #include "ngraph/graph_util.hpp" #include "ngraph/node.hpp" #include "ngraph/shape.hpp" -#include "ngraph/type/element_type.hpp" -#include "ngraph/type/element_type_traits.hpp" #include "openvino/core/enum_mask.hpp" +#include "openvino/core/type/element_type.hpp" +#include "openvino/core/type/element_type_traits.hpp" #include "openvino/runtime/tensor.hpp" namespace ov { @@ -255,7 +255,7 @@ NGRAPH_API_DEPRECATED T double_to_int(double x, double float_to_int_converter(do template NGRAPH_API_DEPRECATED std::vector read_vector(std::shared_ptr tv) { - if (ngraph::element::from() != tv->get_element_type()) { + if (ov::element::from() != tv->get_element_type()) { OPENVINO_THROW("read_vector type must match Tensor type"); } size_t element_count = ngraph::shape_size(tv->get_shape()); @@ -265,8 +265,8 @@ NGRAPH_API_DEPRECATED std::vector read_vector(std::shared_ptr tv) return rc; } -template -NGRAPH_API_DEPRECATED std::vector array_2_vector(typename ngraph::element_type_traits::value_type* data, +template +NGRAPH_API_DEPRECATED std::vector array_2_vector(typename ov::element_type_traits::value_type* data, size_t size) { std::vector result(size); for (size_t i = 0; i < size; i++) { diff --git a/src/core/include/ngraph/validation_util.hpp b/src/core/include/ngraph/validation_util.hpp index fc6f2245927..ea9f2e7a92f 100644 --- a/src/core/include/ngraph/validation_util.hpp +++ b/src/core/include/ngraph/validation_util.hpp @@ -29,6 +29,11 @@ using ov::normalize_axes; using ov::normalize_axis; using ov::op::v0::Constant; +namespace element { +using ov::element::Type; +using ov::element::Type_t; +} // namespace element + NGRAPH_API_DEPRECATED NGRAPH_API Strides conv_default_strides(const Node* node, diff --git a/src/core/src/graph_util.cpp b/src/core/src/graph_util.cpp index 9cb4d84b68e..7c90647c3de 100644 --- a/src/core/src/graph_util.cpp +++ b/src/core/src/graph_util.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "ngraph/graph_util.hpp" +#include "openvino/core/graph_util.hpp" #include #include @@ -609,18 +609,18 @@ void insert_new_node_between(const std::shared_ptr& src_node, dst_input.replace_source_output(new_node->output(0)); // Remove [0] (again), add [8], remove [1], add [9] } -std::shared_ptr make_zero(const element::Type& element_type, const Shape& shape) { +std::shared_ptr make_zero(const ov::element::Type& element_type, const Shape& shape) { auto zero = ov::op::v0::Constant::create(element_type, Shape{}, {0.0}); if (shape.size() > 0) { return std::make_shared( zero, - ov::op::v0::Constant::create(element::u64, Shape{shape.size()}, shape)); + ov::op::v0::Constant::create(ov::element::u64, Shape{shape.size()}, shape)); } return zero; } std::shared_ptr make_constant_from_string(std::string val, - const element::Type& element_type, + const ov::element::Type& element_type, const Shape& shape) { auto cvals = std::vector(shape_size(shape), val); return std::make_shared(element_type, shape, cvals); diff --git a/src/core/src/validation_util.cpp b/src/core/src/validation_util.cpp index cb8e43ffea7..caca3c3035d 100644 --- a/src/core/src/validation_util.cpp +++ b/src/core/src/validation_util.cpp @@ -819,31 +819,32 @@ std::shared_ptr get_constant_min_of_type(element::Type_t t) { } std::shared_ptr get_constant_lowest_of_type(element::Type_t t) { -#define OPENVINO_TYPE_TO_LOWEST_CONST(t) \ - case t: \ - return op::v0::Constant::create(t, \ - {}, \ - {std::numeric_limits::value_type>::lowest()}); \ +#define OPENVINO_TYPE_TO_LOWEST_CONST(t) \ + case t: \ + return op::v0::Constant::create( \ + t, \ + {}, \ + {std::numeric_limits::value_type>::lowest()}); \ break switch (t) { - OPENVINO_TYPE_TO_LOWEST_CONST(element::boolean); - OPENVINO_TYPE_TO_LOWEST_CONST(element::bf16); - OPENVINO_TYPE_TO_LOWEST_CONST(element::f16); - OPENVINO_TYPE_TO_LOWEST_CONST(element::f32); - OPENVINO_TYPE_TO_LOWEST_CONST(element::f64); - OPENVINO_TYPE_TO_LOWEST_CONST(element::i8); - OPENVINO_TYPE_TO_LOWEST_CONST(element::i16); - OPENVINO_TYPE_TO_LOWEST_CONST(element::i32); - OPENVINO_TYPE_TO_LOWEST_CONST(element::i64); - OPENVINO_TYPE_TO_LOWEST_CONST(element::u1); - OPENVINO_TYPE_TO_LOWEST_CONST(element::u8); - OPENVINO_TYPE_TO_LOWEST_CONST(element::u16); - OPENVINO_TYPE_TO_LOWEST_CONST(element::u32); - OPENVINO_TYPE_TO_LOWEST_CONST(element::u64); + OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::boolean); + OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::bf16); + OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::f16); + OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::f32); + OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::f64); + OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::i8); + OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::i16); + OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::i32); + OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::i64); + OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::u1); + OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::u8); + OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::u16); + OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::u32); + OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::u64); - case element::undefined: - case element::dynamic: + case ov::element::undefined: + case ov::element::dynamic: default: return nullptr; } diff --git a/src/core/tests/specialize_function.cpp b/src/core/tests/specialize_function.cpp index 1a632b0963b..1092162dbb1 100644 --- a/src/core/tests/specialize_function.cpp +++ b/src/core/tests/specialize_function.cpp @@ -10,6 +10,7 @@ #include "openvino/op/convert.hpp" using namespace ngraph; +using namespace ov; NGRAPH_SUPPRESS_DEPRECATED_START; using ov::op::v0::Constant; diff --git a/src/frontends/onnx/docs/how_to_add_op.md b/src/frontends/onnx/docs/how_to_add_op.md index aaadf225592..0fe243dd9fb 100644 --- a/src/frontends/onnx/docs/how_to_add_op.md +++ b/src/frontends/onnx/docs/how_to_add_op.md @@ -43,7 +43,7 @@ OutputVector custom_add(const Node& node) { const auto in2 = node.get_ng_inputs().at(1); const auto alpha = node.get_attribute_value("alpha", 1); const auto alpha_node = - std::make_shared(default_opset::Constant::create(element::f32, {}, {alpha}), + std::make_shared(default_opset::Constant::create( ov::element::f32, {}, {alpha}), in1.get_element_type()); const auto add = std::make_shared(in1, in2); @@ -104,4 +104,4 @@ fe.add_extension(OpExtension("opset9.Add", "CustomAdd", "org.openvinotoolkit", { ## See also * [OpenVINO ONNX Frontend README](../README.md) * [OpenVINO™ README](../../../../README.md) - * [Developer documentation](../../../../docs/dev/index.md) \ No newline at end of file + * [Developer documentation](../../../../docs/dev/index.md) diff --git a/src/frontends/onnx/frontend/include/onnx_import/core/node.hpp b/src/frontends/onnx/frontend/include/onnx_import/core/node.hpp index ed114552cbd..a2a390bae4a 100644 --- a/src/frontends/onnx/frontend/include/onnx_import/core/node.hpp +++ b/src/frontends/onnx/frontend/include/onnx_import/core/node.hpp @@ -29,6 +29,9 @@ class NodeProto; } // namespace ONNX_NAMESPACE namespace ngraph { +namespace element { +using ov::element::Type; +} namespace onnx_import { namespace error { namespace node { @@ -96,7 +99,8 @@ public: std::shared_ptr get_attribute_as_constant(const std::string& name) const; template - std::shared_ptr get_attribute_as_constant(const std::string& name, element::Type type) const; + std::shared_ptr get_attribute_as_constant(const std::string& name, + ov::element::Type type) const; template std::shared_ptr get_attribute_as_constant(const std::string& name, T default_value) const; @@ -104,7 +108,7 @@ public: template std::shared_ptr get_attribute_as_constant(const std::string& name, T default_value, - element::Type type) const; + ov::element::Type type) const; private: class Impl; @@ -223,7 +227,7 @@ ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_c template <> ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_constant>( const std::string& name, - element::Type type) const; + ov::element::Type type) const; template <> ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_constant( @@ -231,8 +235,10 @@ ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_c std::vector default_value) const; template <> -ONNX_IMPORTER_API std::shared_ptr -Node::get_attribute_as_constant(const std::string& name, std::vector default_value, element::Type type) const; +ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_constant( + const std::string& name, + std::vector default_value, + ov::element::Type type) const; template <> ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_constant( @@ -245,12 +251,12 @@ ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_c template <> ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_constant(const std::string& name, float default_value, - element::Type type) const; + ov::element::Type type) const; template <> ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_constant( const std::string& name, - element::Type type) const; + ov::element::Type type) const; template <> ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_constant( @@ -263,12 +269,12 @@ ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_c template <> ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_constant( const std::string& name, - element::Type type) const; + ov::element::Type type) const; template <> ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_constant(const std::string& name, double default_value, - element::Type type) const; + ov::element::Type type) const; template <> ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_constant( @@ -277,7 +283,7 @@ ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_c template <> ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_constant( const std::string& name, - element::Type type) const; + ov::element::Type type) const; template <> ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_constant(const std::string& name, @@ -286,12 +292,12 @@ ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_c template <> ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_constant( const std::string& name, - element::Type type) const; + ov::element::Type type) const; template <> ONNX_IMPORTER_API std::shared_ptr Node::get_attribute_as_constant(const std::string& name, int64_t default_value, - element::Type type) const; + ov::element::Type type) const; OPENVINO_SUPPRESS_DEPRECATED_START inline std::ostream& operator<<(std::ostream& outs, const Node& node) { diff --git a/src/frontends/onnx/frontend/src/core/node.cpp b/src/frontends/onnx/frontend/src/core/node.cpp index fe329d33e43..5ee9a01a8f6 100644 --- a/src/frontends/onnx/frontend/src/core/node.cpp +++ b/src/frontends/onnx/frontend/src/core/node.cpp @@ -76,7 +76,8 @@ public: std::shared_ptr get_attribute_as_constant(const std::string& name) const; template - std::shared_ptr get_attribute_as_constant(const std::string& name, element::Type type) const; + std::shared_ptr get_attribute_as_constant(const std::string& name, + ov::element::Type type) const; template std::shared_ptr get_attribute_as_constant(const std::string& name, T default_value) const; @@ -84,7 +85,7 @@ public: template std::shared_ptr get_attribute_as_constant(const std::string& name, T default_value, - element::Type type) const; + ov::element::Type type) const; const ONNX_NAMESPACE::NodeProto& node_proto() const; Graph* graph() const; @@ -229,7 +230,7 @@ const std::string& Node::Impl::description() const { template std::shared_ptr Node::Impl::get_attribute_as_constant(const std::string& name) const { const auto value = get_attribute_value(name); - const element::Type type = ov::element::from(); + const ov::element::Type type = ov::element::from(); return std::make_shared(type, Shape{}, value); } @@ -237,25 +238,25 @@ template std::shared_ptr Node::Impl::get_attribute_as_constant(const std::string& name, T default_value) const { const auto value = get_attribute_value(name, default_value); - const element::Type type = ov::element::from(); + const ov::element::Type type = ov::element::from(); return std::make_shared(type, Shape{}, value); } template std::shared_ptr Node::Impl::get_attribute_as_constant(const std::string& name, T default_value, - element::Type type) const { + ov::element::Type type) const { const auto value = get_attribute_value(name, default_value); - return std::make_shared(type == element::undefined ? ov::element::from() : type, + return std::make_shared(type == ov::element::undefined ? ov::element::from() : type, Shape{}, value); } template std::shared_ptr Node::Impl::get_attribute_as_constant(const std::string& name, - element::Type type) const { + ov::element::Type type) const { const auto value = get_attribute_value(name); - return std::make_shared(type == element::undefined ? ov::element::from() : type, + return std::make_shared(type == ov::element::undefined ? ov::element::from() : type, Shape{}, value); } @@ -264,30 +265,34 @@ template <> std::shared_ptr Node::Impl::get_attribute_as_constant>( const std::string& name) const { const auto value = get_attribute_value>(name); - return ov::op::v0::Constant::create(element::i64, {value.size()}, value); + return ov::op::v0::Constant::create(ov::element::i64, {value.size()}, value); } template <> std::shared_ptr Node::Impl::get_attribute_as_constant>( const std::string& name, - element::Type type) const { + ov::element::Type type) const { const auto value = get_attribute_value>(name); - return ov::op::v0::Constant::create(type == element::undefined ? element::i64 : type, {value.size()}, value); + return ov::op::v0::Constant::create(type == ov::element::undefined ? ov::element::i64 : type, + {value.size()}, + value); } template <> std::shared_ptr Node::Impl::get_attribute_as_constant(const std::string& name, std::vector default_value) const { const auto value = get_attribute_value>(name, default_value); - return ov::op::v0::Constant::create(element::i64, {value.size()}, value); + return ov::op::v0::Constant::create(ov::element::i64, {value.size()}, value); } template <> std::shared_ptr Node::Impl::get_attribute_as_constant(const std::string& name, std::vector default_value, - element::Type type) const { + ov::element::Type type) const { const auto value = get_attribute_value>(name, default_value); - return ov::op::v0::Constant::create(type != element::undefined ? type : element::i64, {value.size()}, value); + return ov::op::v0::Constant::create(type != ov::element::undefined ? type : ov::element::i64, + {value.size()}, + value); } Node::Node(const ONNX_NAMESPACE::NodeProto& node_proto, Graph* graph) @@ -547,13 +552,13 @@ std::shared_ptr Node::get_attribute_as_constant(const std: template <> std::shared_ptr Node::get_attribute_as_constant(const std::string& name, float default_value, - element::Type type) const { + ov::element::Type type) const { return m_pimpl->template get_attribute_as_constant(name, default_value, std::move(type)); } template <> std::shared_ptr Node::get_attribute_as_constant(const std::string& name, - element::Type type) const { + ov::element::Type type) const { return m_pimpl->template get_attribute_as_constant(name, std::move(type)); } @@ -571,13 +576,13 @@ std::shared_ptr Node::get_attribute_as_constant(const std: template <> std::shared_ptr Node::get_attribute_as_constant(const std::string& name, double default_value, - element::Type type) const { + ov::element::Type type) const { return m_pimpl->template get_attribute_as_constant(name, default_value, std::move(type)); } template <> std::shared_ptr Node::get_attribute_as_constant(const std::string& name, - element::Type type) const { + ov::element::Type type) const { return m_pimpl->template get_attribute_as_constant(name, std::move(type)); } @@ -595,13 +600,13 @@ std::shared_ptr Node::get_attribute_as_constant(const std: template <> std::shared_ptr Node::get_attribute_as_constant(const std::string& name, int64_t default_value, - element::Type type) const { + ov::element::Type type) const { return m_pimpl->template get_attribute_as_constant(name, default_value, std::move(type)); } template <> std::shared_ptr Node::get_attribute_as_constant(const std::string& name, - element::Type type) const { + ov::element::Type type) const { return m_pimpl->template get_attribute_as_constant(name, std::move(type)); } @@ -612,8 +617,9 @@ std::shared_ptr Node::get_attribute_as_constant -std::shared_ptr Node::get_attribute_as_constant>(const std::string& name, - element::Type type) const { +std::shared_ptr Node::get_attribute_as_constant>( + const std::string& name, + ov::element::Type type) const { return m_pimpl->template get_attribute_as_constant>(name, std::move(type)); } @@ -626,7 +632,7 @@ std::shared_ptr Node::get_attribute_as_constant(const std: template <> std::shared_ptr Node::get_attribute_as_constant(const std::string& name, std::vector default_value, - element::Type type) const { + ov::element::Type type) const { return m_pimpl->template get_attribute_as_constant>(name, std::move(default_value), std::move(type)); diff --git a/src/frontends/onnx/frontend/src/core/sparse_tensor.hpp b/src/frontends/onnx/frontend/src/core/sparse_tensor.hpp index eb70a82ea08..55c3c792cf5 100644 --- a/src/frontends/onnx/frontend/src/core/sparse_tensor.hpp +++ b/src/frontends/onnx/frontend/src/core/sparse_tensor.hpp @@ -53,7 +53,7 @@ public: return m_indices; } - const element::Type& get_ov_type() const { + const ov::element::Type& get_ov_type() const { return m_values.get_ov_type(); } diff --git a/src/frontends/onnx/frontend/src/core/tensor.cpp b/src/frontends/onnx/frontend/src/core/tensor.cpp index b44515e9c0d..e5caa078716 100644 --- a/src/frontends/onnx/frontend/src/core/tensor.cpp +++ b/src/frontends/onnx/frontend/src/core/tensor.cpp @@ -38,7 +38,7 @@ std::vector Tensor::get_data() const { template <> std::vector Tensor::get_data() const { if (has_external_data()) { - return get_external_data(); + return get_external_data(); } if (m_tensor_proto->has_raw_data()) { return detail::__get_raw_data(m_tensor_proto->raw_data(), m_tensor_proto->data_type()); @@ -62,7 +62,7 @@ std::vector Tensor::get_data() const { template <> std::vector Tensor::get_data() const { if (has_external_data()) { - return get_external_data(); + return get_external_data(); } if (m_tensor_proto->has_raw_data()) { return detail::__get_raw_data(m_tensor_proto->raw_data(), m_tensor_proto->data_type()); diff --git a/src/frontends/onnx/frontend/src/core/tensor.hpp b/src/frontends/onnx/frontend/src/core/tensor.hpp index 00b20c4010c..502211cb03f 100644 --- a/src/frontends/onnx/frontend/src/core/tensor.hpp +++ b/src/frontends/onnx/frontend/src/core/tensor.hpp @@ -131,37 +131,37 @@ public: return static_cast(m_tensor_proto->data_type()); } - const element::Type& get_ov_type() const { + const ov::element::Type& get_ov_type() const { if (!m_tensor_proto->has_data_type()) { FRONT_END_THROW("Tensor has no specified data type"); } switch (m_tensor_proto->data_type()) { case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_BOOL: - return element::boolean; + return ov::element::boolean; case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_FLOAT: - return element::f32; + return ov::element::f32; case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_FLOAT16: - return element::f16; + return ov::element::f16; case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_DOUBLE: - return element::f64; + return ov::element::f64; case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_INT8: - return element::i8; + return ov::element::i8; case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_INT16: - return element::i16; + return ov::element::i16; case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_INT32: - return element::i32; + return ov::element::i32; case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_INT64: - return element::i64; + return ov::element::i64; case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_UINT8: - return element::u8; + return ov::element::u8; case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_UINT16: - return element::u16; + return ov::element::u16; case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_UINT32: - return element::u32; + return ov::element::u32; case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_UINT64: - return element::u64; + return ov::element::u64; case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_BFLOAT16: - return element::bf16; + return ov::element::bf16; case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_UNDEFINED: FRONT_END_THROW("Data type is Undefined"); default: @@ -181,31 +181,31 @@ public: } switch (m_tensor_proto->data_type()) { case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_BOOL: - return make_ov_constant(element::boolean); + return make_ov_constant(ov::element::boolean); case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_FLOAT: - return make_ov_constant(element::f32); + return make_ov_constant(ov::element::f32); case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_FLOAT16: - return make_ov_constant(element::f16); + return make_ov_constant(ov::element::f16); case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_DOUBLE: - return make_ov_constant(element::f64); + return make_ov_constant(ov::element::f64); case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_INT8: - return make_ov_constant(element::i8); + return make_ov_constant(ov::element::i8); case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_INT16: - return make_ov_constant(element::i16); + return make_ov_constant(ov::element::i16); case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_INT32: - return make_ov_constant(element::i32); + return make_ov_constant(ov::element::i32); case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_INT64: - return make_ov_constant(element::i64); + return make_ov_constant(ov::element::i64); case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_UINT8: - return make_ov_constant(element::u8); + return make_ov_constant(ov::element::u8); case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_UINT16: - return make_ov_constant(element::u16); + return make_ov_constant(ov::element::u16); case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_UINT32: - return make_ov_constant(element::u32); + return make_ov_constant(ov::element::u32); case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_UINT64: - return make_ov_constant(element::u64); + return make_ov_constant(ov::element::u64); case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_BFLOAT16: - return make_ov_constant(element::bf16); + return make_ov_constant(ov::element::bf16); default: ONNX_UNSUPPORTED_DATA_TYPE( m_tensor_proto->data_type(), @@ -219,7 +219,7 @@ private: std::is_same::value || std::is_same::value || std::is_same::value, bool>::type = true> - std::shared_ptr make_ov_constant(const element::Type& type) const { + std::shared_ptr make_ov_constant(const ov::element::Type& type) const { std::shared_ptr constant{nullptr}; size_t data_size = get_data_size(); if (has_external_data()) { @@ -257,7 +257,7 @@ private: !std::is_same::value && !std::is_same::value && !std::is_same::value, bool>::type = true> - std::shared_ptr make_ov_constant(const element::Type& type) const { + std::shared_ptr make_ov_constant(const ov::element::Type& type) const { std::shared_ptr constant{nullptr}; auto data = get_data(); auto data_size = data.size(); diff --git a/src/frontends/onnx/frontend/src/core/value_info.hpp b/src/frontends/onnx/frontend/src/core/value_info.hpp index f369d0d70ca..567325dd13e 100644 --- a/src/frontends/onnx/frontend/src/core/value_info.hpp +++ b/src/frontends/onnx/frontend/src/core/value_info.hpp @@ -44,7 +44,7 @@ public: const ov::PartialShape& get_shape() const { return m_partial_shape; } - const element::Type& get_element_type() const { + const ov::element::Type& get_element_type() const { if (m_value_info_proto->type().tensor_type().has_elem_type()) { return common::get_ov_element_type(m_value_info_proto->type().tensor_type().elem_type()); } diff --git a/src/frontends/onnx/frontend/src/editor.cpp b/src/frontends/onnx/frontend/src/editor.cpp index 906675a0e49..b3b0d28f99c 100644 --- a/src/frontends/onnx/frontend/src/editor.cpp +++ b/src/frontends/onnx/frontend/src/editor.cpp @@ -69,7 +69,7 @@ ValueInfoProto* find_graph_value_info(GraphProto& graph, const std::string& name return nullptr; } -void modify_input_type(ValueInfoProto& onnx_input, const element::Type_t elem_type) { +void modify_input_type(ValueInfoProto& onnx_input, const ov::element::Type_t elem_type) { OPENVINO_ASSERT(onnx_input.has_type(), "The input is malformed - it doesn't contain the 'type' field. Cannot change the " "data type. Input name: ", @@ -87,7 +87,7 @@ void modify_input_type(ValueInfoProto& onnx_input, const element::Type_t elem_ty "The input type for input '", onnx_input.name(), "' cannot be set to: ", - element::Type(elem_type).get_type_name(), + ov::element::Type(elem_type).get_type_name(), ". This type is not allowed in ONNX."); tensor_type->set_elem_type(ov_to_onnx_data_type(elem_type)); } @@ -147,7 +147,7 @@ void modify_initializer(TensorProto& initializer, "Initializer '", name, "' type cannot be set to: ", - element::Type(elem_type).get_type_name(), + ov::element::Type(elem_type).get_type_name(), ". This type is not allowed in ONNX."); initializer.Clear(); @@ -364,7 +364,7 @@ void onnx_editor::ONNXModelEditor::serialize(const std::string& out_file_path) c out_file.close(); } -void onnx_editor::ONNXModelEditor::set_input_types(const std::map& input_types) { +void onnx_editor::ONNXModelEditor::set_input_types(const std::map& input_types) { auto* onnx_graph = m_pimpl->m_model_proto->mutable_graph(); for (const auto& input_desc : input_types) { @@ -377,7 +377,7 @@ void onnx_editor::ONNXModelEditor::set_input_types(const std::mapm_model_proto->mutable_graph(); auto* onnx_input = find_graph_input(*onnx_graph, tensor_name); diff --git a/src/frontends/onnx/frontend/src/editor.hpp b/src/frontends/onnx/frontend/src/editor.hpp index 1a6a5faf60c..477dbda9480 100644 --- a/src/frontends/onnx/frontend/src/editor.hpp +++ b/src/frontends/onnx/frontend/src/editor.hpp @@ -62,7 +62,7 @@ public: /// used to modified the ONNX model loaded from a file. This method /// throws an exception if the model doesn't contain any of /// the inputs specified in its parameter. - void set_input_types(const std::map& input_types); + void set_input_types(const std::map& input_types); /// \brief Modifies the in-memory representation of the model by setting /// custom input shapes for all inputs specified in the provided map. @@ -300,7 +300,7 @@ public: /// /// \param output_edge Name of tensor for which element type will be returned. /// - element::Type_t get_input_type(const std::string& tensor_name) const; + ov::element::Type_t get_input_type(const std::string& tensor_name) const; private: void update_mapper_if_needed() const; diff --git a/src/frontends/onnx/frontend/src/input_model.cpp b/src/frontends/onnx/frontend/src/input_model.cpp index 29ffcccbd63..f671188780d 100644 --- a/src/frontends/onnx/frontend/src/input_model.cpp +++ b/src/frontends/onnx/frontend/src/input_model.cpp @@ -237,7 +237,7 @@ ov::element::Type InputModel::get_element_type(const ov::frontend::Place::Ptr& p return m_editor->get_input_type(tensor_name); } // now we can return the concrete element type only for model inputs - return element::undefined; + return ov::element::undefined; } std::shared_ptr InputModel::decode() { diff --git a/src/frontends/onnx/frontend/src/op/aten.cpp b/src/frontends/onnx/frontend/src/op/aten.cpp index 9b7128b8a22..1327cb7bee0 100644 --- a/src/frontends/onnx/frontend/src/op/aten.cpp +++ b/src/frontends/onnx/frontend/src/op/aten.cpp @@ -70,7 +70,7 @@ OutputVector aten(const Node& node) { // Shape aligned node, filled with zeros const auto zero_of_data_type_const = std::make_shared(data_type, Shape{1}, 0); const auto weights_shape_node = std::make_shared(emb_tbl_in, ind_type); - const auto weights_last_dim_idx = std::make_shared(element::i32, Shape{1}, -1); + const auto weights_last_dim_idx = std::make_shared(ov::element::i32, Shape{1}, -1); const auto weights_last_dim = std::make_shared(weights_shape_node, weights_last_dim_idx, zero_const); const auto zero_col_node = std::make_shared(zero_of_data_type_const, weights_last_dim); diff --git a/src/frontends/onnx/frontend/src/op/blackmanwindow.cpp b/src/frontends/onnx/frontend/src/op/blackmanwindow.cpp index b50af889a53..8f1eb3afc7e 100644 --- a/src/frontends/onnx/frontend/src/op/blackmanwindow.cpp +++ b/src/frontends/onnx/frontend/src/op/blackmanwindow.cpp @@ -70,7 +70,7 @@ OutputVector blackmanwindow(const Node& node) { const auto scaled_cos_2 = std::make_shared(cos_2, a_2); const auto y_values = std::make_shared(std::make_shared(a_0, scaled_cos_1), scaled_cos_2); - if (output_datatype == element::f32) { + if (output_datatype == ov::element::f32) { return {y_values}; } else { return {std::make_shared(y_values, output_datatype)}; @@ -80,4 +80,4 @@ OutputVector blackmanwindow(const Node& node) { } // namespace op } // namespace onnx_import } // namespace ngraph -OPENVINO_SUPPRESS_DEPRECATED_END \ No newline at end of file +OPENVINO_SUPPRESS_DEPRECATED_END diff --git a/src/frontends/onnx/frontend/src/op/cast.cpp b/src/frontends/onnx/frontend/src/op/cast.cpp index 4e1d01f26f6..850b6b47d6c 100644 --- a/src/frontends/onnx/frontend/src/op/cast.cpp +++ b/src/frontends/onnx/frontend/src/op/cast.cpp @@ -18,7 +18,7 @@ namespace set_1 { OutputVector cast(const Node& node) { auto data = node.get_ng_inputs().at(0); int64_t target_type = node.get_attribute_value("to"); - element::Type elem_type = common::get_ov_element_type(target_type); + ov::element::Type elem_type = common::get_ov_element_type(target_type); return {std::make_shared(data, elem_type)}; } diff --git a/src/frontends/onnx/frontend/src/op/clip.cpp b/src/frontends/onnx/frontend/src/op/clip.cpp index cbef8d9391c..ef1edfefddd 100644 --- a/src/frontends/onnx/frontend/src/op/clip.cpp +++ b/src/frontends/onnx/frontend/src/op/clip.cpp @@ -75,7 +75,7 @@ std::shared_ptr get_constant_max_of_type(ov::element::Type OutputVector clip(const Node& node) { const OutputVector inputs{node.get_ng_inputs()}; const ov::Output data = inputs.at(0); - const element::Type data_type = data.get_element_type(); + const ov::element::Type data_type = data.get_element_type(); ov::Output min; ov::Output max; diff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/attention.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/attention.cpp index 194bd3edd36..bd9f8f02e24 100644 --- a/src/frontends/onnx/frontend/src/op/com.microsoft/attention.cpp +++ b/src/frontends/onnx/frontend/src/op/com.microsoft/attention.cpp @@ -119,8 +119,8 @@ namespace detail { namespace { std::shared_ptr get_dimensions(const std::shared_ptr& shape, const std::vector& dims) { - static const auto zero = v0::Constant::create(element::i32, Shape{}, {0}); - const auto dims_const = v0::Constant::create(element::i32, Shape{dims.size()}, dims); + static const auto zero = v0::Constant::create(ov::element::i32, Shape{}, {0}); + const auto dims_const = v0::Constant::create(ov::element::i32, Shape{dims.size()}, dims); return std::make_shared(shape, dims_const, zero); } @@ -130,9 +130,9 @@ std::shared_ptr get_dimensions(const std::shared_ptr& node, std::shared_ptr get_hidden_size(const std::shared_ptr& node_shape) { // node has shape (batch_size, sequence_length, 3 * hidden_size) - const auto zero = v0::Constant::create(element::i32, Shape{}, {0}); + const auto zero = v0::Constant::create(ov::element::i32, Shape{}, {0}); const auto hidden_size_x3 = get_dimensions(node_shape, {2}); - const auto three = v0::Constant::create(element::i64, Shape{}, {3}); + const auto three = v0::Constant::create(ov::element::i64, Shape{}, {3}); const auto hidden_size = std::make_shared(hidden_size_x3, three); return hidden_size; } @@ -147,7 +147,7 @@ NodeVector split_to_QKV(const std::shared_ptr& node, // node has shape (batch_size, sequence_length, 3 * hidden_size) // fetch the first two dimensions const auto batch_size_seq_len = get_dimensions(node_shape, {0, 1}); - const auto num_heads_node = v0::Constant::create(element::i64, Shape{1}, {num_heads}); + const auto num_heads_node = v0::Constant::create(ov::element::i64, Shape{1}, {num_heads}); if (qkv_hidden_sizes.size() == 0) { const auto hidden_size = get_hidden_size(node_shape); // head_size = hidden_size / num_heads @@ -177,7 +177,7 @@ NodeVector split_to_QKV(const std::shared_ptr& node, auto new_shape = std::make_shared( NodeVector{batch_size_seq_len, num_heads_node, - v0::Constant::create(element::i64, Shape{1}, {qkv_hidden_sizes[i] / num_heads})}, + v0::Constant::create(ov::element::i64, Shape{1}, {qkv_hidden_sizes[i] / num_heads})}, 0); split[i] = std::make_shared(split[i], new_shape, false); } @@ -187,7 +187,7 @@ NodeVector split_to_QKV(const std::shared_ptr& node, } // transpose Q, K and V to (batch_size, num_heads, sequence_len, head_size) - auto perm = v0::Constant::create(element::i64, Shape{4}, {0, 2, 1, 3}); + auto perm = v0::Constant::create(ov::element::i64, Shape{4}, {0, 2, 1, 3}); auto Q = std::make_shared(split[0], perm); auto K = std::make_shared(split[1], perm); auto V = std::make_shared(split[2], perm); @@ -266,42 +266,44 @@ NodeVector split_to_QKV(const std::shared_ptr& node, // know its dimensions upfront. So we compute both variants and use Select operator to select // the right one in the runtime (unless it gets constantfolded before). std::shared_ptr attention_mask_from_indices(const ov::Output& mask_index, - const element::Type_t& type, + const ov::element::Type_t& type, const std::shared_ptr& batch_size, const std::shared_ptr& all_seq_len) { - const auto zero = v0::Constant::create(element::i64, Shape{}, {0}); - const auto one = v0::Constant::create(element::i64, Shape{}, {1}); + const auto zero = v0::Constant::create(ov::element::i64, Shape{}, {0}); + const auto one = v0::Constant::create(ov::element::i64, Shape{}, {1}); const auto stop = std::make_shared(all_seq_len, zero); std::shared_ptr base = std::make_shared(zero, stop, one, mask_index.get_element_type()); const auto target_shape = std::make_shared(NodeVector{batch_size, all_seq_len}, 0); // broadcast 'base' to (batch_size, all_seq_len) base = std::make_shared(base, target_shape); const auto indices_shape = - std::make_shared(NodeVector{v0::Constant::create(element::i64, Shape{1}, {-1}), batch_size}, 0); + std::make_shared(NodeVector{v0::Constant::create(ov::element::i64, Shape{1}, {-1}), batch_size}, 0); std::shared_ptr indices = std::make_shared(mask_index, indices_shape, false); // fetch first row from indices std::shared_ptr tail_range_indices = std::make_shared(indices, zero, zero); - tail_range_indices = - std::make_shared(tail_range_indices, v0::Constant::create(element::i32, Shape{2}, {-1, 1}), false); + tail_range_indices = std::make_shared(tail_range_indices, + v0::Constant::create(ov::element::i32, Shape{2}, {-1, 1}), + false); const auto greater_eq = std::make_shared(base, tail_range_indices); std::shared_ptr tail_range_mask = std::make_shared(std::make_shared(greater_eq, type), v0::Constant::create(type, Shape{}, {-10000})); tail_range_mask = - std::make_shared(tail_range_mask, v0::Constant::create(element::i64, Shape{2}, {1, 2})); + std::make_shared(tail_range_mask, v0::Constant::create(ov::element::i64, Shape{2}, {1, 2})); - const auto gather_index = - std::make_shared(v0::Constant::create(element::i64, Shape{}, {1}), get_dimensions(indices, {0})); + const auto gather_index = std::make_shared(v0::Constant::create(ov::element::i64, Shape{}, {1}), + get_dimensions(indices, {0})); // fetch indices from the second row (or first if not available) std::shared_ptr head_range_indices = std::make_shared(indices, gather_index, zero); - head_range_indices = - std::make_shared(head_range_indices, v0::Constant::create(element::i32, Shape{2}, {-1, 1}), false); + head_range_indices = std::make_shared(head_range_indices, + v0::Constant::create(ov::element::i32, Shape{2}, {-1, 1}), + false); const auto less = std::make_shared(base, head_range_indices); std::shared_ptr mask = std::make_shared(less, greater_eq); mask = std::make_shared(std::make_shared(mask, type), v0::Constant::create(type, Shape{}, {-10000})); // reshape from (batch_size, all_seq_len) to (batch_size, 1, 1, all_seq_len) - mask = std::make_shared(mask, v0::Constant::create(element::i64, Shape{2}, {1, 2})); + mask = std::make_shared(mask, v0::Constant::create(ov::element::i64, Shape{2}, {1, 2})); const auto mask_index_first_dim = get_dimensions(mask_index.get_node_shared_ptr(), {0}); // compare mask_index.shape[0] with batch_size value @@ -338,20 +340,20 @@ std::shared_ptr attention_mask_from_indices(const ov::Output // // The approach used to generate those masks is similar to one from attention_mask_from_indices function (see comments // there). -NodeTuple unidirectional_mask(const element::Type_t& type, +NodeTuple unidirectional_mask(const ov::element::Type_t& type, const std::shared_ptr& seq_len, const std::shared_ptr& all_seq_len, const std::shared_ptr& past_seq_len) { - const auto zero = v0::Constant::create(element::i64, Shape{}, {0}); - const auto one = v0::Constant::create(element::i64, Shape{}, {1}); + const auto zero = v0::Constant::create(ov::element::i64, Shape{}, {0}); + const auto one = v0::Constant::create(ov::element::i64, Shape{}, {1}); const auto stop = std::make_shared(all_seq_len, zero); - std::shared_ptr bin_mask = std::make_shared(zero, stop, one, element::i32); + std::shared_ptr bin_mask = std::make_shared(zero, stop, one, ov::element::i32); auto target_shape = std::make_shared(NodeVector{seq_len, all_seq_len}, 0); bin_mask = std::make_shared(bin_mask, target_shape); auto start = std::make_shared(std::make_shared(past_seq_len, one), zero); auto end = std::make_shared(std::make_shared(all_seq_len, one), zero); - auto indices = std::make_shared(std::make_shared(start, end, one, element::i32), - v0::Constant::create(element::i32, Shape{1}, {1})); + auto indices = std::make_shared(std::make_shared(start, end, one, ov::element::i32), + v0::Constant::create(ov::element::i32, Shape{1}, {1})); bin_mask = std::make_shared(bin_mask, indices); std::shared_ptr attention_mask = std::make_shared(std::make_shared(bin_mask, type), @@ -373,7 +375,7 @@ NodeTuple unidirectional_mask(const element::Type_t& type, // https://github.com/microsoft/onnxruntime/blob/851554536ca8185b3413ee57449ea5ac93370193/onnxruntime/contrib_ops/cpu/bert/attention_helper.h#L78 std::shared_ptr raw_mask(const ov::Output& mask_index, ov::Dimension::value_type mask_rank, - const element::Type_t& type) { + const ov::element::Type_t& type) { std::shared_ptr mask = std::make_shared(mask_index, type); mask = std::make_shared(mask, type); mask = std::make_shared(v0::Constant::create(type, Shape{}, {1}), mask); @@ -382,12 +384,14 @@ std::shared_ptr raw_mask(const ov::Output& mask_index, // Handle mask_index with (batch_size, past_sequence_length + sequence_length) shape // Reshape it to (batch_size, 1, 1, past_sequence_length + sequence_length) case 2: - mask = std::make_shared(mask, v0::Constant::create(element::i64, Shape{4}, {0, 1, 1, -1}), true); + mask = + std::make_shared(mask, v0::Constant::create(ov::element::i64, Shape{4}, {0, 1, 1, -1}), true); break; // Handle mask_index with (batch_size, sequence_length, past_sequence_length + sequence_length) shape // Reshape it to (batch_size, 1, sequence_length, past_sequence_length + sequence_length) case 3: - mask = std::make_shared(mask, v0::Constant::create(element::i64, Shape{4}, {0, 1, 0, -1}), true); + mask = + std::make_shared(mask, v0::Constant::create(ov::element::i64, Shape{4}, {0, 1, 0, -1}), true); break; } return mask; @@ -398,8 +402,8 @@ bool is_past_input_available(const OutputVector& op_inputs) { } NodeTuple get_attention_mask(const OutputVector& op_inputs, bool unidirectional) { - const auto zero = v0::Constant::create(element::i64, Shape{1}, {0}); - const auto one = v0::Constant::create(element::i64, Shape{1}, {1}); + const auto zero = v0::Constant::create(ov::element::i64, Shape{1}, {0}); + const auto one = v0::Constant::create(ov::element::i64, Shape{1}, {1}); std::shared_ptr past_seq_len; // get the value of past_sequence_length @@ -423,7 +427,7 @@ NodeTuple get_attention_mask(const OutputVector& op_inputs, bool unidirectional) } if (op_inputs.size() > 3 && !ov::op::util::is_null(op_inputs[3])) { const auto& mask_index = op_inputs[3]; - FRONT_END_GENERAL_CHECK(mask_index.get_element_type() == element::i32, "'mask_index' type must be int32"); + FRONT_END_GENERAL_CHECK(mask_index.get_element_type() == ov::element::i32, "'mask_index' type must be int32"); auto batch_size = get_dimensions(input_shape, {0}); const auto mask_rank = mask_index.get_partial_shape().rank(); FRONT_END_GENERAL_CHECK(mask_rank.is_static(), "'mask_index' rank must be static"); @@ -458,7 +462,7 @@ std::shared_ptr attention_softmax(const OutputVector& op_inputs, const std::shared_ptr& bin_mask, const std::shared_ptr& head_size, bool unidirectional) { - auto zero = v0::Constant::create(element::i64, Shape{}, {0}); + auto zero = v0::Constant::create(ov::element::i64, Shape{}, {0}); if (is_past_input_available(op_inputs)) { // concat past K and V with present ones const auto& past = op_inputs[4]; @@ -502,9 +506,9 @@ std::shared_ptr attention_softmax(const OutputVector& op_inputs, std::shared_ptr output = std::make_shared(softmax, V); // transpose the result from (batch_size, num_heads, sequence_length, head_size) // to (batch_size, sequence_length, num_heads, head_size) - const auto perm = v0::Constant::create(element::i64, Shape{4}, {0, 2, 1, 3}); + const auto perm = v0::Constant::create(ov::element::i64, Shape{4}, {0, 2, 1, 3}); output = std::make_shared(output, perm); - auto new_shape = v0::Constant::create(element::i32, Shape{3}, {0, 0, -1}); + auto new_shape = v0::Constant::create(ov::element::i32, Shape{3}, {0, 0, -1}); // reshape the result from (batch_size, sequence_length, num_heads, head_size) to (batch_size, sequence_length, // num_heads * head_size) output = std::make_shared(output, new_shape, true); @@ -519,7 +523,7 @@ std::shared_ptr attention_softmax(const OutputVector& op_inputs, std::shared_ptr get_present_state(const std::shared_ptr& K, const std::shared_ptr& V, const OutputVector& op_inputs) { - auto zero = v0::Constant::create(element::i64, Shape{1}, {0}); + auto zero = v0::Constant::create(ov::element::i64, Shape{1}, {0}); // expand K shape (batch_size, num_heads, sequence_length, head_size) to // (1, batch_size, num_heads, sequence_length, head_size) auto K_unsqueezed = std::make_shared(K, zero); diff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/embed_layer_normalization.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/embed_layer_normalization.cpp index 13e63051a2d..6a2d9739b2b 100644 --- a/src/frontends/onnx/frontend/src/op/com.microsoft/embed_layer_normalization.cpp +++ b/src/frontends/onnx/frontend/src/op/com.microsoft/embed_layer_normalization.cpp @@ -28,7 +28,7 @@ OutputVector embed_layer_normalization(const Node& node) { FRONT_END_GENERAL_CHECK(num_nodes >= 7 && num_nodes <= 9, "EmbedLayerNormalization takes 7 or 9 inputs. Provided " + std::to_string(num_nodes)); - FRONT_END_GENERAL_CHECK(nodes[0].get_element_type() == element::i32, "input_ids must have int32 type"); + FRONT_END_GENERAL_CHECK(nodes[0].get_element_type() == ov::element::i32, "input_ids must have int32 type"); const auto& input_ids = nodes[0]; const auto& segment_ids = nodes[1]; @@ -38,7 +38,7 @@ OutputVector embed_layer_normalization(const Node& node) { const auto& gamma = nodes[5]; const auto& beta = nodes[6]; - const auto zero = v0::Constant::create(element::i32, Shape{1}, {0}); + const auto zero = v0::Constant::create(ov::element::i32, Shape{1}, {0}); std::shared_ptr input = std::make_shared(word_embeddings, input_ids, zero, 0); // add position embeddings if (num_nodes > 8 && !ov::op::util::is_null(nodes[8])) { @@ -54,8 +54,8 @@ OutputVector embed_layer_normalization(const Node& node) { // therefore input and position_embeddings cannot be added together // so we need slice the position_embeddings to [sequence_length, hidden_size] first // then add it with input. - const auto one = v0::Constant::create(element::i32, Shape{1}, {1}); - const auto input_ids_shape = std::make_shared(input_ids, element::i32); + const auto one = v0::Constant::create(ov::element::i32, Shape{1}, {1}); + const auto input_ids_shape = std::make_shared(input_ids, ov::element::i32); const auto seqlen = std::make_shared(input_ids_shape, one, zero, 0); const auto gathered_position_embeddings = std::make_shared(position_embeddings, zero, seqlen, one, zero); @@ -65,7 +65,7 @@ OutputVector embed_layer_normalization(const Node& node) { if (!ov::op::util::is_null(segment_ids)) { FRONT_END_GENERAL_CHECK(!ov::op::util::is_null(segment_embeddings), "segment_ids provided, but segment_embedding input is missing"); - FRONT_END_GENERAL_CHECK(nodes[1].get_element_type() == element::i32, "segment_ids must have int32 type"); + FRONT_END_GENERAL_CHECK(nodes[1].get_element_type() == ov::element::i32, "segment_ids must have int32 type"); auto gathered_segment_embeddings = std::make_shared(segment_embeddings, segment_ids, zero, 0); input = std::make_shared(input, gathered_segment_embeddings); } @@ -75,7 +75,7 @@ OutputVector embed_layer_normalization(const Node& node) { // hidden_size dimension is 2 here, because the shape after Gather(word_embedding, input_ids) // is (batch_size, seq_len, hidden_size) int hidden_size_dim = 2; - const auto reduction_axes = v0::Constant::create(element::i32, Shape{1}, {hidden_size_dim}); + const auto reduction_axes = v0::Constant::create(ov::element::i32, Shape{1}, {hidden_size_dim}); std::shared_ptr result = std::make_shared(input, reduction_axes, true, eps, ov::op::MVNEpsMode::INSIDE_SQRT); @@ -86,8 +86,8 @@ OutputVector embed_layer_normalization(const Node& node) { // compute mask_index output std::shared_ptr mask_index; if (num_nodes > 7 && !ov::op::util::is_null(nodes[7])) { - FRONT_END_GENERAL_CHECK(nodes[7].get_element_type() == element::i32, "mask must have int32 type"); - auto axis = v0::Constant::create(element::i32, Shape{}, {1}); + FRONT_END_GENERAL_CHECK(nodes[7].get_element_type() == ov::element::i32, "mask must have int32 type"); + auto axis = v0::Constant::create(ov::element::i32, Shape{}, {1}); mask_index = std::make_shared(nodes[7], axis, false); } else { auto batch_size = std::make_shared(std::make_shared(nodes[0]), diff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/fused_conv.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/fused_conv.cpp index 38c120b3326..3178599924a 100644 --- a/src/frontends/onnx/frontend/src/op/com.microsoft/fused_conv.cpp +++ b/src/frontends/onnx/frontend/src/op/com.microsoft/fused_conv.cpp @@ -50,14 +50,14 @@ OutputVector fused_conv(const Node& node) { CHECK_VALID_NODE(node, activation_params.size() == 1, "activation_alpha attribute of LeakyRelu activation function was not provided"); - const auto activation_alpha_node = v0::Constant::create(element::f32, Shape{}, activation_params); + const auto activation_alpha_node = v0::Constant::create(ov::element::f32, Shape{}, activation_params); return {std::make_shared(conv_res, activation_alpha_node)}; } else if (activation_type == "HardSigmoid") { CHECK_VALID_NODE(node, activation_params.size() == 2, "alpha and beta attributes of HardSigmoid activation function were not provided"); - const auto alpha = v0::Constant::create(element::f32, Shape{}, {activation_params[0]}); - const auto beta = v0::Constant::create(element::f32, Shape{}, {activation_params[1]}); + const auto alpha = v0::Constant::create(ov::element::f32, Shape{}, {activation_params[0]}); + const auto beta = v0::Constant::create(ov::element::f32, Shape{}, {activation_params[1]}); return {std::make_shared(conv_res, alpha, beta)}; } CHECK_VALID_NODE(node, diff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/skip_layer_normalization.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/skip_layer_normalization.cpp index 72d8dc57fb5..6d2e3622dfc 100644 --- a/src/frontends/onnx/frontend/src/op/com.microsoft/skip_layer_normalization.cpp +++ b/src/frontends/onnx/frontend/src/op/com.microsoft/skip_layer_normalization.cpp @@ -31,7 +31,7 @@ OutputVector skip_layer_normalization(const Node& node) { float eps = node.get_attribute_value("epsilon"); // reduce over hidden_size int hidden_size_dim = 2; - const auto reduction_axes = v0::Constant::create(element::i32, Shape{1}, {hidden_size_dim}); + const auto reduction_axes = v0::Constant::create(ov::element::i32, Shape{1}, {hidden_size_dim}); std::shared_ptr result = std::make_shared(input, reduction_axes, true, eps, ov::op::MVNEpsMode::INSIDE_SQRT); // multiply by gamma diff --git a/src/frontends/onnx/frontend/src/op/compress.cpp b/src/frontends/onnx/frontend/src/op/compress.cpp index 50141a03ef2..b590faaec8e 100644 --- a/src/frontends/onnx/frontend/src/op/compress.cpp +++ b/src/frontends/onnx/frontend/src/op/compress.cpp @@ -29,8 +29,8 @@ OutputVector compress(const Node& node) { data = std::make_shared(ov::op::util::flatten(data, static_cast(axis))); data = std::make_shared(ov::op::util::flatten(data, static_cast(axis))); } - auto axis_node = v0::Constant::create(element::i64, Shape{}, {axis}); - auto zero_node = v0::Constant::create(element::i64, Shape{}, {0}); + auto axis_node = v0::Constant::create(ov::element::i64, Shape{}, {axis}); + auto zero_node = v0::Constant::create(ov::element::i64, Shape{}, {0}); auto result = std::make_shared(data, std::make_shared(std::make_shared(condition), zero_node), diff --git a/src/frontends/onnx/frontend/src/op/constant.cpp b/src/frontends/onnx/frontend/src/op/constant.cpp index 087bbe5eaad..b102933624e 100644 --- a/src/frontends/onnx/frontend/src/op/constant.cpp +++ b/src/frontends/onnx/frontend/src/op/constant.cpp @@ -49,31 +49,31 @@ std::shared_ptr get_dense_tensor_as_constant(const std::vector(absolute_indices, values_tensor, shape); - case element::f32: + case ov::element::f32: return make_dense_tensor_as_constant(absolute_indices, values_tensor, shape); - case element::f16: + case ov::element::f16: return make_dense_tensor_as_constant(absolute_indices, values_tensor, shape); - case element::f64: + case ov::element::f64: return make_dense_tensor_as_constant(absolute_indices, values_tensor, shape); - case element::i8: + case ov::element::i8: return make_dense_tensor_as_constant(absolute_indices, values_tensor, shape); - case element::i16: + case ov::element::i16: return make_dense_tensor_as_constant(absolute_indices, values_tensor, shape); - case element::i32: + case ov::element::i32: return make_dense_tensor_as_constant(absolute_indices, values_tensor, shape); - case element::i64: + case ov::element::i64: return make_dense_tensor_as_constant(absolute_indices, values_tensor, shape); - case element::u8: + case ov::element::u8: return make_dense_tensor_as_constant(absolute_indices, values_tensor, shape); - case element::u16: + case ov::element::u16: return make_dense_tensor_as_constant(absolute_indices, values_tensor, shape); - case element::u32: + case ov::element::u32: return make_dense_tensor_as_constant(absolute_indices, values_tensor, shape); - case element::u64: + case ov::element::u64: return make_dense_tensor_as_constant(absolute_indices, values_tensor, shape); - case element::bf16: + case ov::element::bf16: return make_dense_tensor_as_constant(absolute_indices, values_tensor, shape); default: FRONT_END_THROW("Tensor has an unsupported data type"); @@ -125,15 +125,15 @@ OutputVector constant(const onnx_import::Node& node) { auto& attribute = node.get_attribute(attributes_names[0]); if (attribute.is_float()) { - return {v0::Constant::create(element::f32, ov::Shape{}, {attribute.get_float()})}; + return {v0::Constant::create(ov::element::f32, ov::Shape{}, {attribute.get_float()})}; } else if (attribute.is_float_array()) { auto values = attribute.get_float_array(); - return {v0::Constant::create(element::f32, ov::Shape{values.size()}, values)}; + return {v0::Constant::create(ov::element::f32, ov::Shape{values.size()}, values)}; } else if (attribute.is_integer()) { - return {v0::Constant::create(element::i64, ov::Shape{}, {attribute.get_integer()})}; + return {v0::Constant::create(ov::element::i64, ov::Shape{}, {attribute.get_integer()})}; } else if (attribute.is_integer_array()) { auto values = attribute.get_integer_array(); - return {v0::Constant::create(element::i64, ov::Shape{values.size()}, values)}; + return {v0::Constant::create(ov::element::i64, ov::Shape{values.size()}, values)}; } else if (attribute.is_sparse_tensor()) { auto sparse_tensor = attribute.get_sparse_tensor(); const Tensor& values_tensor = sparse_tensor.get_values(); diff --git a/src/frontends/onnx/frontend/src/op/constant_of_shape.cpp b/src/frontends/onnx/frontend/src/op/constant_of_shape.cpp index a4a3af5e086..a79feb67393 100644 --- a/src/frontends/onnx/frontend/src/op/constant_of_shape.cpp +++ b/src/frontends/onnx/frontend/src/op/constant_of_shape.cpp @@ -26,7 +26,7 @@ OutputVector constant_of_shape(const onnx_import::Node& node) { constant_value = value_tensor.get_ov_constant(); constant_value = reshape::interpret_as_scalar(constant_value); } else { - constant_value = v0::Constant::create(element::f32, {}, {0}); + constant_value = v0::Constant::create(ov::element::f32, {}, {0}); } const auto& inputs = node.get_ng_inputs(); if (inputs.size() == 0 || common::is_failsafe_node(inputs[0].get_node_shared_ptr()) || diff --git a/src/frontends/onnx/frontend/src/op/conv_integer.cpp b/src/frontends/onnx/frontend/src/op/conv_integer.cpp index 4f6c2b057c3..3796a7409ae 100644 --- a/src/frontends/onnx/frontend/src/op/conv_integer.cpp +++ b/src/frontends/onnx/frontend/src/op/conv_integer.cpp @@ -26,17 +26,17 @@ std::shared_ptr get_filter_zero_point(const OutputVector& inputs) { const auto filter_zero_point_rank = original_zero_point.get_partial_shape().rank(); if (filter_zero_point_rank.is_static() && filter_zero_point_rank.get_length() == 0) { - return std::make_shared(original_zero_point, element::i32); + return std::make_shared(original_zero_point, ov::element::i32); } else { // in case of 1D zero point filter, it has to be unsqueezed to match the data input's rank - const auto& converted_filter_zero_point = std::make_shared(original_zero_point, element::i32); - const auto& input_shape = std::make_shared(inputs.at(0), element::i32); - const auto& input_rank = std::make_shared(input_shape, element::i32); + const auto& converted_filter_zero_point = std::make_shared(original_zero_point, ov::element::i32); + const auto& input_shape = std::make_shared(inputs.at(0), ov::element::i32); + const auto& input_rank = std::make_shared(input_shape, ov::element::i32); const auto& input_rank_scalar = reshape::interpret_as_scalar(input_rank); const auto& one_node = v0::Constant::create(ov::element::i32, {}, {1}); const auto& missing_dimensions = - std::make_shared(one_node, input_rank_scalar, one_node, element::i32); + std::make_shared(one_node, input_rank_scalar, one_node, ov::element::i32); return std::make_shared(converted_filter_zero_point, missing_dimensions); } @@ -52,10 +52,10 @@ OutputVector conv_integer(const Node& node) { const auto& filter = inputs.at(1); const auto& input_zero_point = (inputs.size() > 2) ? inputs.at(2) : v0::Constant::create(ov::element::i32, {}, {0}); - const auto& converted_input = std::make_shared(input, element::i32); - const auto& converted_filter = std::make_shared(filter, element::i32); + const auto& converted_input = std::make_shared(input, ov::element::i32); + const auto& converted_filter = std::make_shared(filter, ov::element::i32); - const auto& converted_input_zero_point = std::make_shared(input_zero_point, element::i32); + const auto& converted_input_zero_point = std::make_shared(input_zero_point, ov::element::i32); const auto& filter_zero_point = get_filter_zero_point(inputs); const auto& shifted_input = std::make_shared(converted_input, converted_input_zero_point); diff --git a/src/frontends/onnx/frontend/src/op/conv_transpose.cpp b/src/frontends/onnx/frontend/src/op/conv_transpose.cpp index b20b21c8dfc..a08514d5656 100644 --- a/src/frontends/onnx/frontend/src/op/conv_transpose.cpp +++ b/src/frontends/onnx/frontend/src/op/conv_transpose.cpp @@ -49,7 +49,7 @@ ov::Output make_group_conv_backprop(const ov::Output& data, return std::make_shared( data, filters, - v0::Constant::create(element::i64, Shape{output_shape.size()}, output_shape), + v0::Constant::create(ov::element::i64, Shape{output_shape.size()}, output_shape), strides, dilations, auto_pad_type, @@ -80,7 +80,7 @@ ov::Output make_conv_backprop(const ov::Output& data, return std::make_shared( data, filters, - v0::Constant::create(element::i64, Shape{output_shape.size()}, output_shape), + v0::Constant::create(ov::element::i64, Shape{output_shape.size()}, output_shape), strides, pads_begin, pads_end, @@ -99,14 +99,14 @@ ov::Output get_prepared_bias(const ov::Output& bias, const o Shape new_bias_shape(conv_pshape.rank().get_length(), 1); new_bias_shape[1] = conv_pshape[1].get_length(); - bias_shape_node = v0::Constant::create(element::i64, Shape{new_bias_shape.size()}, new_bias_shape); + bias_shape_node = v0::Constant::create(ov::element::i64, Shape{new_bias_shape.size()}, new_bias_shape); } else { const auto conv_shape = std::make_shared(conv); const auto conv_rank = std::make_shared(conv_shape); // Prepare new bias shape base: [1, 1, 1, 1, ... ] - const auto one_node = v0::Constant::create(element::i64, Shape{1}, {1}); - const auto two_node = v0::Constant::create(element::i64, Shape{1}, {2}); + const auto one_node = v0::Constant::create(ov::element::i64, Shape{1}, {1}); + const auto two_node = v0::Constant::create(ov::element::i64, Shape{1}, {2}); const auto remaining_shape_length = std::make_shared(conv_rank, two_node); const auto remaining_bias_shape_ones = std::make_shared(one_node, remaining_shape_length); diff --git a/src/frontends/onnx/frontend/src/op/cum_sum.cpp b/src/frontends/onnx/frontend/src/op/cum_sum.cpp index 91e793bfa42..09d131b37f2 100644 --- a/src/frontends/onnx/frontend/src/op/cum_sum.cpp +++ b/src/frontends/onnx/frontend/src/op/cum_sum.cpp @@ -27,7 +27,7 @@ OutputVector cum_sum(const Node& node) { const auto& axis_shape = inputs.at(1).get_partial_shape(); axis = axis_shape.is_dynamic() ? inputs.at(1) : ngraph::onnx_import::reshape::interpret_as_scalar(inputs.at(1)); } else { - axis = v0::Constant::create(element::i64, Shape{}, {0}); // default + axis = v0::Constant::create(ov::element::i64, Shape{}, {0}); // default } return OutputVector{std::make_shared(data, axis, exclusive, reverse)}; } diff --git a/src/frontends/onnx/frontend/src/op/dequantize_linear.cpp b/src/frontends/onnx/frontend/src/op/dequantize_linear.cpp index 80e802cde77..2d10b6db094 100644 --- a/src/frontends/onnx/frontend/src/op/dequantize_linear.cpp +++ b/src/frontends/onnx/frontend/src/op/dequantize_linear.cpp @@ -28,8 +28,8 @@ std::shared_ptr get_zero_point(const OutputVector& inputs) { if (inputs.size() == 3 && !ov::op::util::is_null(inputs[2])) { const auto& zero_point = inputs[2]; - if (zero_point.get_element_type() != element::f32) { - return std::make_shared(zero_point, element::f32); + if (zero_point.get_element_type() != ov::element::f32) { + return std::make_shared(zero_point, ov::element::f32); } return zero_point.get_node_shared_ptr(); @@ -49,9 +49,9 @@ OutputVector dequantize_linear(const Node& node) { const auto& scale = inputs[1]; const auto zero_point = detail::get_zero_point(inputs); - common::validate_scalar_input("Dequantization scale", scale.get_node_shared_ptr(), {element::f32}); + common::validate_scalar_input("Dequantization scale", scale.get_node_shared_ptr(), {ov::element::f32}); - const auto converted_x = std::make_shared(x, element::f32); + const auto converted_x = std::make_shared(x, ov::element::f32); if (zero_point) { common::validate_scalar_input("Zero point", zero_point); @@ -131,7 +131,7 @@ std::shared_ptr reshape_input(const ov::Output& input, target_dims.push_back(1); } - const auto target_shape = v0::Constant::create(element::i64, Shape{target_dims.size()}, target_dims); + const auto target_shape = v0::Constant::create(ov::element::i64, Shape{target_dims.size()}, target_dims); return std::make_shared(input, target_shape, true); } @@ -149,7 +149,7 @@ OutputVector dequantize_linear(const ov::Output& x, validate_scale(scale, x, axis); const auto scale_reshaped = reshape_input(scale, axis, x_shape); - const auto converted_x = std::make_shared(x, element::f32); + const auto converted_x = std::make_shared(x, ov::element::f32); if (zero_point) { validate_zero_point(zero_point, x, axis); diff --git a/src/frontends/onnx/frontend/src/op/dynamic_quantize_linear.cpp b/src/frontends/onnx/frontend/src/op/dynamic_quantize_linear.cpp index 2786d5f2303..1dc64c75a89 100644 --- a/src/frontends/onnx/frontend/src/op/dynamic_quantize_linear.cpp +++ b/src/frontends/onnx/frontend/src/op/dynamic_quantize_linear.cpp @@ -29,34 +29,34 @@ namespace ngraph { namespace onnx_import { namespace { std::shared_ptr find_min_value(const ov::Output& input) { - const auto& zero_node = v0::Constant::create(element::i64, Shape{}, {0}); - const auto& one_node = v0::Constant::create(element::i64, Shape{}, {1}); + const auto& zero_node = v0::Constant::create(ov::element::i64, Shape{}, {0}); + const auto& one_node = v0::Constant::create(ov::element::i64, Shape{}, {1}); const auto& input_shape = std::make_shared(input); const auto& input_rank = std::make_shared(input_shape); const auto& input_rank_as_scalar = std::make_shared(input_rank); - const auto& reduce_axes = std::make_shared(zero_node, input_rank_as_scalar, one_node, element::i64); + const auto& reduce_axes = std::make_shared(zero_node, input_rank_as_scalar, one_node, ov::element::i64); const auto& input_min = std::make_shared(input, reduce_axes); - const auto& zero_node_u8 = v0::Constant::create(element::f32, Shape{}, {0}); + const auto& zero_node_u8 = v0::Constant::create(ov::element::f32, Shape{}, {0}); return std::make_shared(zero_node_u8, input_min); } std::shared_ptr find_max_value(const ov::Output& input) { - const auto& zero_node = v0::Constant::create(element::i64, Shape{}, {0}); - const auto& one_node = v0::Constant::create(element::i64, Shape{}, {1}); + const auto& zero_node = v0::Constant::create(ov::element::i64, Shape{}, {0}); + const auto& one_node = v0::Constant::create(ov::element::i64, Shape{}, {1}); const auto& input_shape = std::make_shared(input); const auto& input_rank = std::make_shared(input_shape); const auto& input_rank_as_scalar = std::make_shared(input_rank); - const auto& reduce_axes = std::make_shared(zero_node, input_rank_as_scalar, one_node, element::i64); + const auto& reduce_axes = std::make_shared(zero_node, input_rank_as_scalar, one_node, ov::element::i64); const auto& input_max = std::make_shared(input, reduce_axes); - const auto& zero_node_u8 = v0::Constant::create(element::f32, Shape{}, {0}); + const auto& zero_node_u8 = v0::Constant::create(ov::element::f32, Shape{}, {0}); return std::make_shared(zero_node_u8, input_max); } @@ -83,8 +83,8 @@ OutputVector dynamic_quantize_linear(const Node& node) { const auto& x = inputs.at(0); // quantization range in case of uint8 is [0, 255] - const auto& quant_range_min = v0::Constant::create(element::f32, Shape{}, {0}); - const auto& quant_range_max = v0::Constant::create(element::f32, Shape{}, {255}); + const auto& quant_range_min = v0::Constant::create(ov::element::f32, Shape{}, {0}); + const auto& quant_range_max = v0::Constant::create(ov::element::f32, Shape{}, {255}); const auto& quant_range_span = std::make_shared(quant_range_max, quant_range_min); const auto& x_max = find_max_value(x); diff --git a/src/frontends/onnx/frontend/src/op/expand.cpp b/src/frontends/onnx/frontend/src/op/expand.cpp index ccddf49c344..605cec0e248 100644 --- a/src/frontends/onnx/frontend/src/op/expand.cpp +++ b/src/frontends/onnx/frontend/src/op/expand.cpp @@ -23,7 +23,7 @@ OutputVector expand(const Node& node) { // in case the "shape" input is connected to a failsafe node created in place of an invalid initializer // the target shape should be ignored and this Expand operation should not modify its input tensor // the Broadcast created below should be eliminated later on by an appropriate optimization pass - const auto identity_broadcast = v0::Constant::create(element::i64, Shape{1}, {1}); + const auto identity_broadcast = v0::Constant::create(ov::element::i64, Shape{1}, {1}); return {std::make_shared(data, identity_broadcast, ov::op::BroadcastType::BIDIRECTIONAL)}; } else { return {std::make_shared(data, shape, ov::op::BroadcastType::BIDIRECTIONAL)}; diff --git a/src/frontends/onnx/frontend/src/op/eye_like.cpp b/src/frontends/onnx/frontend/src/op/eye_like.cpp index 9712cd46d79..225b9432378 100644 --- a/src/frontends/onnx/frontend/src/op/eye_like.cpp +++ b/src/frontends/onnx/frontend/src/op/eye_like.cpp @@ -43,7 +43,7 @@ OutputVector eye_like(const Node& node) { input_rank.get_length(), " is unsupported, only 2D shapes are supported"); - element::Type target_type; + ov::element::Type target_type; if (node.has_attribute("dtype")) { std::int64_t dtype = node.get_attribute_value("dtype"); target_type = common::get_ov_element_type(dtype); diff --git a/src/frontends/onnx/frontend/src/op/gather.hpp b/src/frontends/onnx/frontend/src/op/gather.hpp index f56adcb5531..ddb4fa66fac 100644 --- a/src/frontends/onnx/frontend/src/op/gather.hpp +++ b/src/frontends/onnx/frontend/src/op/gather.hpp @@ -23,7 +23,7 @@ inline OutputVector gather(const Node& node) { return {std::make_shared(data, indices, - ov::op::v0::Constant::create(element::i64, Shape{}, {axis}))}; + ov::op::v0::Constant::create(ov::element::i64, Shape{}, {axis}))}; } } // namespace set_1 diff --git a/src/frontends/onnx/frontend/src/op/global_average_pool.cpp b/src/frontends/onnx/frontend/src/op/global_average_pool.cpp index 83ff50bb6c7..dc2f72e64ee 100644 --- a/src/frontends/onnx/frontend/src/op/global_average_pool.cpp +++ b/src/frontends/onnx/frontend/src/op/global_average_pool.cpp @@ -29,15 +29,15 @@ OutputVector global_average_pool(const Node& node) { // Expected spatial dims indexes: [2, 3, 4] auto data = node.get_ng_inputs()[0]; - const auto zero_node = v0::Constant::create(element::i64, Shape{}, {0}); - const auto one_node = v0::Constant::create(element::i64, Shape{}, {1}); - const auto two_node = v0::Constant::create(element::i64, Shape{}, {2}); + const auto zero_node = v0::Constant::create(ov::element::i64, Shape{}, {0}); + const auto one_node = v0::Constant::create(ov::element::i64, Shape{}, {1}); + const auto two_node = v0::Constant::create(ov::element::i64, Shape{}, {2}); const auto data_shape = std::make_shared(data); const auto data_rank = std::make_shared(data_shape); const auto data_rank_as_scalar = std::make_shared(data_rank); - const auto reduce_axes = std::make_shared(two_node, data_rank_as_scalar, one_node, element::i64); + const auto reduce_axes = std::make_shared(two_node, data_rank_as_scalar, one_node, ov::element::i64); return {std::make_shared(data, reduce_axes, true)}; } diff --git a/src/frontends/onnx/frontend/src/op/global_max_pool.cpp b/src/frontends/onnx/frontend/src/op/global_max_pool.cpp index 2a28a21eeb2..839917eb5e2 100644 --- a/src/frontends/onnx/frontend/src/op/global_max_pool.cpp +++ b/src/frontends/onnx/frontend/src/op/global_max_pool.cpp @@ -29,15 +29,15 @@ OutputVector global_max_pool(const Node& node) { // Expected spatial dims indexes: [2, 3, 4] auto data = node.get_ng_inputs()[0]; - const auto zero_node = v0::Constant::create(element::i64, Shape{}, {0}); - const auto one_node = v0::Constant::create(element::i64, Shape{}, {1}); - const auto two_node = v0::Constant::create(element::i64, Shape{}, {2}); + const auto zero_node = v0::Constant::create(ov::element::i64, Shape{}, {0}); + const auto one_node = v0::Constant::create(ov::element::i64, Shape{}, {1}); + const auto two_node = v0::Constant::create(ov::element::i64, Shape{}, {2}); const auto data_shape = std::make_shared(data); const auto data_rank = std::make_shared(data_shape); const auto data_rank_as_scalar = std::make_shared(data_rank); - const auto reduce_axes = std::make_shared(two_node, data_rank_as_scalar, one_node, element::i64); + const auto reduce_axes = std::make_shared(two_node, data_rank_as_scalar, one_node, ov::element::i64); return {std::make_shared(data, reduce_axes, true)}; } diff --git a/src/frontends/onnx/frontend/src/op/group_normalization.cpp b/src/frontends/onnx/frontend/src/op/group_normalization.cpp index 1217ed03232..7c7356f52c9 100644 --- a/src/frontends/onnx/frontend/src/op/group_normalization.cpp +++ b/src/frontends/onnx/frontend/src/op/group_normalization.cpp @@ -31,10 +31,10 @@ OutputVector group_normalization(const Node& node) { const auto eps = node.get_attribute_value("epsilon", 1e-05f); const auto num_groups = node.get_attribute_value("num_groups"); - const auto zero = v0::Constant::create(element::i64, Shape{1}, {0}); - const auto one = v0::Constant::create(element::i64, Shape{1}, {1}); + const auto zero = v0::Constant::create(ov::element::i64, Shape{1}, {0}); + const auto one = v0::Constant::create(ov::element::i64, Shape{1}, {1}); const auto c_dim = std::make_shared(std::make_shared(data), one, zero); - const auto g_dim = v0::Constant::create(element::i64, Shape{1}, {num_groups}); + const auto g_dim = v0::Constant::create(ov::element::i64, Shape{1}, {num_groups}); const auto c_g_div = std::make_shared(c_dim, g_dim); diff --git a/src/frontends/onnx/frontend/src/op/hammingwindow.cpp b/src/frontends/onnx/frontend/src/op/hammingwindow.cpp index f59b6e3e3bf..84b350643f4 100644 --- a/src/frontends/onnx/frontend/src/op/hammingwindow.cpp +++ b/src/frontends/onnx/frontend/src/op/hammingwindow.cpp @@ -61,7 +61,7 @@ OutputVector hammingwindow(const Node& node) { const auto cos = std::make_shared(factor); const auto scaled_cos = std::make_shared(cos, a_1); const auto y_values = std::make_shared(a_0, scaled_cos); - if (output_datatype == element::f32) { + if (output_datatype == ov::element::f32) { return {y_values}; } else { return {std::make_shared(y_values, output_datatype)}; @@ -71,4 +71,4 @@ OutputVector hammingwindow(const Node& node) { } // namespace op } // namespace onnx_import } // namespace ngraph -OPENVINO_SUPPRESS_DEPRECATED_END \ No newline at end of file +OPENVINO_SUPPRESS_DEPRECATED_END diff --git a/src/frontends/onnx/frontend/src/op/hannwindow.cpp b/src/frontends/onnx/frontend/src/op/hannwindow.cpp index 33d306636ee..9c733a9ce14 100644 --- a/src/frontends/onnx/frontend/src/op/hannwindow.cpp +++ b/src/frontends/onnx/frontend/src/op/hannwindow.cpp @@ -57,7 +57,7 @@ OutputVector hannwindow(const Node& node) { const auto cos = std::make_shared(factor); const auto scaled_cos = std::make_shared(cos, a_1); const auto y_values = std::make_shared(a_0, scaled_cos); - if (output_datatype == element::f32) { + if (output_datatype == ov::element::f32) { return {y_values}; } else { return {std::make_shared(y_values, output_datatype)}; @@ -67,4 +67,4 @@ OutputVector hannwindow(const Node& node) { } // namespace op } // namespace onnx_import } // namespace ngraph -OPENVINO_SUPPRESS_DEPRECATED_END \ No newline at end of file +OPENVINO_SUPPRESS_DEPRECATED_END diff --git a/src/frontends/onnx/frontend/src/op/hardmax.cpp b/src/frontends/onnx/frontend/src/op/hardmax.cpp index 876098fb935..faf89d2f0b8 100644 --- a/src/frontends/onnx/frontend/src/op/hardmax.cpp +++ b/src/frontends/onnx/frontend/src/op/hardmax.cpp @@ -37,9 +37,10 @@ OutputVector hardmax(const Node& node) { const auto coerced_tensor = ov::op::util::flatten(input, static_cast(axis)); const auto coerced_tensor_shape = std::make_shared(coerced_tensor); - ov::Output row_size = std::make_shared(coerced_tensor_shape, - ov::op::v0::Constant::create(element::i64, {1}, {1}), - ov::op::v0::Constant::create(element::i64, {}, {0})); + ov::Output row_size = + std::make_shared(coerced_tensor_shape, + ov::op::v0::Constant::create(ov::element::i64, {1}, {1}), + ov::op::v0::Constant::create(ov::element::i64, {}, {0})); row_size = ngraph::onnx_import::reshape::interpret_as_scalar(row_size); const auto indices_axis = 1; @@ -71,8 +72,8 @@ OutputVector hardmax(const Node& node) { const auto input_runtime_shape = std::make_shared(input); ov::Output row_size = std::make_shared(input_runtime_shape, - ov::op::v0::Constant::create(element::i64, {1}, {axis}), - ov::op::v0::Constant::create(element::i64, {}, {0})); + ov::op::v0::Constant::create(ov::element::i64, {1}, {axis}), + ov::op::v0::Constant::create(ov::element::i64, {}, {0})); row_size = ngraph::onnx_import::reshape::interpret_as_scalar(row_size); const auto topk = std::make_shared(input, diff --git a/src/frontends/onnx/frontend/src/op/instance_norm.cpp b/src/frontends/onnx/frontend/src/op/instance_norm.cpp index 7df746ee95a..361c137297d 100644 --- a/src/frontends/onnx/frontend/src/op/instance_norm.cpp +++ b/src/frontends/onnx/frontend/src/op/instance_norm.cpp @@ -28,9 +28,9 @@ OutputVector instance_norm(const Node& node) { const ov::PartialShape& bias_pshape = bias.get_partial_shape(); const float epsilon{node.get_attribute_value("epsilon", 1e-5f)}; - element::Type result_et; + ov::element::Type result_et; CHECK_VALID_NODE(node, - element::Type::merge(result_et, data.get_element_type(), scale.get_element_type()), + ov::element::Type::merge(result_et, data.get_element_type(), scale.get_element_type()), "Element types for data and scale input do not match (data element type: ", data.get_element_type(), ", scale element type: ", @@ -38,7 +38,7 @@ OutputVector instance_norm(const Node& node) { ")."); CHECK_VALID_NODE(node, - element::Type::merge(result_et, data.get_element_type(), bias.get_element_type()), + ov::element::Type::merge(result_et, data.get_element_type(), bias.get_element_type()), "Element types for data and bias input do not match (data element type: ", data.get_element_type(), ", bias element type: ", diff --git a/src/frontends/onnx/frontend/src/op/lp_norm.cpp b/src/frontends/onnx/frontend/src/op/lp_norm.cpp index 2f5978731ce..61a4ac4e962 100644 --- a/src/frontends/onnx/frontend/src/op/lp_norm.cpp +++ b/src/frontends/onnx/frontend/src/op/lp_norm.cpp @@ -34,7 +34,7 @@ OutputVector lp_norm(const Node& node) { p_norm, "Only normalization of 1st or 2nd order is supported."); - const auto normalize_axis_const = v0::Constant::create(element::i64, {}, {normalize_axis}); + const auto normalize_axis_const = v0::Constant::create(ov::element::i64, {}, {normalize_axis}); std::shared_ptr norm = ov::op::util::lp_norm(data, normalize_axis_const, static_cast(p_norm), 0.0f, true); diff --git a/src/frontends/onnx/frontend/src/op/lp_pool.cpp b/src/frontends/onnx/frontend/src/op/lp_pool.cpp index baeaa11c20b..143e13cb801 100644 --- a/src/frontends/onnx/frontend/src/op/lp_pool.cpp +++ b/src/frontends/onnx/frontend/src/op/lp_pool.cpp @@ -47,7 +47,7 @@ OutputVector global_lp_pool(const Node& node) { Shape output_shape(data_shape.rank().get_length(), 1); output_shape.at(0) = data_shape[0].get_length(); - const auto reshape_pattern = v0::Constant::create(element::i64, Shape{output_shape.size()}, output_shape); + const auto reshape_pattern = v0::Constant::create(ov::element::i64, Shape{output_shape.size()}, output_shape); slice = std::make_shared(slice, reshape_pattern, false); } diff --git a/src/frontends/onnx/frontend/src/op/lstm.cpp b/src/frontends/onnx/frontend/src/op/lstm.cpp index a949a0fea90..c739e534f47 100644 --- a/src/frontends/onnx/frontend/src/op/lstm.cpp +++ b/src/frontends/onnx/frontend/src/op/lstm.cpp @@ -69,17 +69,25 @@ struct LSTMNgInputMap { // Get dimensions needed for default inputs creation auto shape_of_x = std::make_shared(m_input_map[LSTMInput::LSTM_INPUT_X]); - auto axes = v0::Constant::create(element::Type_t::i32, Shape{1}, {0}); + auto axes = v0::Constant::create(ov::element::Type_t::i32, Shape{1}, {0}); auto batch_size_node = - std::make_shared(shape_of_x, v0::Constant::create(element::Type_t::i32, Shape{1}, {0}), axes); + std::make_shared(shape_of_x, + v0::Constant::create(ov::element::Type_t::i32, Shape{1}, {0}), + axes); auto seq_length_node = - std::make_shared(shape_of_x, v0::Constant::create(element::Type_t::i32, Shape{1}, {1}), axes); + std::make_shared(shape_of_x, + v0::Constant::create(ov::element::Type_t::i32, Shape{1}, {1}), + axes); auto shape_of_r = std::make_shared(m_input_map[LSTMInput::LSTM_INPUT_R]); auto num_directions_node = - std::make_shared(shape_of_r, v0::Constant::create(element::Type_t::i32, Shape{1}, {0}), axes); + std::make_shared(shape_of_r, + v0::Constant::create(ov::element::Type_t::i32, Shape{1}, {0}), + axes); auto hidden_size_node = - std::make_shared(shape_of_r, v0::Constant::create(element::Type_t::i32, Shape{1}, {2}), axes); + std::make_shared(shape_of_r, + v0::Constant::create(ov::element::Type_t::i32, Shape{1}, {2}), + axes); // ------ Optional inputs ------ // `B` - The bias tensor for input gate. @@ -96,10 +104,10 @@ struct LSTMNgInputMap { 1); } else { auto b_shape = std::make_shared( - OutputVector{ - num_directions_node, - std::make_shared(v0::Constant::create(element::Type_t::i64, Shape{1}, {gates_count}), - hidden_size_node)}, + OutputVector{num_directions_node, + std::make_shared( + v0::Constant::create(ov::element::Type_t::i64, Shape{1}, {gates_count}), + hidden_size_node)}, 0); m_input_map[LSTMInput::LSTM_INPUT_B] = std::make_shared( v0::Constant::create(m_input_map[LSTMInput::LSTM_INPUT_X].get_element_type(), Shape{}, {0}), @@ -150,7 +158,7 @@ struct LSTMNgInputMap { auto p_shape = std::make_shared( OutputVector{num_directions_node, std::make_shared( - v0::Constant::create(element::Type_t::i64, Shape{1}, {P_gates_count}), + v0::Constant::create(ov::element::Type_t::i64, Shape{1}, {P_gates_count}), hidden_size_node)}, 0); m_input_map[LSTMInput::LSTM_INPUT_P] = std::make_shared( diff --git a/src/frontends/onnx/frontend/src/op/matmul_integer.cpp b/src/frontends/onnx/frontend/src/op/matmul_integer.cpp index 9181ff6baf0..c0c3f33652b 100644 --- a/src/frontends/onnx/frontend/src/op/matmul_integer.cpp +++ b/src/frontends/onnx/frontend/src/op/matmul_integer.cpp @@ -25,11 +25,11 @@ OutputVector matmul_integer(const Node& node) { const auto& A_zero_point = (inputs.size() > 2) ? inputs.at(2) : v0::Constant::create(ov::element::i32, {1}, {0}); const auto& B_zero_point = (inputs.size() > 3) ? inputs.at(3) : v0::Constant::create(ov::element::i32, {1}, {0}); - const auto& converted_A = std::make_shared(A, element::i32); - const auto& converted_B = std::make_shared(B, element::i32); + const auto& converted_A = std::make_shared(A, ov::element::i32); + const auto& converted_B = std::make_shared(B, ov::element::i32); - const auto& converted_A_zero_point = std::make_shared(A_zero_point, element::i32); - const auto& converted_B_zero_point = std::make_shared(B_zero_point, element::i32); + const auto& converted_A_zero_point = std::make_shared(A_zero_point, ov::element::i32); + const auto& converted_B_zero_point = std::make_shared(B_zero_point, ov::element::i32); const auto& A_zero_point_rank = A_zero_point.get_partial_shape().rank(); diff --git a/src/frontends/onnx/frontend/src/op/max_roi_pool.cpp b/src/frontends/onnx/frontend/src/op/max_roi_pool.cpp index 86d1284d5f0..3a44c3ea351 100644 --- a/src/frontends/onnx/frontend/src/op/max_roi_pool.cpp +++ b/src/frontends/onnx/frontend/src/op/max_roi_pool.cpp @@ -19,9 +19,9 @@ OutputVector max_roi_pool(const Node& node) { const auto X = inputs.at(0); const auto rois = inputs.at(1); - FRONT_END_GENERAL_CHECK(X.get_element_type() == element::f16 || X.get_element_type() == element::f32 || - X.get_element_type() == element::f64, - "MaxRoiPool operator only supports float16, float32 and float64 datatypes."); + OPENVINO_ASSERT(X.get_element_type() == ov::element::f16 || X.get_element_type() == ov::element::f32 || + X.get_element_type() == ov::element::f64, + "MaxRoiPool operator only supports float16, float32 and float64 datatypes."); const auto pooled_shape = node.get_attribute_value>("pooled_shape"); const auto spatial_scale = node.get_attribute_value("spatial_scale", 1.0); diff --git a/src/frontends/onnx/frontend/src/op/mean_variance_normalization.cpp b/src/frontends/onnx/frontend/src/op/mean_variance_normalization.cpp index 679ee91250d..80d79e48af6 100644 --- a/src/frontends/onnx/frontend/src/op/mean_variance_normalization.cpp +++ b/src/frontends/onnx/frontend/src/op/mean_variance_normalization.cpp @@ -31,7 +31,7 @@ OutputVector mean_variance_normalization(const Node& node) { auto axes = node.get_attribute_value>("axes", {0, 2, 3}); const std::vector normalized_axes = ov::util::normalize_axes(node.get_description(), axes, data.get_partial_shape().rank()); - auto const_axes = v0::Constant::create(element::i64, Shape{normalized_axes.size()}, normalized_axes); + auto const_axes = v0::Constant::create(ov::element::i64, Shape{normalized_axes.size()}, normalized_axes); return {std::make_shared(data, const_axes, true, 1e-09f, ov::op::MVNEpsMode::OUTSIDE_SQRT)}; } diff --git a/src/frontends/onnx/frontend/src/op/nms_rotated.hpp b/src/frontends/onnx/frontend/src/op/nms_rotated.hpp index 160cbb30cf4..5141ae4409f 100644 --- a/src/frontends/onnx/frontend/src/op/nms_rotated.hpp +++ b/src/frontends/onnx/frontend/src/op/nms_rotated.hpp @@ -21,9 +21,9 @@ inline OutputVector nms_rotated(const Node& node) { auto iou_threshold = node.get_attribute_value("iou_threshold"); auto score_threshold = node.get_attribute_value("score_threshold"); auto max_output_boxes_per_class = - ov::op::v0::Constant::create(element::i64, Shape{1}, {std::numeric_limits::max()}); - auto iou_threshold_const = ov::op::v0::Constant::create(element::f32, Shape{}, {iou_threshold}); - auto score_threshold_const = ov::op::v0::Constant::create(element::f32, Shape{}, {score_threshold}); + ov::op::v0::Constant::create(ov::element::i64, Shape{1}, {std::numeric_limits::max()}); + auto iou_threshold_const = ov::op::v0::Constant::create(ov::element::f32, Shape{}, {iou_threshold}); + auto score_threshold_const = ov::op::v0::Constant::create(ov::element::f32, Shape{}, {score_threshold}); auto nms = std::make_shared(node.get_ng_inputs().at(0), node.get_ng_inputs().at(1), diff --git a/src/frontends/onnx/frontend/src/op/non_max_suppression.cpp b/src/frontends/onnx/frontend/src/op/non_max_suppression.cpp index 96dc378423b..b164e009a26 100644 --- a/src/frontends/onnx/frontend/src/op/non_max_suppression.cpp +++ b/src/frontends/onnx/frontend/src/op/non_max_suppression.cpp @@ -29,21 +29,21 @@ OutputVector non_max_suppression(const Node& node) { if (ng_inputs.size() > 2 && !is_null(ng_inputs.at(2))) { max_output_boxes_per_class = ngraph::onnx_import::reshape::interpret_as_scalar(ng_inputs.at(2)); } else { - max_output_boxes_per_class = v0::Constant::create(element::i64, Shape{}, {0}); + max_output_boxes_per_class = v0::Constant::create(ov::element::i64, Shape{}, {0}); } ov::Output iou_threshold; if (ng_inputs.size() > 3 && !is_null(ng_inputs.at(3))) { iou_threshold = ngraph::onnx_import::reshape::interpret_as_scalar(ng_inputs.at(3)); } else { - iou_threshold = v0::Constant::create(element::f32, Shape{}, {.0f}); + iou_threshold = v0::Constant::create(ov::element::f32, Shape{}, {.0f}); } ov::Output score_threshold; if (ng_inputs.size() > 4 && !is_null(ng_inputs.at(4))) { score_threshold = ngraph::onnx_import::reshape::interpret_as_scalar(ng_inputs.at(4)); } else { - score_threshold = v0::Constant::create(element::f32, Shape{}, {-std::numeric_limits::max()}); + score_threshold = v0::Constant::create(ov::element::f32, Shape{}, {-std::numeric_limits::max()}); } const auto center_point_box = node.get_attribute_value("center_point_box", 0); diff --git a/src/frontends/onnx/frontend/src/op/non_zero.cpp b/src/frontends/onnx/frontend/src/op/non_zero.cpp index 2c00062c443..a0cd419aea9 100644 --- a/src/frontends/onnx/frontend/src/op/non_zero.cpp +++ b/src/frontends/onnx/frontend/src/op/non_zero.cpp @@ -15,7 +15,7 @@ namespace op { namespace set_1 { OutputVector non_zero(const Node& node) { auto data = node.get_ng_inputs().at(0); - return {std::make_shared(data, element::i64)}; + return {std::make_shared(data, ov::element::i64)}; } } // namespace set_1 diff --git a/src/frontends/onnx/frontend/src/op/onehot.cpp b/src/frontends/onnx/frontend/src/op/onehot.cpp index 748ab4498bc..a4e146e5de6 100644 --- a/src/frontends/onnx/frontend/src/op/onehot.cpp +++ b/src/frontends/onnx/frontend/src/op/onehot.cpp @@ -19,11 +19,11 @@ namespace op { namespace set_1 { OutputVector onehot(const Node& node) { OutputVector inputs{node.get_ng_inputs()}; - auto indices = std::make_shared(inputs.at(0), element::i64); - auto depth = std::make_shared(reshape::interpret_as_scalar(inputs.at(1)), element::i64); + auto indices = std::make_shared(inputs.at(0), ov::element::i64); + auto depth = std::make_shared(reshape::interpret_as_scalar(inputs.at(1)), ov::element::i64); // Rank 1 tensor containing exactly two elements: [off_value, on_value] auto values = inputs.at(2); - auto split_axis = v0::Constant::create(element::i64, {}, {0}); + auto split_axis = v0::Constant::create(ov::element::i64, {}, {0}); auto off_on_values = std::make_shared(values, split_axis, 2); auto off_value = reshape::interpret_as_scalar(off_on_values->output(0)); auto on_value = reshape::interpret_as_scalar(off_on_values->output(1)); diff --git a/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/generate_proposals.cpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/generate_proposals.cpp index 0aa62afcfec..4eab01ca43d 100644 --- a/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/generate_proposals.cpp +++ b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/generate_proposals.cpp @@ -51,10 +51,10 @@ OutputVector generate_proposals(const Node& node) { attrs.normalized = !node.get_attribute_value("legacy_plus_one", true); // Broadcast anchors from [A, 4] to [H, W, A, 4] where [H, W] is taken from scores shape. - const auto zero = v0::Constant::create(element::i64, Shape{1}, {0}); + const auto zero = v0::Constant::create(ov::element::i64, Shape{1}, {0}); const auto scores_shape = std::make_shared(scores); const auto anchors_shape = std::make_shared(anchors); - const auto scores_shape_tail = v0::Constant::create(element::i64, Shape{2}, {2, 3}); + const auto scores_shape_tail = v0::Constant::create(ov::element::i64, Shape{2}, {2, 3}); const auto new_anchors_shape_front = std::make_shared(scores_shape, scores_shape_tail, zero); const auto new_anchors_shape = std::make_shared(OutputVector{new_anchors_shape_front, anchors_shape}, 0); diff --git a/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/normalize.cpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/normalize.cpp index 7c54595a271..7a1ada9dfda 100644 --- a/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/normalize.cpp +++ b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/normalize.cpp @@ -46,13 +46,13 @@ OutputVector normalize(const Node& node) { for (int64_t i = 2; i < data_shape.rank().get_length(); ++i) { weights_shape.push_back(1); } - auto new_shape = std::make_shared(element::i64, Shape{weights_shape.size()}, weights_shape); + auto new_shape = std::make_shared(ov::element::i64, Shape{weights_shape.size()}, weights_shape); weights = std::make_shared(inputs[1], new_shape, true); } std::shared_ptr axes; if (!across_spatial) { - axes = std::make_shared(element::i64, Shape{1}, std::vector{1}); + axes = std::make_shared(ov::element::i64, Shape{1}, std::vector{1}); } else { axes = common::get_monotonic_range_along_node_rank(data, 1); } diff --git a/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/prior_box.cpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/prior_box.cpp index e686bc345b4..6fbd4963f1f 100644 --- a/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/prior_box.cpp +++ b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/prior_box.cpp @@ -22,11 +22,12 @@ namespace op { namespace detail { namespace { std::shared_ptr make_slice(std::shared_ptr node, int64_t start, int64_t end) { - return std::make_shared(node, - v0::Constant::create(element::i64, Shape{1}, std::vector{start}), - v0::Constant::create(element::i64, Shape{1}, std::vector{end}), - std::vector{0}, // begin mask - std::vector{0}); // end mask + return std::make_shared( + node, + v0::Constant::create(ov::element::i64, Shape{1}, std::vector{start}), + v0::Constant::create(ov::element::i64, Shape{1}, std::vector{end}), + std::vector{0}, // begin mask + std::vector{0}); // end mask } } // namespace } // namespace detail @@ -56,7 +57,7 @@ OutputVector prior_box(const Node& node) { attrs.density = node.get_attribute_value>("density", {}); attrs.min_max_aspect_ratios_order = node.get_attribute_value("min_max_aspect_ratios_order", 1); - auto axes = v0::Constant::create(element::i64, Shape{1}, std::vector{0}); + auto axes = v0::Constant::create(ov::element::i64, Shape{1}, std::vector{0}); return { std::make_shared(std::make_shared(output_shape_slice, image_shape_slice, attrs), @@ -95,7 +96,7 @@ OutputVector prior_box_clustered(const Node& node) { attrs.step = node.get_attribute_value("step", 0.0f); attrs.offset = node.get_attribute_value("offset", 0.0f); - auto axes = v0::Constant::create(element::i64, Shape{1}, std::vector{0}); + auto axes = v0::Constant::create(ov::element::i64, Shape{1}, std::vector{0}); return {std::make_shared( std::make_shared(output_shape_slice, image_shape_slice, attrs), diff --git a/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/swish.cpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/swish.cpp index 2e28bb8e22f..1f66408c17c 100644 --- a/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/swish.cpp +++ b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/swish.cpp @@ -22,7 +22,7 @@ OutputVector swish(const Node& node) { if (ng_inputs.size() > 1) { beta = ngraph::onnx_import::reshape::interpret_as_scalar(ng_inputs.at(1)); } else { - beta = v0::Constant::create(element::f32, Shape{}, {1.0}); + beta = v0::Constant::create(ov::element::f32, Shape{}, {1.0}); } return {std::make_shared(ng_inputs.at(0), beta)}; diff --git a/src/frontends/onnx/frontend/src/op/pad.cpp b/src/frontends/onnx/frontend/src/op/pad.cpp index f9256818bea..fefcd5200c4 100644 --- a/src/frontends/onnx/frontend/src/op/pad.cpp +++ b/src/frontends/onnx/frontend/src/op/pad.cpp @@ -54,8 +54,8 @@ OutputVector pad(const Node& node) { return {std::make_shared( data, - std::make_shared(element::i64, ov::Shape{padding_below.size()}, padding_below), - std::make_shared(element::i64, ov::Shape{padding_above.size()}, padding_above), + std::make_shared(ov::element::i64, ov::Shape{padding_below.size()}, padding_below), + std::make_shared(ov::element::i64, ov::Shape{padding_above.size()}, padding_above), std::make_shared(data.get_element_type(), ov::Shape{}, std::vector{value}), pad_mode)}; } @@ -84,8 +84,8 @@ OutputVector pad(const Node& node) { std::vector padding_begin_values(pads_vector.begin(), pads_vector.begin() + half_size); std::vector padding_end_values(pads_vector.begin() + half_size, pads_vector.end()); - padding_begin = v0::Constant::create(element::i64, ov::Shape{half_size}, padding_begin_values); - padding_end = v0::Constant::create(element::i64, ov::Shape{half_size}, padding_end_values); + padding_begin = v0::Constant::create(ov::element::i64, ov::Shape{half_size}, padding_begin_values); + padding_end = v0::Constant::create(ov::element::i64, ov::Shape{half_size}, padding_end_values); } else { OutputVector padding = ov::op::util::split(pads, 2, 0); diff --git a/src/frontends/onnx/frontend/src/op/qlinear_conv.cpp b/src/frontends/onnx/frontend/src/op/qlinear_conv.cpp index 6e26505d4c3..6e961566d45 100644 --- a/src/frontends/onnx/frontend/src/op/qlinear_conv.cpp +++ b/src/frontends/onnx/frontend/src/op/qlinear_conv.cpp @@ -37,12 +37,12 @@ OutputVector qlinear_conv(const Node& node) { x = set_13::detail::dequantize_linear(x, x_scale, - std::make_shared(x_zero_point, element::f32), + std::make_shared(x_zero_point, ov::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, ov::element::f32), 1, node)[0]; diff --git a/src/frontends/onnx/frontend/src/op/qlinear_matmul.cpp b/src/frontends/onnx/frontend/src/op/qlinear_matmul.cpp index 04ed16c3d68..e52785b4e6a 100644 --- a/src/frontends/onnx/frontend/src/op/qlinear_matmul.cpp +++ b/src/frontends/onnx/frontend/src/op/qlinear_matmul.cpp @@ -32,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, ov::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, ov::element::f32), 1, node); diff --git a/src/frontends/onnx/frontend/src/op/quant_conv.cpp b/src/frontends/onnx/frontend/src/op/quant_conv.cpp index 299222de575..470934e42e1 100644 --- a/src/frontends/onnx/frontend/src/op/quant_conv.cpp +++ b/src/frontends/onnx/frontend/src/op/quant_conv.cpp @@ -59,16 +59,16 @@ namespace ngraph const OpZeroPoint& op_zero_point, const Output& bias = nullptr) { - ngraph::element::Type output_type; - if (data.get_element_type() == ngraph::element::u8 && - filters.get_element_type() == ngraph::element::i8) + ngraph:: ov::element::Type output_type; + if (data.get_element_type() == ngraph:: ov::element::u8 && + filters.get_element_type() == ngraph:: ov::element::i8) { - output_type = ngraph::element::i8; + output_type = ngraph:: ov::element::i8; } - else if (data.get_element_type() == ngraph::element::u8 && - filters.get_element_type() == ngraph::element::u8) + else if (data.get_element_type() == ngraph:: ov::element::u8 && + filters.get_element_type() == ngraph:: ov::element::u8) { - output_type = ngraph::element::u8; + output_type = ngraph:: ov::element::u8; } if (groups > 1) { diff --git a/src/frontends/onnx/frontend/src/op/quantize_linear.cpp b/src/frontends/onnx/frontend/src/op/quantize_linear.cpp index 5fdd3deb725..2cdce28a018 100644 --- a/src/frontends/onnx/frontend/src/op/quantize_linear.cpp +++ b/src/frontends/onnx/frontend/src/op/quantize_linear.cpp @@ -27,7 +27,7 @@ ov::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(ov::element::u8, Shape{1}, std::uint8_t(0)); } } @@ -35,8 +35,8 @@ void validate_zero_point_type(const Node& onnx_node, const ov::Output& const auto& y_zero_point_et = y_zero_point.get_element_type(); CHECK_VALID_NODE( onnx_node, - y_zero_point_et.is_static() && (y_zero_point_et == element::u8 || y_zero_point_et == element::i8 || - y_zero_point_et == element::u16 || y_zero_point_et == element::i16), + y_zero_point_et.is_static() && (y_zero_point_et == ov::element::u8 || y_zero_point_et == ov::element::i8 || + y_zero_point_et == ov::element::u16 || y_zero_point_et == ov::element::i16), "\"y_zero_point\" input data for QuantizeLinear operator must be one of the supported types: u8, i8, u16 or i16" "integer type."); } @@ -44,8 +44,8 @@ void validate_zero_point_type(const Node& onnx_node, const ov::Output& ov::Output validate_scale(const Node& onnx_node, const ov::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); + if (y_scale_et != ov::element::f32) { + return std::make_shared(y_scale, ov::element::f32); } return y_scale; } @@ -54,33 +54,34 @@ ov::Output validate_data(const Node& onnx_node, const ov::Output(data, element::f32); + if (data_et != ov::element::f32) { + return std::make_shared(data, ov::element::f32); } return data; } -std::tuple, std::shared_ptr> get_output_bands(const element::Type& destination_type, - const element::Type& data_type) { +std::tuple, std::shared_ptr> get_output_bands( + const ov::element::Type& destination_type, + const ov::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: + case ov::element::i8: output_low = std::make_shared(data_type, Shape{1}, -128); output_high = std::make_shared(data_type, Shape{1}, 127); break; - case element::u8: + case ov::element::u8: output_low = std::make_shared(data_type, Shape{1}, 0); output_high = std::make_shared(data_type, Shape{1}, 255); break; - case element::i16: + case ov::element::i16: output_low = std::make_shared(data_type, Shape{1}, -32768); output_high = std::make_shared(data_type, Shape{1}, 32767); break; - case element::u16: + case ov::element::u16: output_low = std::make_shared(data_type, Shape{1}, 0); output_high = std::make_shared(data_type, Shape{1}, 65535); break; @@ -97,7 +98,7 @@ std::tuple, std::shared_ptr> get_input_bands const ov::Output& y_zero_point, const std::shared_ptr& output_low, const std::shared_ptr& output_high, - const element::Type& data_type) { + const ov::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); @@ -117,8 +118,8 @@ std::tuple, std::shared_ptr> get_input_bands std::shared_ptr make_fake_quantize(const ov::Output& y_scale, const ov::Output& y_zero_point, const ov::Output& data) { - const element::Type& destination_type = y_zero_point.get_element_type(); - const element::Type& data_type = data.get_element_type(); + const ov::element::Type& destination_type = y_zero_point.get_element_type(); + const ov::element::Type& data_type = data.get_element_type(); std::shared_ptr output_low; std::shared_ptr output_high; diff --git a/src/frontends/onnx/frontend/src/op/reduce.cpp b/src/frontends/onnx/frontend/src/op/reduce.cpp index 2b8af72625b..c1093d53046 100644 --- a/src/frontends/onnx/frontend/src/op/reduce.cpp +++ b/src/frontends/onnx/frontend/src/op/reduce.cpp @@ -33,12 +33,12 @@ namespace { 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 = v0::Constant::create(element::i32, Shape{1}, {0}); + const auto scalar = v0::Constant::create(ov::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); + const auto start = v0::Constant::create(ov::element::i32, Shape{}, {0}); + const auto step = v0::Constant::create(ov::element::i32, Shape{}, {1}); + return std::make_shared(start, rank_of_input_scalar, step, ov::element::i64); } std::shared_ptr get_reduction_axes_from_input(const Node& node) { @@ -86,7 +86,7 @@ std::shared_ptr get_reduction_axes_from_attr(const Node& node) { ")"); } - return v0::Constant::create(element::i64, Shape{reduction_axes.size()}, reduction_axes); + return v0::Constant::create(ov::element::i64, Shape{reduction_axes.size()}, reduction_axes); } template diff --git a/src/frontends/onnx/frontend/src/op/reverse_sequence.cpp b/src/frontends/onnx/frontend/src/op/reverse_sequence.cpp index 5b03e079016..f4a4bae23b4 100644 --- a/src/frontends/onnx/frontend/src/op/reverse_sequence.cpp +++ b/src/frontends/onnx/frontend/src/op/reverse_sequence.cpp @@ -5,6 +5,7 @@ #include "op/reverse_sequence.hpp" #include "onnx_import/core/node.hpp" +#include "openvino/core/type/element_type.hpp" #include "openvino/frontend/exception.hpp" #include "openvino/op/convert.hpp" #include "openvino/op/reverse_sequence.hpp" @@ -22,7 +23,7 @@ OutputVector reverse_sequence(const Node& node) { const auto sequence_lengths = node.get_ng_inputs().at(1); // 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 sequence_lengths_i32 = std::make_shared(node.get_ng_inputs().at(1), ov::element::i32); const auto data_rank = data.get_partial_shape().rank(); const auto batch_axis = node.get_attribute_value("batch_axis", 1); diff --git a/src/frontends/onnx/frontend/src/op/scan.cpp b/src/frontends/onnx/frontend/src/op/scan.cpp index 1af00dc7b2e..892eae9f604 100644 --- a/src/frontends/onnx/frontend/src/op/scan.cpp +++ b/src/frontends/onnx/frontend/src/op/scan.cpp @@ -48,7 +48,7 @@ OutputVector scan_to_tensor_iterator(const OutputVector& node_inputs, for (int64_t i = 0; i < num_scan_inputs; ++i) { const auto in_idx = num_initial_values + i; auto axis = scan_input_axes[i]; - const auto axis_node = default_opset::Constant::create(element::i64, Shape{1}, {axis}); + const auto axis_node = default_opset::Constant::create(ov::element::i64, Shape{1}, {axis}); auto shape = node_inputs[in_idx + in_offset].get_partial_shape(); if (shape.rank().is_static()) { OPENVINO_SUPPRESS_DEPRECATED_START @@ -71,7 +71,7 @@ OutputVector scan_to_tensor_iterator(const OutputVector& node_inputs, for (size_t i = 0; i < num_scan_outputs; ++i) { const auto out_idx = num_initial_values + i; const auto axis = scan_output_axes[i]; - const auto axis_node = default_opset::Constant::create(element::i64, Shape{1}, {axis}); + const auto axis_node = default_opset::Constant::create(ov::element::i64, Shape{1}, {axis}); body_outputs[out_idx] = std::make_shared(body_outputs[out_idx], axis_node); } diff --git a/src/frontends/onnx/frontend/src/op/shape.cpp b/src/frontends/onnx/frontend/src/op/shape.cpp index da16ebbf022..b9884076e6b 100644 --- a/src/frontends/onnx/frontend/src/op/shape.cpp +++ b/src/frontends/onnx/frontend/src/op/shape.cpp @@ -8,8 +8,8 @@ #include "default_opset.hpp" #include "ngraph/node.hpp" -#include "ngraph/type/element_type.hpp" #include "op/shape.hpp" +#include "openvino/core/type/element_type.hpp" OPENVINO_SUPPRESS_DEPRECATED_START namespace ngraph { diff --git a/src/frontends/onnx/frontend/src/op/size.cpp b/src/frontends/onnx/frontend/src/op/size.cpp index 979cb46cc4e..ea389392687 100644 --- a/src/frontends/onnx/frontend/src/op/size.cpp +++ b/src/frontends/onnx/frontend/src/op/size.cpp @@ -10,7 +10,7 @@ #include "default_opset.hpp" #include "ngraph/shape.hpp" -#include "ngraph/type/element_type.hpp" +#include "openvino/core/type/element_type.hpp" OPENVINO_SUPPRESS_DEPRECATED_START namespace ngraph { @@ -19,7 +19,7 @@ namespace op { namespace set_1 { OutputVector size(const Node& node) { auto data = node.get_ng_inputs().at(0); - auto axes = default_opset::Constant::create(ngraph::element::i32, Shape{}, {0}); + auto axes = default_opset::Constant::create(ov::element::i32, Shape{}, {0}); auto input_shape = std::make_shared(data); return {std::make_shared(input_shape, axes)}; } diff --git a/src/frontends/onnx/frontend/src/op/slice.cpp b/src/frontends/onnx/frontend/src/op/slice.cpp index c0e9e021650..9405be6dcdf 100644 --- a/src/frontends/onnx/frontend/src/op/slice.cpp +++ b/src/frontends/onnx/frontend/src/op/slice.cpp @@ -32,9 +32,9 @@ OutputVector slice(const Node& node) { steps = inputs.at(4); } else { const auto& default_step = default_opset::Constant::create(starts.get_element_type(), {1}, {1}); - steps = - std::make_shared(default_step, - std::make_shared(starts, element::i64)); + steps = std::make_shared( + default_step, + std::make_shared(starts, ov::element::i64)); } if (axes_input_provided) { @@ -52,17 +52,19 @@ OutputVector slice(const Node& node) { const auto starts_atr = node.get_attribute_value>("starts"); const auto ends = node.get_attribute_as_constant>("ends"); - const auto starts = std::make_shared(element::i64, Shape{starts_atr.size()}, starts_atr); + const auto starts = + std::make_shared(ov::element::i64, Shape{starts_atr.size()}, starts_atr); auto axes_atr = node.get_attribute_value>("axes", std::vector()); - const auto steps = default_opset::Constant::create(element::i64, + const auto steps = default_opset::Constant::create(ov::element::i64, Shape{starts_atr.size()}, std::vector(starts_atr.size(), 1)); if (axes_atr.empty()) { return {std::make_shared(data, starts, ends, steps)}; } else { - const auto& axes = std::make_shared(element::i64, Shape{axes_atr.size()}, axes_atr); + const auto& axes = + std::make_shared(ov::element::i64, Shape{axes_atr.size()}, axes_atr); return {std::make_shared(data, starts, ends, steps, axes)}; } } diff --git a/src/frontends/onnx/frontend/src/op/split.cpp b/src/frontends/onnx/frontend/src/op/split.cpp index 8a90f5a318b..64d65c57b3d 100644 --- a/src/frontends/onnx/frontend/src/op/split.cpp +++ b/src/frontends/onnx/frontend/src/op/split.cpp @@ -38,7 +38,7 @@ OutputVector split(const Node& node) { const auto outputs_number = node.get_output_names().size(); return ov::op::util::split(inputs.at(0), outputs_number, axis); } else { - const auto axis_node = default_opset::Constant::create(element::Type_t::i64, Shape{}, {axis}); + const auto axis_node = default_opset::Constant::create(ov::element::Type_t::i64, Shape{}, {axis}); return {std::make_shared(inputs.at(0), axis_node, inputs.at(1))->outputs()}; } } @@ -49,4 +49,4 @@ OutputVector split(const Node& node) { } // namespace onnx_import } // namespace ngraph -OPENVINO_SUPPRESS_DEPRECATED_END \ No newline at end of file +OPENVINO_SUPPRESS_DEPRECATED_END diff --git a/src/frontends/onnx/frontend/src/op/squeeze.cpp b/src/frontends/onnx/frontend/src/op/squeeze.cpp index 3c01b1ffe13..56274eb14bc 100644 --- a/src/frontends/onnx/frontend/src/op/squeeze.cpp +++ b/src/frontends/onnx/frontend/src/op/squeeze.cpp @@ -18,7 +18,7 @@ OutputVector squeeze(const Node& node) { if (axes.empty()) { return {std::make_shared(data)}; } else { - const auto axes_const = std::make_shared(element::i64, Shape{axes.size()}, axes); + const auto axes_const = std::make_shared(ov::element::i64, Shape{axes.size()}, axes); return {std::make_shared(data, axes_const)}; } } diff --git a/src/frontends/onnx/frontend/src/op/stft.cpp b/src/frontends/onnx/frontend/src/op/stft.cpp index 6fa6ceecf97..fa9603a8539 100644 --- a/src/frontends/onnx/frontend/src/op/stft.cpp +++ b/src/frontends/onnx/frontend/src/op/stft.cpp @@ -69,28 +69,28 @@ OutputVector stft(const Node& node) { } const int64_t batch_size = signal_param_shape[0].get_length(); const auto nstfts = static_cast((signal_param_shape[axis].get_length() - frame_length) / frame_step) + 1; - const auto axis_const = default_opset::Constant::create(element::i64, {}, {axis}); - const auto zero_const = default_opset::Constant::create(element::i64, {}, {0}); - const auto step = default_opset::Constant::create(element::i64, Shape{2}, {1, 1}); + const auto axis_const = default_opset::Constant::create(ov::element::i64, {}, {axis}); + const auto zero_const = default_opset::Constant::create(ov::element::i64, {}, {0}); + const auto step = default_opset::Constant::create(ov::element::i64, Shape{2}, {1, 1}); ov::OutputVector all_signals; for (int64_t batch = 0; batch < batch_size; ++batch) { ov::OutputVector signals_in_batch; for (int64_t sig_idx = 0; sig_idx < nstfts; ++sig_idx) { - const auto start = default_opset::Constant::create(element::i64, + const auto start = default_opset::Constant::create(ov::element::i64, Shape{2}, std::vector{batch, sig_idx * frame_step}); const auto stop = - default_opset::Constant::create(element::i64, + default_opset::Constant::create(ov::element::i64, Shape{2}, std::vector{batch + 1, sig_idx * frame_step + frame_length}); const auto slice_axes = - default_opset::Constant::create(element::i64, Shape{2}, std::vector{0, axis}); + default_opset::Constant::create(ov::element::i64, Shape{2}, std::vector{0, axis}); const auto slice = std::make_shared(signal, start, stop, step, slice_axes); const ov::Output flatten_slice = std::make_shared( slice, - is_complex(slice) ? default_opset::Constant::create(element::i64, {2}, {-1, 2}) - : (onesided ? default_opset::Constant::create(element::i64, {1}, {-1}) - : default_opset::Constant::create(element::i64, {2}, {-1, 1})), + is_complex(slice) ? default_opset::Constant::create(ov::element::i64, {2}, {-1, 2}) + : (onesided ? default_opset::Constant::create(ov::element::i64, {1}, {-1}) + : default_opset::Constant::create(ov::element::i64, {2}, {-1, 1})), false); const auto dft = dft::make_dft( window_node_provided @@ -100,7 +100,7 @@ OutputVector stft(const Node& node) { ? std::make_shared( // align window shape with signal shape std::make_shared( ng_inputs[2], - default_opset::Constant::create(element::i64, {1}, {1})), + default_opset::Constant::create(ov::element::i64, {1}, {1})), std::make_shared(flatten_slice)) : ng_inputs[2]) : flatten_slice, diff --git a/src/frontends/onnx/frontend/src/op/tile.cpp b/src/frontends/onnx/frontend/src/op/tile.cpp index 2ba47734d3d..6b321903a31 100644 --- a/src/frontends/onnx/frontend/src/op/tile.cpp +++ b/src/frontends/onnx/frontend/src/op/tile.cpp @@ -20,7 +20,7 @@ OutputVector tile(const Node& node) { // Workaround for backends which require repeats to be i64. // Remove the following line when no longer needed. - repeats = std::make_shared(repeats, element::i64); + repeats = std::make_shared(repeats, ov::element::i64); return {std::make_shared(input, repeats)}; } diff --git a/src/frontends/onnx/frontend/src/op/topk.cpp b/src/frontends/onnx/frontend/src/op/topk.cpp index 907333fa0e9..ae73d6db40e 100644 --- a/src/frontends/onnx/frontend/src/op/topk.cpp +++ b/src/frontends/onnx/frontend/src/op/topk.cpp @@ -10,7 +10,7 @@ #include "default_opset.hpp" #include "ngraph/node.hpp" #include "ngraph/shape.hpp" -#include "ngraph/type/element_type.hpp" +#include "openvino/core/type/element_type.hpp" #include "openvino/frontend/exception.hpp" #include "utils/reshape.hpp" @@ -42,7 +42,7 @@ OutputVector topk(const Node& node) { axis, default_opset::TopK::Mode::MAX, default_opset::TopK::SortType::SORT_VALUES, - element::i64); + ov::element::i64); return {top_k->output(0), top_k->output(1)}; } @@ -60,7 +60,7 @@ OutputVector topk(const Node& node) { axis, default_opset::TopK::Mode::MAX, default_opset::TopK::SortType::SORT_VALUES, - element::i64); + ov::element::i64); return {top_k->output(0), top_k->output(1)}; } @@ -84,7 +84,7 @@ OutputVector topk(const Node& node) { const auto mode = compute_max ? default_opset::TopK::Mode::MAX : default_opset::TopK::Mode::MIN; std::shared_ptr top_k = - std::make_shared(data, k, axis, mode, sort_type, element::i64); + std::make_shared(data, k, axis, mode, sort_type, ov::element::i64); return {top_k->output(0), top_k->output(1)}; } diff --git a/src/frontends/onnx/frontend/src/op/trilu.cpp b/src/frontends/onnx/frontend/src/op/trilu.cpp index 0bc0dbf02c4..e4160fa02b4 100644 --- a/src/frontends/onnx/frontend/src/op/trilu.cpp +++ b/src/frontends/onnx/frontend/src/op/trilu.cpp @@ -31,8 +31,8 @@ OutputVector trilu(const Node& node) { } const auto shape = std::make_shared(input); - const auto zero = default_opset::Constant::create(element::i64, Shape{}, {0}); - const auto one = default_opset::Constant::create(element::i64, Shape{}, {1}); + const auto zero = default_opset::Constant::create(ov::element::i64, Shape{}, {0}); + const auto one = default_opset::Constant::create(ov::element::i64, Shape{}, {1}); // The approach here is to create a mask, that later can be used in Select operator // to choose appropiate values from the input @@ -62,26 +62,28 @@ OutputVector trilu(const Node& node) { // fetch last two dimensions of input shape // M = shape[-1] // N = shape[-2] - const auto M = std::make_shared(shape, - default_opset::Constant::create(element::i32, Shape{}, {-1}), - zero); - const auto N = std::make_shared(shape, - default_opset::Constant::create(element::i32, Shape{}, {-2}), - zero); + const auto M = + std::make_shared(shape, + default_opset::Constant::create(ov::element::i32, Shape{}, {-1}), + zero); + const auto N = + std::make_shared(shape, + default_opset::Constant::create(ov::element::i32, Shape{}, {-2}), + zero); // create 2D tensor with shape [1, M] and values [[0, 1, ..., M - 1]] - const auto horizontal_range = - std::make_shared(std::make_shared(zero, M, one, element::i64), - zero); + const auto horizontal_range = std::make_shared( + std::make_shared(zero, M, one, ov::element::i64), + zero); // create 2D tensor with shape [N, 1] and values [[k], [k + 1], ..., [N + k - 1]] std::shared_ptr vertical_range; if (is_k_available) { vertical_range = std::make_shared(inputs[1], std::make_shared(N, inputs[1]), one, - element::i64); + ov::element::i64); } else { - vertical_range = std::make_shared(zero, N, one, element::i64); + vertical_range = std::make_shared(zero, N, one, ov::element::i64); } vertical_range = std::make_shared(vertical_range, one); diff --git a/src/frontends/onnx/frontend/src/op/upsample.cpp b/src/frontends/onnx/frontend/src/op/upsample.cpp index 7f319fe876e..27e6a14e541 100644 --- a/src/frontends/onnx/frontend/src/op/upsample.cpp +++ b/src/frontends/onnx/frontend/src/op/upsample.cpp @@ -75,7 +75,7 @@ OutputVector upsample(const onnx_import::Node& node) { scales[rank_size - 1] = width_scale; scales[rank_size - 2] = height_scale; - const auto scales_const = default_opset::Constant::create(ngraph::element::f32, Shape({scales.size()}), scales); + const auto scales_const = default_opset::Constant::create(ov::element::f32, Shape({scales.size()}), scales); return std::make_shared(data, scales_const, get_attributes(mode))->outputs(); } @@ -96,7 +96,7 @@ OutputVector upsample(const onnx_import::Node& node) { "Input tensor's rank is required to be the same as number of " "elements of 'scales' attribute."); - const auto scales_const = default_opset::Constant::create(ngraph::element::f32, Shape({scales.size()}), scales); + const auto scales_const = default_opset::Constant::create(ov::element::f32, Shape({scales.size()}), scales); return std::make_shared(data, scales_const, get_attributes(mode))->outputs(); } diff --git a/src/frontends/onnx/frontend/src/utils/arg_min_max_factory.cpp b/src/frontends/onnx/frontend/src/utils/arg_min_max_factory.cpp index 2fd399a8e56..c75b3a4f337 100644 --- a/src/frontends/onnx/frontend/src/utils/arg_min_max_factory.cpp +++ b/src/frontends/onnx/frontend/src/utils/arg_min_max_factory.cpp @@ -37,7 +37,7 @@ std::shared_ptr ArgMinMaxFactory::make_arg_min() const { } std::shared_ptr ArgMinMaxFactory::make_topk_subgraph(v11::TopK::Mode mode) const { - const auto k_node = v0::Constant::create(element::i64, Shape{}, {1}); + const auto k_node = v0::Constant::create(ov::element::i64, Shape{}, {1}); if (m_select_last_index == 1) { // Example (ArgMin): @@ -69,22 +69,23 @@ std::shared_ptr ArgMinMaxFactory::make_topk_subgraph(v11::TopK::Mode m ov::normalize_axis(m_input_node.get_node(), m_axis, m_input_node.get_partial_shape().rank()); OPENVINO_SUPPRESS_DEPRECATED_END - const auto axis_node = v0::Constant::create(element::i64, Shape{1}, {normalized_axis}); + const auto axis_node = v0::Constant::create(ov::element::i64, Shape{1}, {normalized_axis}); const auto reverse = std::make_shared(m_input_node, axis_node, v1::Reverse::Mode::INDEX); const auto topk = std::make_shared(reverse, k_node, normalized_axis, mode, v1::TopK::SortType::NONE); const auto data_shape = std::make_shared(m_input_node); const auto dims_on_axis = - std::make_shared(data_shape, axis_node, v0::Constant::create(element::i64, Shape{}, {0})); + std::make_shared(data_shape, axis_node, v0::Constant::create(ov::element::i64, Shape{}, {0})); const auto res_index = - std::make_shared(dims_on_axis, std::make_shared(topk->output(1), element::i64)); + std::make_shared(dims_on_axis, + std::make_shared(topk->output(1), ov::element::i64)); const auto result = - std::make_shared(res_index, v0::Constant::create(element::i64, Shape{1}, {1})); + std::make_shared(res_index, v0::Constant::create(ov::element::i64, Shape{1}, {1})); if (m_keep_dims == 0) { - const auto axis_to_remove = v0::Constant::create(element::u64, Shape{}, {topk->get_axis()}); + const auto axis_to_remove = v0::Constant::create(ov::element::u64, Shape{}, {topk->get_axis()}); return std::make_shared(result, axis_to_remove); } @@ -94,10 +95,10 @@ std::shared_ptr ArgMinMaxFactory::make_topk_subgraph(v11::TopK::Mode m const auto topk = std::make_shared(m_input_node, k_node, m_axis, mode, v11::TopK::SortType::NONE); - const auto result = std::make_shared(topk->output(1), element::i64); + const auto result = std::make_shared(topk->output(1), ov::element::i64); if (m_keep_dims == 0) { - const auto axis_to_remove = v0::Constant::create(element::u64, Shape{}, {topk->get_axis()}); + const auto axis_to_remove = v0::Constant::create(ov::element::u64, Shape{}, {topk->get_axis()}); return std::make_shared(result, axis_to_remove); } diff --git a/src/frontends/onnx/frontend/src/utils/common.cpp b/src/frontends/onnx/frontend/src/utils/common.cpp index 2767a5a1cfd..920b916a043 100644 --- a/src/frontends/onnx/frontend/src/utils/common.cpp +++ b/src/frontends/onnx/frontend/src/utils/common.cpp @@ -29,33 +29,33 @@ namespace common { const ov::element::Type& get_ov_element_type(int64_t onnx_type) { switch (onnx_type) { case ONNX_NAMESPACE::TensorProto_DataType_BOOL: - return element::boolean; + return ov::element::boolean; case ONNX_NAMESPACE::TensorProto_DataType_DOUBLE: - return element::f64; + return ov::element::f64; case ONNX_NAMESPACE::TensorProto_DataType_FLOAT16: - return element::f16; + return ov::element::f16; case ONNX_NAMESPACE::TensorProto_DataType_FLOAT: - return element::f32; + return ov::element::f32; case ONNX_NAMESPACE::TensorProto_DataType_INT8: - return element::i8; + return ov::element::i8; case ONNX_NAMESPACE::TensorProto_DataType_INT16: - return element::i16; + return ov::element::i16; case ONNX_NAMESPACE::TensorProto_DataType_INT32: - return element::i32; + return ov::element::i32; case ONNX_NAMESPACE::TensorProto_DataType_INT64: - return element::i64; + return ov::element::i64; case ONNX_NAMESPACE::TensorProto_DataType_UINT8: - return element::u8; + return ov::element::u8; case ONNX_NAMESPACE::TensorProto_DataType_UINT16: - return element::u16; + return ov::element::u16; case ONNX_NAMESPACE::TensorProto_DataType_UINT32: - return element::u32; + return ov::element::u32; case ONNX_NAMESPACE::TensorProto_DataType_UINT64: - return element::u64; + return ov::element::u64; case ONNX_NAMESPACE::TensorProto_DataType_UNDEFINED: - return element::dynamic; + return ov::element::dynamic; case ONNX_NAMESPACE::TensorProto_DataType_BFLOAT16: - return element::bf16; + return ov::element::bf16; } OPENVINO_THROW("unsupported element type"); } @@ -66,19 +66,19 @@ std::shared_ptr get_monotonic_range_along_node_rank(const ov::Output(value.get_partial_shape().rank().get_length(), start_value, step); - return v0::Constant::create(element::i64, {range_value.size()}, range_value); + return v0::Constant::create(ov::element::i64, {range_value.size()}, range_value); } const auto value_shape = std::make_shared(value); - return std::make_shared(v0::Constant::create(element::i64, {}, {start_value}), + return std::make_shared(v0::Constant::create(ov::element::i64, {}, {start_value}), std::make_shared(value_shape), - v0::Constant::create(element::i64, {}, {step}), - element::i64); + v0::Constant::create(ov::element::i64, {}, {step}), + ov::element::i64); } void validate_scalar_input(const char* input_name, const std::shared_ptr input, - const std::set allowed_types) { + const std::set allowed_types) { const auto validated_input_shape = input->get_output_partial_shape(0); const auto validated_input_rank = validated_input_shape.rank(); @@ -113,7 +113,7 @@ OutputVector handle_opset6_binary_op(const Node& node) { if (axis < 0) axis += lhs_rank; if (lhs_rank > axis + rhs_rank) { - auto ones = v0::Constant::create(element::i64, + auto ones = v0::Constant::create(ov::element::i64, Shape{static_cast(lhs_rank - axis - rhs_rank)}, std::vector(lhs_rank - axis - rhs_rank, 1)); auto rhs_shape = std::make_shared(rhs_node); diff --git a/src/frontends/onnx/frontend/src/utils/common.hpp b/src/frontends/onnx/frontend/src/utils/common.hpp index 15edf2e8eb6..1f26770c1b7 100644 --- a/src/frontends/onnx/frontend/src/utils/common.hpp +++ b/src/frontends/onnx/frontend/src/utils/common.hpp @@ -76,7 +76,7 @@ std::shared_ptr get_monotonic_range_along_node_rank(const ov::Output std::shared_ptr shifted_square_identity(const Shape output_shape, - const element::Type& output_type, + const ov::element::Type& output_type, const std::int64_t shift) { std::vector identity_matrix(shape_size(output_shape), T{0}); std::int64_t rows = output_shape[0]; @@ -100,7 +100,7 @@ std::shared_ptr shifted_square_identity(const Shape output /// /// \return A Constant node representing identity matrix with shape (n, n). template -std::shared_ptr square_identity(const size_t n, const element::Type& type) { +std::shared_ptr square_identity(const size_t n, const ov::element::Type& type) { return shifted_square_identity(Shape{n, n}, type, 0); } @@ -112,7 +112,7 @@ std::shared_ptr square_identity(const size_t n, const elem /// \param[in] allowed_types An optional set of allowed element types for this input void validate_scalar_input(const char* input_name, const std::shared_ptr input, - const std::set allowed_types = {}); + const std::set allowed_types = {}); /// \brief Temporary replacement for C++14 std::make_unique. /// \note details: https://en.cppreference.com/w/cpp/memory/unique_ptr/make_unique diff --git a/src/frontends/onnx/frontend/src/utils/convpool.cpp b/src/frontends/onnx/frontend/src/utils/convpool.cpp index cac377b42d8..c6b9f818cff 100644 --- a/src/frontends/onnx/frontend/src/utils/convpool.cpp +++ b/src/frontends/onnx/frontend/src/utils/convpool.cpp @@ -164,9 +164,9 @@ void calculate_auto_pads(const Shape& data_shape, } Output get_reshaped_filters(const Output& filters, int64_t groups) { - const auto zero_node = v0::Constant::create(element::i64, Shape(), {0}); - const auto split_lengths = v0::Constant::create(element::i64, Shape{2}, {1, -1}); - const auto groups_node = v0::Constant::create(element::i64, Shape{1}, {groups}); + const auto zero_node = v0::Constant::create(ov::element::i64, Shape(), {0}); + const auto split_lengths = v0::Constant::create(ov::element::i64, Shape{2}, {1, -1}); + const auto groups_node = v0::Constant::create(ov::element::i64, Shape{1}, {groups}); const auto filters_shape = std::make_shared(filters); const auto splitted_shape = std::make_shared(filters_shape, zero_node, split_lengths); diff --git a/src/frontends/onnx/frontend/src/utils/dft.cpp b/src/frontends/onnx/frontend/src/utils/dft.cpp index d432fd81dc1..4c79aa64c87 100644 --- a/src/frontends/onnx/frontend/src/utils/dft.cpp +++ b/src/frontends/onnx/frontend/src/utils/dft.cpp @@ -49,7 +49,7 @@ ov::Output make_dft(const ov::Output& signal, bool is_inversed, bool is_onesided) { auto processed_signal = signal; - const auto axis_const = v0::Constant::create(element::i64, {1}, {axis}); + const auto axis_const = v0::Constant::create(ov::element::i64, {1}, {axis}); bool conversion_to_complex_applied = false; if (is_inversed || !is_onesided) { // skip for RDFT case conversion_to_complex_applied = try_convert_real_to_complex(processed_signal); @@ -64,7 +64,7 @@ ov::Output make_dft(const ov::Output& signal, result = dft_length_provided ? std::make_shared(processed_signal, axis_const, length) : std::make_shared(processed_signal, axis_const); if (conversion_to_complex_applied) { // align the output shape with a real numbers representation - const auto unsqueeze_axis = v0::Constant::create(element::i64, {}, {-1}); + const auto unsqueeze_axis = v0::Constant::create(ov::element::i64, {}, {-1}); result = std::make_shared(result, unsqueeze_axis); } } else { diff --git a/src/frontends/onnx/frontend/src/utils/pooling_factory.cpp b/src/frontends/onnx/frontend/src/utils/pooling_factory.cpp index adfaa488190..7a9cfda201a 100644 --- a/src/frontends/onnx/frontend/src/utils/pooling_factory.cpp +++ b/src/frontends/onnx/frontend/src/utils/pooling_factory.cpp @@ -30,7 +30,7 @@ std::shared_ptr transposition_axis_order(const ov::Rank& input_ran std::iota(axes.begin(), axes.end(), 0); std::reverse(axes.begin() + 2, axes.end()); - return std::make_shared(element::i32, Shape{rank}, axes); + return std::make_shared(ov::element::i32, Shape{rank}, axes); } } // namespace diff --git a/src/frontends/onnx/frontend/src/utils/recurrent.cpp b/src/frontends/onnx/frontend/src/utils/recurrent.cpp index c01316f0a59..704711fe48c 100644 --- a/src/frontends/onnx/frontend/src/utils/recurrent.cpp +++ b/src/frontends/onnx/frontend/src/utils/recurrent.cpp @@ -40,17 +40,17 @@ OpInputMap::OpInputMap(const onnx_import::Node& node, std::size_t gates_count) { // Get dimensions needed for default inputs creation auto shape_of_x = std::make_shared(m_map[OpInput::X]); - auto axes = v0::Constant::create(element::i32, Shape{1}, {0}); + auto axes = v0::Constant::create(ov::element::i32, Shape{1}, {0}); auto batch_size_node = - std::make_shared(shape_of_x, v0::Constant::create(element::i32, Shape{1}, {0}), axes); + std::make_shared(shape_of_x, v0::Constant::create(ov::element::i32, Shape{1}, {0}), axes); auto seq_length_node = - std::make_shared(shape_of_x, v0::Constant::create(element::i32, Shape{1}, {1}), axes); + std::make_shared(shape_of_x, v0::Constant::create(ov::element::i32, Shape{1}, {1}), axes); auto shape_of_r = std::make_shared(m_map[OpInput::R]); auto num_directions_node = - std::make_shared(shape_of_r, v0::Constant::create(element::i32, Shape{1}, {0}), axes); + std::make_shared(shape_of_r, v0::Constant::create(ov::element::i32, Shape{1}, {0}), axes); auto hidden_size_node = - std::make_shared(shape_of_r, v0::Constant::create(element::i32, Shape{1}, {2}), axes); + std::make_shared(shape_of_r, v0::Constant::create(ov::element::i32, Shape{1}, {2}), axes); // ------ Optional inputs ------ if (ng_inputs.size() > 3 && !ov::op::util::is_null(ng_inputs.at(3))) { @@ -61,7 +61,7 @@ OpInputMap::OpInputMap(const onnx_import::Node& node, std::size_t gates_count) { auto b_shape = std::make_shared( OutputVector{ num_directions_node, - std::make_shared(v0::Constant::create(element::Type_t::i64, Shape{1}, {gates_count}), + std::make_shared(v0::Constant::create(ov::element::Type_t::i64, Shape{1}, {gates_count}), hidden_size_node)}, 0); m_map[OpInput::B] = diff --git a/src/frontends/onnx/frontend/src/utils/reshape.cpp b/src/frontends/onnx/frontend/src/utils/reshape.cpp index 0fc904c4e78..af5036be7cc 100644 --- a/src/frontends/onnx/frontend/src/utils/reshape.cpp +++ b/src/frontends/onnx/frontend/src/utils/reshape.cpp @@ -94,8 +94,8 @@ ov::Output interpret_as_scalar(const ov::Output& node) { ov::Output reshape_channel_shaped_node_to_nchw(const ov::Output& node, const ov::Output& expected_rank) { // Prepare tail shape (rank = conv.rank - 2): [1, 1, 1, 1, ... ] - const auto one_const = v0::Constant::create(element::i64, Shape{1}, {1}); - const auto two_const = v0::Constant::create(element::i64, Shape{1}, {2}); + const auto one_const = v0::Constant::create(ov::element::i64, Shape{1}, {1}); + const auto two_const = v0::Constant::create(ov::element::i64, Shape{1}, {2}); const auto tail_shape_rank = std::make_shared(expected_rank, two_const); const auto tail_shape = std::make_shared(one_const, tail_shape_rank); diff --git a/src/frontends/onnx/onnx_common/include/onnx_common/utils.hpp b/src/frontends/onnx/onnx_common/include/onnx_common/utils.hpp index 336bb84809e..62df90c9e7a 100644 --- a/src/frontends/onnx/onnx_common/include/onnx_common/utils.hpp +++ b/src/frontends/onnx/onnx_common/include/onnx_common/utils.hpp @@ -21,21 +21,21 @@ size_t get_onnx_data_size(int32_t onnx_type); /// /// \param onnx_type An element of TensorProto_DataType enum which determines an ONNX type. /// -element::Type_t onnx_to_ov_data_type(const TensorProto_DataType& onnx_type); +ov::element::Type_t onnx_to_ov_data_type(const TensorProto_DataType& onnx_type); /// \brief Retuns an ONNX data type corresponding to a OpenVINO data type. /// -/// \param ov_type An element of element::Type_t enum class which determines a OpenVINO data +/// \param ov_type An element of ov::element::Type_t enum class which determines a OpenVINO data /// type. /// -TensorProto_DataType ov_to_onnx_data_type(const element::Type_t& ov_type); +TensorProto_DataType ov_to_onnx_data_type(const ov::element::Type_t& ov_type); /// \brief Retuns true if a OpenVINO data type is mapped to an ONNX data type. /// -/// \param ov_type An element of element::Type_t enum class which determines a OpenVINO data +/// \param ov_type An element of ov::element::Type_t enum class which determines a OpenVINO data /// type. /// -bool is_supported_ov_type(const element::Type_t& ov_type); +bool is_supported_ov_type(const ov::element::Type_t& ov_type); /// \brief Retuns OpenVINO PartialShape based on onnx_shape. /// @@ -46,4 +46,4 @@ PartialShape onnx_to_ov_shape(const TensorShapeProto& onnx_shape); } // namespace common } // namespace onnx } // namespace frontend -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/frontends/onnx/onnx_common/src/utils.cpp b/src/frontends/onnx/onnx_common/src/utils.cpp index 07ab68f2d60..725826ba95a 100644 --- a/src/frontends/onnx/onnx_common/src/utils.cpp +++ b/src/frontends/onnx/onnx_common/src/utils.cpp @@ -51,26 +51,26 @@ size_t get_onnx_data_size(int32_t onnx_type) { } namespace { using namespace ONNX_NAMESPACE; -const std::map OV_2_ONNX_TYPES = { - {element::Type_t::bf16, TensorProto_DataType::TensorProto_DataType_BFLOAT16}, - {element::Type_t::f16, TensorProto_DataType::TensorProto_DataType_FLOAT16}, - {element::Type_t::f32, TensorProto_DataType::TensorProto_DataType_FLOAT}, - {element::Type_t::f64, TensorProto_DataType::TensorProto_DataType_DOUBLE}, - {element::Type_t::i8, TensorProto_DataType::TensorProto_DataType_INT8}, - {element::Type_t::i16, TensorProto_DataType::TensorProto_DataType_INT16}, - {element::Type_t::i32, TensorProto_DataType::TensorProto_DataType_INT32}, - {element::Type_t::i64, TensorProto_DataType::TensorProto_DataType_INT64}, - {element::Type_t::u8, TensorProto_DataType::TensorProto_DataType_UINT8}, - {element::Type_t::u16, TensorProto_DataType::TensorProto_DataType_UINT16}, - {element::Type_t::u32, TensorProto_DataType::TensorProto_DataType_UINT32}, - {element::Type_t::u64, TensorProto_DataType::TensorProto_DataType_UINT64}, - {element::Type_t::boolean, TensorProto_DataType::TensorProto_DataType_BOOL}}; +const std::map OV_2_ONNX_TYPES = { + {ov::element::Type_t::bf16, TensorProto_DataType::TensorProto_DataType_BFLOAT16}, + {ov::element::Type_t::f16, TensorProto_DataType::TensorProto_DataType_FLOAT16}, + {ov::element::Type_t::f32, TensorProto_DataType::TensorProto_DataType_FLOAT}, + {ov::element::Type_t::f64, TensorProto_DataType::TensorProto_DataType_DOUBLE}, + {ov::element::Type_t::i8, TensorProto_DataType::TensorProto_DataType_INT8}, + {ov::element::Type_t::i16, TensorProto_DataType::TensorProto_DataType_INT16}, + {ov::element::Type_t::i32, TensorProto_DataType::TensorProto_DataType_INT32}, + {ov::element::Type_t::i64, TensorProto_DataType::TensorProto_DataType_INT64}, + {ov::element::Type_t::u8, TensorProto_DataType::TensorProto_DataType_UINT8}, + {ov::element::Type_t::u16, TensorProto_DataType::TensorProto_DataType_UINT16}, + {ov::element::Type_t::u32, TensorProto_DataType::TensorProto_DataType_UINT32}, + {ov::element::Type_t::u64, TensorProto_DataType::TensorProto_DataType_UINT64}, + {ov::element::Type_t::boolean, TensorProto_DataType::TensorProto_DataType_BOOL}}; } // namespace -element::Type_t onnx_to_ov_data_type(const TensorProto_DataType& onnx_type) { +ov::element::Type_t onnx_to_ov_data_type(const TensorProto_DataType& onnx_type) { const auto result = std::find_if(OV_2_ONNX_TYPES.begin(), OV_2_ONNX_TYPES.end(), - [&onnx_type](const std::pair& pair) { + [&onnx_type](const std::pair& pair) { return pair.second == onnx_type; }); if (result == std::end(OV_2_ONNX_TYPES)) { @@ -80,11 +80,11 @@ element::Type_t onnx_to_ov_data_type(const TensorProto_DataType& onnx_type) { return result->first; } -TensorProto_DataType ov_to_onnx_data_type(const element::Type_t& ov_type) { +TensorProto_DataType ov_to_onnx_data_type(const ov::element::Type_t& ov_type) { return OV_2_ONNX_TYPES.at(ov_type); } -bool is_supported_ov_type(const element::Type_t& ov_type) { +bool is_supported_ov_type(const ov::element::Type_t& ov_type) { return OV_2_ONNX_TYPES.count(ov_type) > 0; } @@ -108,4 +108,4 @@ PartialShape onnx_to_ov_shape(const TensorShapeProto& onnx_shape) { } // namespace common } // namespace onnx } // namespace frontend -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/frontends/onnx/tests/onnx_editor.cpp b/src/frontends/onnx/tests/onnx_editor.cpp index 56aa60642ec..2dad30685b3 100644 --- a/src/frontends/onnx/tests/onnx_editor.cpp +++ b/src/frontends/onnx/tests/onnx_editor.cpp @@ -23,7 +23,7 @@ namespace { using InputTypePred = std::function)>; // A higher order factory function that produces predicates bound to a particular element type -InputTypePred element_type_is(const element::Type et) { +InputTypePred element_type_is(const ov::element::Type et) { return [et](const std::shared_ptr input) { return input->get_element_type() == et; }; @@ -44,21 +44,21 @@ OPENVINO_TEST(onnx_editor, types__single_input_type_substitution) { FrontEnd::Ptr front_end; auto input_model = load_model("model_editor/add_abc.onnx", &front_end); - input_model->set_element_type(input_model->get_place_by_tensor_name("A"), element::i64); + input_model->set_element_type(input_model->get_place_by_tensor_name("A"), ov::element::i64); const auto model = front_end->convert(input_model); const auto graph_inputs = model->get_parameters(); const auto float_inputs_count = - std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(element::f32)); + std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(ov::element::f32)); const auto integer_inputs_count = - std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(element::i64)); + std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(ov::element::i64)); EXPECT_EQ(float_inputs_count, 0); EXPECT_EQ(integer_inputs_count, 3); - EXPECT_EQ(find_input(graph_inputs, "A")->get_element_type(), element::i64); + EXPECT_EQ(find_input(graph_inputs, "A")->get_element_type(), ov::element::i64); } OPENVINO_TEST(onnx_editor, types__all_inputs_type_substitution) { @@ -66,19 +66,19 @@ OPENVINO_TEST(onnx_editor, types__all_inputs_type_substitution) { FrontEnd::Ptr front_end; auto input_model = load_model("model_editor/add_abc.onnx", &front_end); - input_model->set_element_type(input_model->get_place_by_tensor_name("A"), element::i8); - input_model->set_element_type(input_model->get_place_by_tensor_name("B"), element::i8); - input_model->set_element_type(input_model->get_place_by_tensor_name("C"), element::i8); + input_model->set_element_type(input_model->get_place_by_tensor_name("A"), ov::element::i8); + input_model->set_element_type(input_model->get_place_by_tensor_name("B"), ov::element::i8); + input_model->set_element_type(input_model->get_place_by_tensor_name("C"), ov::element::i8); const auto model = front_end->convert(input_model); const auto graph_inputs = model->get_parameters(); const auto float_inputs_count = - std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(element::f32)); + std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(ov::element::f32)); const auto integer_inputs_count = - std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(element::i8)); + std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(ov::element::i8)); EXPECT_EQ(float_inputs_count, 0); EXPECT_EQ(integer_inputs_count, 3); @@ -88,7 +88,7 @@ OPENVINO_TEST(onnx_editor, types__missing_type_in_input_descriptor) { auto input_model = load_model("model_editor/invalid_input_no_type.onnx"); // input A doesn't have the "type" field in the model and so the data type cannot be modified - EXPECT_THROW(input_model->set_element_type(input_model->get_place_by_tensor_name("A"), element::f32), + EXPECT_THROW(input_model->set_element_type(input_model->get_place_by_tensor_name("A"), ov::element::f32), ov::Exception); } @@ -96,14 +96,14 @@ OPENVINO_TEST(onnx_editor, types__missing_tensor_type_in_input_descriptor) { auto input_model = load_model("model_editor/invalid_input_no_tensor_type.onnx"); // input A doesn't have the "tensor_type" field in the model - EXPECT_THROW(input_model->set_element_type(input_model->get_place_by_tensor_name("A"), element::f32), + EXPECT_THROW(input_model->set_element_type(input_model->get_place_by_tensor_name("A"), ov::element::f32), ov::Exception); } OPENVINO_TEST(onnx_editor, types__unsupported_data_type_passed) { auto input_model = load_model("model_editor/add_abc.onnx"); - EXPECT_THROW(input_model->set_element_type(input_model->get_place_by_tensor_name("A"), element::dynamic), + EXPECT_THROW(input_model->set_element_type(input_model->get_place_by_tensor_name("A"), ov::element::dynamic), ov::Exception); } @@ -119,19 +119,19 @@ OPENVINO_TEST(onnx_editor, types__elem_type_missing_in_input) { auto input_model = load_model("model_editor/elem_type_missing_in_input.onnx", &front_end); // the "elem_type" is missing in the model but it should be possible to set the type anyway - EXPECT_NO_THROW(input_model->set_element_type(input_model->get_place_by_tensor_name("A"), element::i64)); + EXPECT_NO_THROW(input_model->set_element_type(input_model->get_place_by_tensor_name("A"), ov::element::i64)); const auto model = front_end->convert(input_model); const auto graph_inputs = model->get_parameters(); const auto integer_inputs_count = - std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(element::i64)); + std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(ov::element::i64)); EXPECT_EQ(integer_inputs_count, 2); const auto function_result = model->get_result(); - EXPECT_EQ(function_result->get_element_type(), element::i64); + EXPECT_EQ(function_result->get_element_type(), ov::element::i64); } OPENVINO_TEST(onnx_editor, shapes__modify_single_input) { @@ -727,8 +727,8 @@ OPENVINO_TEST(onnx_editor, values__append_two_initializers_to_invalid) { FrontEnd::Ptr front_end; auto input_model = load_model("model_editor/add_1D_invalid.onnx", &front_end); std::map> in_vals; - // in_vals.emplace("A", ov::op::v0::Constant::create(element::i64, Shape{2}, {4, 2})); - // in_vals.emplace("B", ov::op::v0::Constant::create(element::i64, Shape{2}, {1, 3})); + // in_vals.emplace("A", ov::op::v0::Constant::create( ov::element::i64, Shape{2}, {4, 2})); + // in_vals.emplace("B", ov::op::v0::Constant::create( ov::element::i64, Shape{2}, {1, 3})); // editor.set_input_values(in_vals); auto place = input_model->get_place_by_operation_name_and_input_port("add_node", 0); @@ -798,12 +798,12 @@ OPENVINO_TEST(onnx_editor, values__append_two_initializers_change_shape_type) { auto input_model = load_model("model_editor/add_1D.onnx", &front_end); auto place = input_model->get_place_by_tensor_name("A"); - input_model->set_element_type(place, element::i8); + input_model->set_element_type(place, ov::element::i8); input_model->set_partial_shape(place, Shape{2, 1}); input_model->set_tensor_value(place, std::vector{-1, 1}.data()); place = input_model->get_place_by_tensor_name("B"); - input_model->set_element_type(place, element::i8); + input_model->set_element_type(place, ov::element::i8); input_model->set_partial_shape(place, Shape{2, 1}); input_model->set_tensor_value(place, std::vector{-2, 2}.data()); @@ -817,12 +817,12 @@ OPENVINO_TEST(onnx_editor, values__append_two_initializers_mixed_types) { FrontEnd::Ptr front_end; auto input_model = load_model("gather_elements_float_3D_axis_2.onnx", &front_end); auto place = input_model->get_place_by_tensor_name("data"); - input_model->set_element_type(place, element::i16); + input_model->set_element_type(place, ov::element::i16); input_model->set_partial_shape(place, Shape{2, 2, 2}); input_model->set_tensor_value(place, std::vector{1, 2, 3, 4, 5, 6, 7, 8}.data()); place = input_model->get_place_by_tensor_name("indices"); - input_model->set_element_type(place, element::i32); + input_model->set_element_type(place, ov::element::i32); input_model->set_partial_shape(place, Shape{2, 2, 1}); input_model->set_tensor_value(place, std::vector{0, 1, 0, 1}.data()); @@ -1002,10 +1002,10 @@ OPENVINO_TEST(onnx_editor, add_output) { OPENVINO_TEST(onnx_editor, get_tensor_element_type) { auto input_model = load_model("model_editor/subgraph_extraction_tests.onnx"); - EXPECT_EQ(input_model->get_element_type(input_model->get_place_by_tensor_name("in1")), element::f32); - EXPECT_EQ(input_model->get_element_type(input_model->get_place_by_tensor_name("in2")), element::f32); - input_model->set_element_type(input_model->get_place_by_tensor_name("in3"), element::f16); - EXPECT_EQ(input_model->get_element_type(input_model->get_place_by_tensor_name("in3")), element::f16); + EXPECT_EQ(input_model->get_element_type(input_model->get_place_by_tensor_name("in1")), ov::element::f32); + EXPECT_EQ(input_model->get_element_type(input_model->get_place_by_tensor_name("in2")), ov::element::f32); + input_model->set_element_type(input_model->get_place_by_tensor_name("in3"), ov::element::f16); + EXPECT_EQ(input_model->get_element_type(input_model->get_place_by_tensor_name("in3")), ov::element::f16); EXPECT_THROW(input_model->get_element_type(nullptr), ov::Exception); } diff --git a/src/frontends/onnx/tests/onnx_import_controlflow.in.cpp b/src/frontends/onnx/tests/onnx_import_controlflow.in.cpp index 94d77c67861..744624ae3c2 100644 --- a/src/frontends/onnx/tests/onnx_import_controlflow.in.cpp +++ b/src/frontends/onnx/tests/onnx_import_controlflow.in.cpp @@ -31,16 +31,16 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_controlflow_loop_2d_add) { // Shape inference tests const auto& parameters = model->get_parameters(); EXPECT_EQ(parameters.size(), 1); - EXPECT_EQ(parameters.at(0)->get_element_type(), element::f32); + EXPECT_EQ(parameters.at(0)->get_element_type(), ov::element::f32); EXPECT_TRUE(parameters.at(0)->get_partial_shape().is_static()); EXPECT_EQ(parameters.at(0)->get_partial_shape().to_shape(), (Shape{1, 2})); const auto& results = model->get_results(); EXPECT_EQ(results.size(), 2); - EXPECT_EQ(model->get_output_element_type(0), element::f32); + EXPECT_EQ(model->get_output_element_type(0), ov::element::f32); EXPECT_TRUE(model->get_output_partial_shape(0).is_static()); EXPECT_EQ(model->get_output_shape(0), (Shape{1, 2})); - EXPECT_EQ(model->get_output_element_type(1), element::f32); + EXPECT_EQ(model->get_output_element_type(1), ov::element::f32); EXPECT_TRUE(model->get_output_partial_shape(1).is_static()); EXPECT_EQ(model->get_output_shape(1), (Shape{3, 1, 2})); @@ -380,10 +380,10 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_controlflow_loop_2d_trip_count_and_cond_skip const auto& results = model->get_results(); EXPECT_EQ(results.size(), 2); - EXPECT_EQ(model->get_output_element_type(0), element::f32); + EXPECT_EQ(model->get_output_element_type(0), ov::element::f32); EXPECT_TRUE(model->get_output_partial_shape(0).is_static()); EXPECT_EQ(model->get_output_shape(0), (Shape{1, 2})); - EXPECT_EQ(model->get_output_element_type(1), element::f32); + EXPECT_EQ(model->get_output_element_type(1), ov::element::f32); EXPECT_TRUE(model->get_output_partial_shape(1).rank().is_static()); EXPECT_EQ(model->get_output_partial_shape(1).rank(), 3); EXPECT_EQ(model->get_output_partial_shape(1), (PartialShape{Dimension::dynamic(), 1, 2})); diff --git a/src/frontends/onnx/tests/onnx_import_with_editor.in.cpp b/src/frontends/onnx/tests/onnx_import_with_editor.in.cpp index b365c64f253..11077f4b89c 100644 --- a/src/frontends/onnx/tests/onnx_import_with_editor.in.cpp +++ b/src/frontends/onnx/tests/onnx_import_with_editor.in.cpp @@ -31,8 +31,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_compress_axis_0) { std::map> in_vals; - in_vals.emplace("input", op::v0::Constant::create(element::f32, Shape{3, 2}, {1., 2., 3., 4., 5., 6.})); - in_vals.emplace("condition", op::v0::Constant::create(element::boolean, Shape{3}, {false, true, true})); + in_vals.emplace("input", op::v0::Constant::create( ov::element::f32, Shape{3, 2}, {1., 2., 3., 4., 5., 6.})); + in_vals.emplace("condition", op::v0::Constant::create( ov::element::boolean, Shape{3}, {false, true, true})); editor.set_input_values(in_vals); const auto function = editor.get_function(); @@ -48,8 +48,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_compress_axis_1) { std::map> in_vals; - in_vals.emplace("input", op::v0::Constant::create(element::f32, Shape{3, 2}, {1., 2., 3., 4., 5., 6.})); - in_vals.emplace("condition", op::v0::Constant::create(element::boolean, Shape{2}, {false, true})); + in_vals.emplace("input", op::v0::Constant::create( ov::element::f32, Shape{3, 2}, {1., 2., 3., 4., 5., 6.})); + in_vals.emplace("condition", op::v0::Constant::create( ov::element::boolean, Shape{2}, {false, true})); editor.set_input_values(in_vals); const auto function = editor.get_function(); @@ -65,9 +65,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_compress_default_axis) { std::map> in_vals; - in_vals.emplace("input", op::v0::Constant::create(element::f32, Shape{3, 2}, {1., 2., 3., 4., 5., 6.})); + in_vals.emplace("input", op::v0::Constant::create( ov::element::f32, Shape{3, 2}, {1., 2., 3., 4., 5., 6.})); in_vals.emplace("condition", - op::v0::Constant::create(element::boolean, Shape{5}, {false, true, false, false, true})); + op::v0::Constant::create( ov::element::boolean, Shape{5}, {false, true, false, false, true})); editor.set_input_values(in_vals); const auto function = editor.get_function(); @@ -83,8 +83,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_compress_negative_axis) { std::map> in_vals; - in_vals.emplace("input", op::v0::Constant::create(element::f32, Shape{3, 2}, {1., 2., 3., 4., 5., 6.})); - in_vals.emplace("condition", op::v0::Constant::create(element::boolean, Shape{2}, {false, true})); + in_vals.emplace("input", op::v0::Constant::create( ov::element::f32, Shape{3, 2}, {1., 2., 3., 4., 5., 6.})); + in_vals.emplace("condition", op::v0::Constant::create( ov::element::boolean, Shape{2}, {false, true})); editor.set_input_values(in_vals); const auto function = editor.get_function(); @@ -100,7 +100,7 @@ TYPED_TEST_SUITE_P(ElemTypesTests); TYPED_TEST_P(ElemTypesTests, onnx_test_add_abc_set_precission) { using DataType = TypeParam; - const element::Type ng_type = element::from(); + const ov::element::Type ng_type = ov::element::from(); ov::onnx_editor::ONNXModelEditor editor{ util::path_join({ov::test::utils::getExecutableDirectory(), TEST_ONNX_MODELS_DIRNAME, "add_abc_3d.onnx"})}; @@ -118,7 +118,7 @@ TYPED_TEST_P(ElemTypesTests, onnx_test_add_abc_set_precission) { TYPED_TEST_P(ElemTypesTests, onnx_test_split_multioutput_set_precission) { using DataType = TypeParam; - const element::Type ng_type = element::from(); + const ov::element::Type ng_type = ov::element::from(); ov::onnx_editor::ONNXModelEditor editor{util::path_join( {ov::test::utils::getExecutableDirectory(), TEST_ONNX_MODELS_DIRNAME, "split_equal_parts_default.onnx"})}; diff --git a/src/frontends/onnx/tests/onnx_importer_test.cpp b/src/frontends/onnx/tests/onnx_importer_test.cpp index b2cda145731..2c08eb8196f 100644 --- a/src/frontends/onnx/tests/onnx_importer_test.cpp +++ b/src/frontends/onnx/tests/onnx_importer_test.cpp @@ -32,7 +32,7 @@ TEST(ONNX_Importer_Tests, ImportBasicModel) { ASSERT_EQ(model->get_output_size(), 1); ASSERT_EQ(std::string(model->get_output_op(0)->get_type_name()), "Result"); - ASSERT_EQ(model->get_output_element_type(0), element::f32); + ASSERT_EQ(model->get_output_element_type(0), ov::element::f32); ASSERT_EQ(model->get_output_shape(0), Shape({2, 2})); ASSERT_EQ(count_additions, 2); ASSERT_EQ(count_constants, 2); @@ -55,7 +55,7 @@ TEST(ONNX_Importer_Tests, ImportModelWithFusedOp) { ASSERT_EQ(model->get_output_size(), 1); ASSERT_EQ(std::string(model->get_output_op(0)->get_type_name()), "Result"); - ASSERT_EQ(model->get_output_element_type(0), element::f32); + ASSERT_EQ(model->get_output_element_type(0), ov::element::f32); ASSERT_EQ(model->get_output_shape(0), Shape({3, 4, 5})); ASSERT_EQ(count_selu, 1); ASSERT_EQ(count_constants, 2); @@ -79,8 +79,8 @@ TEST(ONNX_Importer_Tests, ImportModelWithMultiOutput) { ASSERT_EQ(model->get_output_size(), 2); ASSERT_EQ(std::string(model->get_output_op(0)->get_type_name()), "Result"); ASSERT_EQ(std::string(model->get_output_op(1)->get_type_name()), "Result"); - ASSERT_EQ(model->get_output_element_type(0), element::f32); - ASSERT_EQ(model->get_output_element_type(1), element::i64); + ASSERT_EQ(model->get_output_element_type(0), ov::element::f32); + ASSERT_EQ(model->get_output_element_type(1), ov::element::i64); ASSERT_EQ(model->get_output_shape(0), Shape({3, 3})); ASSERT_EQ(model->get_output_shape(1), Shape({3, 3})); ASSERT_EQ(count_topk, 1); diff --git a/src/frontends/onnx/tests/tests_python/test_frontend_onnx.py b/src/frontends/onnx/tests/tests_python/test_frontend_onnx.py index 93a24548630..b21fa334539 100644 --- a/src/frontends/onnx/tests/tests_python/test_frontend_onnx.py +++ b/src/frontends/onnx/tests/tests_python/test_frontend_onnx.py @@ -17,12 +17,12 @@ from tests.runtime import get_runtime def create_onnx_model(): add = onnx.helper.make_node("Add", inputs=["x", "y"], outputs=["z"]) - const_tensor = onnx.helper.make_tensor("const_tensor", - onnx.TensorProto.FLOAT, - (2, 2), - [0.5, 1, 1.5, 2.0]) - const_node = onnx.helper.make_node("Constant", [], outputs=["const_node"], - value=const_tensor, name="const_node") + const_tensor = onnx.helper.make_tensor( + "const_tensor", onnx.TensorProto.FLOAT, (2, 2), [0.5, 1, 1.5, 2.0] + ) + const_node = onnx.helper.make_node( + "Constant", [], outputs=["const_node"], value=const_tensor, name="const_node" + ) mul = onnx.helper.make_node("Mul", inputs=["z", "const_node"], outputs=["out"]) input_tensors = [ make_tensor_value_info("x", onnx.TensorProto.FLOAT, (2, 2)), @@ -72,31 +72,31 @@ def create_onnx_model_with_subgraphs(): def create_onnx_model_with_custom_attributes(): - add = onnx.helper.make_node("Add", inputs=["x", "y"], outputs=["z"], - attribute_i32=np.int32(10), - attribute_i64=np.int64(10), - attribute_str="string", - attribute_f32=float(10), - attribute_f64=np.float64(10), - attribute_bool=True, - attribute_type=onnx.TensorProto.INT32, - - attribute_list_i32=np.array([1, 2, 3], dtype=np.int32), - attribute_list_i64=np.array([1, 2, 3], dtype=np.int64), - attribute_list_str=np.array(["a", "b", "c"], dtype=str), - attribute_list_f32=np.array([1, 2, 3], dtype=float), - attribute_list_f64=np.array([1, 2, 3], dtype=np.float64), - attribute_list_bool=[True, False, True], - attribute_list_type=np.array([onnx.TensorProto.INT32, - onnx.TensorProto.FLOAT]), - - ) - const_tensor = onnx.helper.make_tensor("const_tensor", - onnx.TensorProto.FLOAT, - (2, 2), - [0.5, 1, 1.5, 2.0]) - const_node = onnx.helper.make_node("Constant", [], outputs=["const_node"], - value=const_tensor, name="const_node") + add = onnx.helper.make_node( + "Add", + inputs=["x", "y"], + outputs=["z"], + attribute_i32=np.int32(10), + attribute_i64=np.int64(10), + attribute_str="string", + attribute_f32=float(10), + attribute_f64=np.float64(10), + attribute_bool=True, + attribute_type=onnx.TensorProto.INT32, + attribute_list_i32=np.array([1, 2, 3], dtype=np.int32), + attribute_list_i64=np.array([1, 2, 3], dtype=np.int64), + attribute_list_str=np.array(["a", "b", "c"], dtype=str), + attribute_list_f32=np.array([1, 2, 3], dtype=float), + attribute_list_f64=np.array([1, 2, 3], dtype=np.float64), + attribute_list_bool=[True, False, True], + attribute_list_type=np.array([onnx.TensorProto.INT32, onnx.TensorProto.FLOAT]), + ) + const_tensor = onnx.helper.make_tensor( + "const_tensor", onnx.TensorProto.FLOAT, (2, 2), [0.5, 1, 1.5, 2.0] + ) + const_node = onnx.helper.make_node( + "Constant", [], outputs=["const_node"], value=const_tensor, name="const_node" + ) mul = onnx.helper.make_node("Mul", inputs=["z", "const_node"], outputs=["out"]) input_tensors = [ make_tensor_value_info("x", onnx.TensorProto.FLOAT, (2, 2)), @@ -112,45 +112,62 @@ def create_onnx_model_for_op_extension(): elu = onnx.helper.make_node("Elu", alpha=1.0, inputs=["x"], outputs=["elu"]) # operation with vector, enum, bool attributes - avg_pool = onnx.helper.make_node("AveragePool", kernel_shape=[2, 2], auto_pad="SAME_LOWER", - strides=[2, 2], - inputs=["elu"], outputs=["avg_pool"]) + avg_pool = onnx.helper.make_node( + "AveragePool", + kernel_shape=[2, 2], + auto_pad="SAME_LOWER", + strides=[2, 2], + inputs=["elu"], + outputs=["avg_pool"], + ) # operation with no attributes floor = onnx.helper.make_node("Floor", inputs=["avg_pool"], outputs=["floor"]) # operation with int64_t attribute - concat = onnx.helper.make_node("Concat", axis=0, inputs=["floor", "avg_pool"], outputs=["concat"]) + concat = onnx.helper.make_node( + "Concat", axis=0, inputs=["floor", "avg_pool"], outputs=["concat"] + ) - const_tensor = onnx.helper.make_tensor("const_tensor", - onnx.TensorProto.FLOAT, - [1], - [0.5]) + const_tensor = onnx.helper.make_tensor( + "const_tensor", onnx.TensorProto.FLOAT, [1], [0.5] + ) - const_node = onnx.helper.make_node("Constant", [], outputs=["const_node"], - value=const_tensor, name="const_node") + const_node = onnx.helper.make_node( + "Constant", [], outputs=["const_node"], value=const_tensor, name="const_node" + ) # operation with enum attribute mul = onnx.helper.make_node("Mul", inputs=["concat", "const_node"], outputs=["mul"]) - # operation with element::type (class) attribute - cast = onnx.helper.make_node("Cast", to=int(onnx.TensorProto.FLOAT), inputs=["mul"], outputs=["out"]) + # operation with ov::element::type (class) attribute + cast = onnx.helper.make_node( + "Cast", to=int(onnx.TensorProto.FLOAT), inputs=["mul"], outputs=["out"] + ) input_tensors = [ make_tensor_value_info("x", onnx.TensorProto.FLOAT, (1, 3, 32, 32)), ] - output_tensors = [make_tensor_value_info("out", onnx.TensorProto.FLOAT, (3, 3, 32, 32))] - graph = make_graph([const_node, elu, avg_pool, floor, concat, mul, cast], "graph", - input_tensors, output_tensors) + output_tensors = [ + make_tensor_value_info("out", onnx.TensorProto.FLOAT, (3, 3, 32, 32)) + ] + graph = make_graph( + [const_node, elu, avg_pool, floor, concat, mul, cast], + "graph", + input_tensors, + output_tensors, + ) return make_model(graph, producer_name="ONNX Frontend") def create_onnx_model_extension_with_custom_domain(): - add = onnx.helper.make_node("CustomAdd", inputs=["x", "y"], outputs=["z"], domain="custom_domain") - const_tensor = onnx.helper.make_tensor("const_tensor", - onnx.TensorProto.FLOAT, - (2, 2), - [0.5, 1, 1.5, 2.0]) - const_node = onnx.helper.make_node("Constant", [], outputs=["const_node"], - value=const_tensor, name="const_node") + add = onnx.helper.make_node( + "CustomAdd", inputs=["x", "y"], outputs=["z"], domain="custom_domain" + ) + const_tensor = onnx.helper.make_tensor( + "const_tensor", onnx.TensorProto.FLOAT, (2, 2), [0.5, 1, 1.5, 2.0] + ) + const_node = onnx.helper.make_node( + "Constant", [], outputs=["const_node"], value=const_tensor, name="const_node" + ) mul = onnx.helper.make_node("Mul", inputs=["z", "const_node"], outputs=["out"]) input_tensors = [ make_tensor_value_info("x", onnx.TensorProto.FLOAT, (2, 2)), @@ -187,11 +204,20 @@ def setup_module(): onnx.save_model(create_onnx_model(), onnx_model_filename) onnx.save_model(create_onnx_model(), model_stream) onnx.save_model(create_onnx_model_2(), onnx_model_2_filename) - onnx.save_model(create_onnx_model_with_custom_attributes(), - onnx_model_with_custom_attributes_filename) - onnx.save_model(create_onnx_model_with_subgraphs(), onnx_model_with_subgraphs_filename) - onnx.save_model(create_onnx_model_for_op_extension(), onnx_model_for_op_extension_test) - onnx.save_model(create_onnx_model_extension_with_custom_domain(), onnx_model_extension_with_custom_domain) + onnx.save_model( + create_onnx_model_with_custom_attributes(), + onnx_model_with_custom_attributes_filename, + ) + onnx.save_model( + create_onnx_model_with_subgraphs(), onnx_model_with_subgraphs_filename + ) + onnx.save_model( + create_onnx_model_for_op_extension(), onnx_model_for_op_extension_test + ) + onnx.save_model( + create_onnx_model_extension_with_custom_domain(), + onnx_model_extension_with_custom_domain, + ) def teardown_module(): @@ -227,17 +253,28 @@ def test_convert(): run_model(converted_model, input_1, input_2, expected=[expected]) -@pytest.mark.parametrize(("model_filename", "inputs", "expected"), [ - [onnx_model_filename, - [np.array([[1, 2], [3, 4]], dtype=np.float32), - np.array([[2, 3], [4, 5]], dtype=np.float32)], - np.array([[1.5, 5], [10.5, 18]], dtype=np.float32)], - [onnx_model_with_subgraphs_filename, - [np.array(False, dtype=bool), - np.array([1, 2, 3], dtype=np.float32), - np.array([2, 3, 5], dtype=np.float32)], - np.array([-1, -1, -2], dtype=np.float32)], -]) +@pytest.mark.parametrize( + ("model_filename", "inputs", "expected"), + [ + [ + onnx_model_filename, + [ + np.array([[1, 2], [3, 4]], dtype=np.float32), + np.array([[2, 3], [4, 5]], dtype=np.float32), + ], + np.array([[1.5, 5], [10.5, 18]], dtype=np.float32), + ], + [ + onnx_model_with_subgraphs_filename, + [ + np.array(False, dtype=bool), + np.array([1, 2, 3], dtype=np.float32), + np.array([2, 3, 5], dtype=np.float32), + ], + np.array([-1, -1, -2], dtype=np.float32), + ], + ], +) def test_decode_and_convert(model_filename, inputs, expected): skip_if_onnx_frontend_is_disabled() @@ -251,13 +288,21 @@ def test_decode_and_convert(model_filename, inputs, expected): assert decoded_model for op in decoded_model.get_ordered_ops(): - assert op.get_type_name() in ["Parameter", "Constant", "ONNXFrameworkNode", - "ONNXSubgraphFrameworkNode", "Result"] + assert op.get_type_name() in [ + "Parameter", + "Constant", + "ONNXFrameworkNode", + "ONNXSubgraphFrameworkNode", + "Result", + ] fe.convert(decoded_model) assert decoded_model for op in decoded_model.get_ordered_ops(): - assert op.get_type_name() not in ["ONNXFrameworkNode", "ONNXSubgraphFrameworkNode"] + assert op.get_type_name() not in [ + "ONNXFrameworkNode", + "ONNXSubgraphFrameworkNode", + ] run_model(decoded_model, *inputs, expected=[expected]) @@ -305,16 +350,16 @@ def test_onnx_conversion_extension_check_attributes(): check_attribute(node, "attribute_i32", int, 10) check_attribute(node, "attribute_i64", int, 10) check_attribute(node, "attribute_str", str, "string") - check_attribute(node, "attribute_f32", float, 10.) - check_attribute(node, "attribute_f64", float, 10.) + check_attribute(node, "attribute_f32", float, 10.0) + check_attribute(node, "attribute_f64", float, 10.0) check_attribute(node, "attribute_bool", int, 1) check_attribute(node, "attribute_type", int, 6) check_attribute(node, "attribute_list_i32", list, [1, 2, 3]) check_attribute(node, "attribute_list_i64", list, [1, 2, 3]) check_attribute(node, "attribute_list_str", list, ["a", "b", "c"]) - check_attribute(node, "attribute_list_f32", list, [1., 2., 3.]) - check_attribute(node, "attribute_list_f64", list, [1., 2., 3.]) + check_attribute(node, "attribute_list_f32", list, [1.0, 2.0, 3.0]) + check_attribute(node, "attribute_list_f64", list, [1.0, 2.0, 3.0]) check_attribute(node, "attribute_list_bool", list, [1, 0, 1]) check_attribute(node, "attribute_list_type", list, [6, 1]) @@ -369,12 +414,21 @@ def test_onnx_conversion_extension_attribute_with_default_value(): check_attribute(node, "attribute_list_i32", np.array([4, 5, 6], dtype=np.int32)) check_attribute(node, "attribute_list_i64", np.array([4, 5, 6], dtype=np.int64)) - check_attribute(node, "attribute_list_str", np.array(["d", "e", "f"], dtype=str)) + check_attribute( + node, "attribute_list_str", np.array(["d", "e", "f"], dtype=str) + ) check_attribute(node, "attribute_list_f32", np.array([4, 5, 6], dtype=float)) - check_attribute(node, "attribute_list_f64", np.array([4, 5, 6], dtype=np.float64)) - check_attribute(node, "attribute_list_bool", np.array([True, False, True], dtype=bool)) - check_attribute(node, "attribute_list_type", np.array([onnx.TensorProto.INT32, - onnx.TensorProto.FLOAT])) + check_attribute( + node, "attribute_list_f64", np.array([4, 5, 6], dtype=np.float64) + ) + check_attribute( + node, "attribute_list_bool", np.array([True, False, True], dtype=bool) + ) + check_attribute( + node, + "attribute_list_type", + np.array([onnx.TensorProto.INT32, onnx.TensorProto.FLOAT]), + ) input_1 = node.get_input(0) input_2 = node.get_input(1) @@ -425,8 +479,8 @@ def test_onnx_conversion_extension_cast_attributes(): check_attribute(node, "attribute_bool", True, bool) check_attribute(node, "attribute_type", Type.i32, Type) - check_attribute(node, "attribute_list_i32", [1., 2., 3.], float) - check_attribute(node, "attribute_list_i64", [1., 2., 3.], float) + check_attribute(node, "attribute_list_i32", [1.0, 2.0, 3.0], float) + check_attribute(node, "attribute_list_i64", [1.0, 2.0, 3.0], float) check_attribute(node, "attribute_list_str", ["a", "b", "c"], str) check_attribute(node, "attribute_list_f32", [1, 2, 3], int) check_attribute(node, "attribute_list_f64", [1, 2, 3], int) @@ -528,7 +582,9 @@ def test_onnx_conversion_extension_with_custom_domain(): add = ops.add(input_1, input_2) return [add.output(0)] - fe.add_extension(ConversionExtension("CustomAdd", "custom_domain", custom_converter)) + fe.add_extension( + ConversionExtension("CustomAdd", "custom_domain", custom_converter) + ) input_model = fe.load(onnx_model_extension_with_custom_domain) assert input_model model = fe.convert(input_model) @@ -546,14 +602,20 @@ def test_onnx_op_extension_with_custom_domain(): assert fe assert fe.get_name() == "onnx" - fe.add_extension(OpExtension("opset1.Add", "CustomAdd", "custom_domain", {}, {"auto_broadcast": "numpy"})) + fe.add_extension( + OpExtension( + "opset1.Add", "CustomAdd", "custom_domain", {}, {"auto_broadcast": "numpy"} + ) + ) input_model = fe.load(onnx_model_extension_with_custom_domain) assert input_model model = fe.convert(input_model) assert model -@pytest.mark.parametrize("opset_prefix", ["opset1.", "opset1::", "opset8.", "opset8::", ""]) +@pytest.mark.parametrize( + "opset_prefix", ["opset1.", "opset1::", "opset8.", "opset8::", ""] +) def test_op_extension_specify_opset(opset_prefix): skip_if_onnx_frontend_is_disabled() @@ -576,7 +638,9 @@ def test_op_extension_specify_opset(opset_prefix): assert model -@pytest.mark.parametrize("opset_prefix", ["opset1..", "opset1:::", "opset.", "opset::", "wrong"]) +@pytest.mark.parametrize( + "opset_prefix", ["opset1..", "opset1:::", "opset.", "opset::", "wrong"] +) def test_op_extension_specify_wrong_opset(opset_prefix): skip_if_onnx_frontend_is_disabled() @@ -609,17 +673,26 @@ def test_op_extension_via_onnx_extension_set_attrs_values(): # add extensions core.add_extension(OpExtension("Multiply", "Mul", {}, {"auto_broadcast": "numpy"})) - core.add_extension(OpExtension("Elu", {}, {"alpha": 1.})) + core.add_extension(OpExtension("Elu", {}, {"alpha": 1.0})) core.add_extension(OpExtension("Floor")) core.add_extension(OpExtension("Concat", {}, {"axis": 0})) core.add_extension(OpExtension("Convert", "Cast", {}, {"destination_type": "i64"})) - core.add_extension(OpExtension("AvgPool", "AveragePool", {}, {"kernel": [2, 2], - "strides": [2, 2], - "pads_begin": [0, 0], - "pads_end": [1, 1], - "exclude-pad": True, - "auto_pad": "same_upper", - "rounding_type": "floor"})) + core.add_extension( + OpExtension( + "AvgPool", + "AveragePool", + {}, + { + "kernel": [2, 2], + "strides": [2, 2], + "pads_begin": [0, 0], + "pads_end": [1, 1], + "exclude-pad": True, + "auto_pad": "same_upper", + "rounding_type": "floor", + }, + ) + ) model = core.read_model(onnx_model_for_op_extension_test) assert model @@ -639,17 +712,26 @@ def test_op_extension_via_frontend_extension_set_attrs_values(): # add extensions core.add_extension(OpExtension("Multiply", "Mul", {}, {"auto_broadcast": "numpy"})) - core.add_extension(OpExtension("Elu", "Elu", {}, {"alpha": 1.})) + core.add_extension(OpExtension("Elu", "Elu", {}, {"alpha": 1.0})) core.add_extension(OpExtension("Floor")) core.add_extension(OpExtension("Concat", {}, {"axis": 0})) core.add_extension(OpExtension("Convert", "Cast", {}, {"destination_type": "i64"})) - core.add_extension(OpExtension("AvgPool", "AveragePool", {}, {"kernel": [2, 2], - "strides": [2, 2], - "pads_begin": [0, 0], - "pads_end": [1, 1], - "exclude-pad": True, - "auto_pad": "same_upper", - "rounding_type": "floor"})) + core.add_extension( + OpExtension( + "AvgPool", + "AveragePool", + {}, + { + "kernel": [2, 2], + "strides": [2, 2], + "pads_begin": [0, 0], + "pads_end": [1, 1], + "exclude-pad": True, + "auto_pad": "same_upper", + "rounding_type": "floor", + }, + ) + ) model = core.read_model(onnx_model_for_op_extension_test) assert model @@ -671,13 +753,19 @@ def test_op_extension_via_frontend_extension_map_attributes(): core.add_extension(OpExtension("Elu", "Elu", {"alpha": "alpha"})) core.add_extension(OpExtension("Concat", {"axis": "axis"}, {"axis": 0})) - core.add_extension(OpExtension("AvgPool", "AveragePool", {"kernel": "kernel_shape", - "strides": "strides", - "auto_pad": "auto_pad"}, - {"pads_begin": [0, 0], - "pads_end": [1, 1], - "exclude-pad": True, - "rounding_type": "floor"})) + core.add_extension( + OpExtension( + "AvgPool", + "AveragePool", + {"kernel": "kernel_shape", "strides": "strides", "auto_pad": "auto_pad"}, + { + "pads_begin": [0, 0], + "pads_end": [1, 1], + "exclude-pad": True, + "rounding_type": "floor", + }, + ) + ) model = core.read_model(onnx_model_for_op_extension_test) assert model @@ -686,14 +774,18 @@ def test_op_extension_via_frontend_extension_map_attributes(): def get_builtin_extensions_path(): win_folder_path = Path(__file__).parent.parent.parent.parent linux_folder_path = win_folder_path.joinpath("lib") - for lib_path in chain(win_folder_path.glob("*.dll"), linux_folder_path.glob("*.so")): + for lib_path in chain( + win_folder_path.glob("*.dll"), linux_folder_path.glob("*.so") + ): if "libtest_builtin_extensions" in lib_path.name: return str(lib_path) return "" -@pytest.mark.skipif(len(get_builtin_extensions_path()) == 0, - reason="The extension library path was not found") +@pytest.mark.skipif( + len(get_builtin_extensions_path()) == 0, + reason="The extension library path was not found", +) def test_so_extension_via_frontend_convert_input_model(): skip_if_onnx_frontend_is_disabled() @@ -709,8 +801,10 @@ def test_so_extension_via_frontend_convert_input_model(): assert all(op.get_type_name() != "Relu" for op in model.get_ops()) -@pytest.mark.skipif(len(get_builtin_extensions_path()) == 0, - reason="The extension library path was not found") +@pytest.mark.skipif( + len(get_builtin_extensions_path()) == 0, + reason="The extension library path was not found", +) def test_so_extension_via_frontend_decode_input_model(): skip_if_onnx_frontend_is_disabled() @@ -720,7 +814,9 @@ def test_so_extension_via_frontend_decode_input_model(): in_model = fe.load(onnx_model_2_filename) return fe.decode(in_model) - decoded_model = load_decoded_model() # decoded model has longer lifetime than frontend + decoded_model = ( + load_decoded_model() + ) # decoded model has longer lifetime than frontend assert decoded_model diff --git a/src/inference/src/cnn_network_ngraph_impl.cpp b/src/inference/src/cnn_network_ngraph_impl.cpp index c9e3911cd1c..77ca185c251 100644 --- a/src/inference/src/cnn_network_ngraph_impl.cpp +++ b/src/inference/src/cnn_network_ngraph_impl.cpp @@ -109,15 +109,15 @@ void CNNNetworkNGraphImpl::validateFunctionNames() const { } } -ngraph::element::Type details::toLegacyType(const ngraph::element::Type& ngraph_type, bool input) { +ov::element::Type details::toLegacyType(const ov::element::Type& ngraph_type, bool input) { if (input) { - return ngraph_type == ngraph::element::f16 ? ngraph::element::f32 : ngraph_type; + return ngraph_type == ov::element::f16 ? ov::element::f32 : ngraph_type; } else { - if (ngraph_type == ngraph::element::i64 || ngraph_type == ngraph::element::u64 || - ngraph_type == ngraph::element::i32 || ngraph_type == ngraph::element::u32) { - return ngraph::element::i32; - } else if (ngraph_type != ngraph::element::f32) { - return ngraph::element::f32; + if (ngraph_type == ov::element::i64 || ngraph_type == ov::element::u64 || ngraph_type == ov::element::i32 || + ngraph_type == ov::element::u32) { + return ov::element::i32; + } else if (ngraph_type != ov::element::f32) { + return ov::element::f32; } } diff --git a/src/inference/src/ie_network_reader.cpp b/src/inference/src/ie_network_reader.cpp index 92f5798fada..dc64c6831ce 100644 --- a/src/inference/src/ie_network_reader.cpp +++ b/src/inference/src/ie_network_reader.cpp @@ -58,7 +58,7 @@ CNNNetwork convert_to_cnnnetwork(std::shared_ptr& function, bool is_n // In the following code we add Convert node from old_api_map_type to Parameter type // using PrePostProcessor. As some plugins do not support uint8 type, Convert to uint8 leads // to error, so for such case type is set directly to Parameter node instead of inserting Convert. - if ((param_type == ngraph::element::u8 && old_api_map_type.is_real())) { + if ((param_type == ov::element::u8 && old_api_map_type.is_real())) { parameter->set_element_type(old_api_map_type); need_validate_nodes_and_infer_types = true; } else { diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/low_precision_transformations/multiply_to_group_convolution.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/low_precision_transformations/multiply_to_group_convolution.cpp index 510c6bac6df..e732c75a473 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/low_precision_transformations/multiply_to_group_convolution.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/low_precision_transformations/multiply_to_group_convolution.cpp @@ -18,46 +18,35 @@ const std::vector inputShapes = { }; const std::vector params = { - { - { 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, - {{1.f, 2.f, 3.f}, element::f32, Shape{1, 3, 1, 1}}, - "output/GroupConvolution", - "U8", - true - }, + {{256ul, ov::Shape{1, 1, 1, 1}, {0.f}, {25.5f}, {0.f}, {25.5f}}, + {{1.f, 2.f, 3.f}, ov::element::f32, Shape{1, 3, 1, 1}}, + "output/GroupConvolution", + "U8", + true}, // Multiply with scalar is not transformed to GroupConvolution - { - { 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, - {{4.f}, element::f32, Shape{1, 1, 1, 1}}, - "output/GroupConvolution", - "", - true - }, + {{256ul, ov::Shape{1, 1, 1, 1}, {0.f}, {25.5f}, {0.f}, {25.5f}}, + {{4.f}, ov::element::f32, Shape{1, 1, 1, 1}}, + "output/GroupConvolution", + "", + true}, // Multiply with scalar is not transformed to GroupConvolution - { - { 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, - {{4.f}, element::f32, Shape{}}, - "output/GroupConvolution", - "", - true - }, + {{256ul, ov::Shape{1, 1, 1, 1}, {0.f}, {25.5f}, {0.f}, {25.5f}}, + {{4.f}, ov::element::f32, Shape{}}, + "output/GroupConvolution", + "", + true}, // Zero point - { - { 256ul, ov::Shape { 1, 1, 1, 1 }, { -1.28f }, { 1.27f }, { -1.28f }, { 1.27f } }, - {{1.f, 2.f, 3.f}, element::f32, Shape{1, 3, 1, 1}}, - "output/GroupConvolution", - "U8", - true - }, + {{256ul, ov::Shape{1, 1, 1, 1}, {-1.28f}, {1.27f}, {-1.28f}, {1.27f}}, + {{1.f, 2.f, 3.f}, ov::element::f32, Shape{1, 3, 1, 1}}, + "output/GroupConvolution", + "U8", + true}, // Zero point - { - { 256ul, ov::Shape { 1, 1, 1, 1 }, { -1.28f }, { 1.27f / 2.f }, { -1.28f }, { 1.27f / 2.f} }, - {{1.f, 2.f, 3.f}, element::f32, Shape{1, 3, 1, 1}}, - "output/GroupConvolution", - "U8", - true - } -}; + {{256ul, ov::Shape{1, 1, 1, 1}, {-1.28f}, {1.27f / 2.f}, {-1.28f}, {1.27f / 2.f}}, + {{1.f, 2.f, 3.f}, ov::element::f32, Shape{1, 3, 1, 1}}, + "output/GroupConvolution", + "U8", + true}}; //Comment out the tests because of the transformation is disabled by another WR /* @@ -78,41 +67,30 @@ const std::vector inputShapes = { }; const std::vector params = { - { - { 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, - {{1.f, 2.f, 3.f}, element::f32, Shape{1, 3, 1, 1, 1}}, - "output/GroupConvolution", - "U8" - }, + {{256ul, ov::Shape{1, 1, 1, 1}, {0.f}, {25.5f}, {0.f}, {25.5f}}, + {{1.f, 2.f, 3.f}, ov::element::f32, Shape{1, 3, 1, 1, 1}}, + "output/GroupConvolution", + "U8"}, // Multiply with scalar is not transformed to GroupConvolution - { - { 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, - {{4.f}, element::f32, Shape{1, 1, 1, 1, 1}}, - "output/GroupConvolution", - "" - }, + {{256ul, ov::Shape{1, 1, 1, 1}, {0.f}, {25.5f}, {0.f}, {25.5f}}, + {{4.f}, ov::element::f32, Shape{1, 1, 1, 1, 1}}, + "output/GroupConvolution", + ""}, // Multiply with scalar is not transformed to GroupConvolution - { - { 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, - {{4.f}, element::f32, Shape{}}, - "output/GroupConvolution", - "" - }, + {{256ul, ov::Shape{1, 1, 1, 1}, {0.f}, {25.5f}, {0.f}, {25.5f}}, + {{4.f}, ov::element::f32, Shape{}}, + "output/GroupConvolution", + ""}, // Zero point - { - { 256ul, ov::Shape { 1, 1, 1, 1 }, { -1.28f }, { 1.27f }, { -1.28f }, { 1.27f } }, - {{1.f, 2.f, 3.f}, element::f32, Shape{1, 3, 1, 1, 1}}, - "output/GroupConvolution", - "U8" - }, + {{256ul, ov::Shape{1, 1, 1, 1}, {-1.28f}, {1.27f}, {-1.28f}, {1.27f}}, + {{1.f, 2.f, 3.f}, ov::element::f32, Shape{1, 3, 1, 1, 1}}, + "output/GroupConvolution", + "U8"}, // Zero point - { - { 256ul, ov::Shape { 1, 1, 1, 1 }, { -1.28f }, { 1.27f / 2.f }, { -1.28f }, { 1.27f / 2.f} }, - {{1.f, 2.f, 3.f}, element::f32, Shape{1, 3, 1, 1, 1}}, - "output/GroupConvolution", - "U8" - } -}; + {{256ul, ov::Shape{1, 1, 1, 1}, {-1.28f}, {1.27f / 2.f}, {-1.28f}, {1.27f / 2.f}}, + {{1.f, 2.f, 3.f}, ov::element::f32, Shape{1, 3, 1, 1, 1}}, + "output/GroupConvolution", + "U8"}}; //Comment out the tests because of the transformation is disabled by another WR /* diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_infer_request/infer_request_dynamic.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_infer_request/infer_request_dynamic.cpp index 07634731309..db09627e009 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_infer_request/infer_request_dynamic.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_infer_request/infer_request_dynamic.cpp @@ -17,7 +17,7 @@ auto configs = []() { std::shared_ptr getFunction1() { const std::vector inputShape = {1, 4, 20, 20}; - const ngraph::element::Type_t ngPrc = ngraph::element::Type_t::f32; + const ov::element::Type_t ngPrc = ov::element::Type_t::f32; ov::ParameterVector params{std::make_shared(ngPrc, ov::Shape(inputShape))}; params.front()->set_friendly_name("Param_1"); diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_plugin/caching_tests.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_plugin/caching_tests.cpp index 7e93e87ae51..2225950a2a9 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_plugin/caching_tests.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_plugin/caching_tests.cpp @@ -7,75 +7,75 @@ using namespace ov::test::behavior; namespace { - static const std::vector precisionsGPU = { - ngraph::element::f32, - ngraph::element::f16, - ngraph::element::i32, - ngraph::element::i64, - ngraph::element::i8, - ngraph::element::u8, - ngraph::element::i16, - ngraph::element::u16, - }; +static const std::vector precisionsGPU = { + ov::element::f32, + ov::element::f16, + ov::element::i32, + ov::element::i64, + ov::element::i8, + ov::element::u8, + ov::element::i16, + ov::element::u16, +}; - static const std::vector batchSizesGPU = { - 1, 2 - }; +static const std::vector batchSizesGPU = {1, 2}; - static const std::vector floatingPointPrecisionsGPU = { - ngraph::element::f32, - ngraph::element::f16, - }; +static const std::vector floatingPointPrecisionsGPU = { + ov::element::f32, + ov::element::f16, +}; - INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCaseAnyType_GPU, CompileModelCacheTestBase, - ::testing::Combine( - ::testing::ValuesIn(CompileModelCacheTestBase::getNumericAnyTypeFunctions()), - ::testing::ValuesIn(precisionsGPU), - ::testing::ValuesIn(batchSizesGPU), - ::testing::Values(ov::test::utils::DEVICE_GPU), - ::testing::Values(ov::AnyMap{})), - CompileModelCacheTestBase::getTestCaseName); +INSTANTIATE_TEST_SUITE_P( + smoke_CachingSupportCaseAnyType_GPU, + CompileModelCacheTestBase, + ::testing::Combine(::testing::ValuesIn(CompileModelCacheTestBase::getNumericAnyTypeFunctions()), + ::testing::ValuesIn(precisionsGPU), + ::testing::ValuesIn(batchSizesGPU), + ::testing::Values(ov::test::utils::DEVICE_GPU), + ::testing::Values(ov::AnyMap{})), + CompileModelCacheTestBase::getTestCaseName); - INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCaseFloat_GPU, CompileModelCacheTestBase, - ::testing::Combine( - ::testing::ValuesIn(CompileModelCacheTestBase::getFloatingPointOnlyFunctions()), - ::testing::ValuesIn(floatingPointPrecisionsGPU), - ::testing::ValuesIn(batchSizesGPU), - ::testing::Values(ov::test::utils::DEVICE_GPU), - ::testing::Values(ov::AnyMap{})), - CompileModelCacheTestBase::getTestCaseName); +INSTANTIATE_TEST_SUITE_P( + smoke_CachingSupportCaseFloat_GPU, + CompileModelCacheTestBase, + ::testing::Combine(::testing::ValuesIn(CompileModelCacheTestBase::getFloatingPointOnlyFunctions()), + ::testing::ValuesIn(floatingPointPrecisionsGPU), + ::testing::ValuesIn(batchSizesGPU), + ::testing::Values(ov::test::utils::DEVICE_GPU), + ::testing::Values(ov::AnyMap{})), + CompileModelCacheTestBase::getTestCaseName); - INSTANTIATE_TEST_SUITE_P(smoke_KernelCachingSupportCase_GPU, CompiledKernelsCacheTest, - ::testing::Combine( - ::testing::Values(ov::test::utils::DEVICE_GPU), - ::testing::Values(std::make_pair(ov::AnyMap{}, "blob"))), - CompiledKernelsCacheTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_KernelCachingSupportCase_GPU, + CompiledKernelsCacheTest, + ::testing::Combine(::testing::Values(ov::test::utils::DEVICE_GPU), + ::testing::Values(std::make_pair(ov::AnyMap{}, "blob"))), + CompiledKernelsCacheTest::getTestCaseName); - const std::vector GPULoadFromFileConfigs = { - {ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)}, - {ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)}, - {}, - }; - INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCase_GPU, CompileModelLoadFromFileTestBase, - ::testing::Combine( - ::testing::Values(ov::test::utils::DEVICE_GPU), - ::testing::ValuesIn(GPULoadFromFileConfigs)), - CompileModelLoadFromFileTestBase::getTestCaseName); +const std::vector GPULoadFromFileConfigs = { + {ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)}, + {ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)}, + {}, +}; +INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCase_GPU, + CompileModelLoadFromFileTestBase, + ::testing::Combine(::testing::Values(ov::test::utils::DEVICE_GPU), + ::testing::ValuesIn(GPULoadFromFileConfigs)), + CompileModelLoadFromFileTestBase::getTestCaseName); - INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCase_GPU, - CompileModelCacheRuntimePropertiesTestBase, - ::testing::Combine(::testing::Values(ov::test::utils::DEVICE_GPU), - ::testing::ValuesIn(GPULoadFromFileConfigs)), - CompileModelCacheRuntimePropertiesTestBase::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCase_GPU, + CompileModelCacheRuntimePropertiesTestBase, + ::testing::Combine(::testing::Values(ov::test::utils::DEVICE_GPU), + ::testing::ValuesIn(GPULoadFromFileConfigs)), + CompileModelCacheRuntimePropertiesTestBase::getTestCaseName); - INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCase_GPU, - CompileModelLoadFromMemoryTestBase, - ::testing::Combine(::testing::Values(ov::test::utils::DEVICE_GPU), - ::testing::ValuesIn(GPULoadFromFileConfigs)), - CompileModelLoadFromMemoryTestBase::getTestCaseName); - INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCase_GPU, - CompileModelLoadFromCacheTest, - ::testing::Combine(::testing::Values(ov::test::utils::DEVICE_GPU), - ::testing::ValuesIn(GPULoadFromFileConfigs)), - CompileModelLoadFromCacheTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCase_GPU, + CompileModelLoadFromMemoryTestBase, + ::testing::Combine(::testing::Values(ov::test::utils::DEVICE_GPU), + ::testing::ValuesIn(GPULoadFromFileConfigs)), + CompileModelLoadFromMemoryTestBase::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCase_GPU, + CompileModelLoadFromCacheTest, + ::testing::Combine(::testing::Values(ov::test::utils::DEVICE_GPU), + ::testing::ValuesIn(GPULoadFromFileConfigs)), + CompileModelLoadFromCacheTest::getTestCaseName); } // namespace diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/fuse_convert_transformation.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/fuse_convert_transformation.cpp index 21dbf167ab6..82316c1afcd 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/fuse_convert_transformation.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/fuse_convert_transformation.cpp @@ -7,9 +7,9 @@ using namespace LayerTestsDefinitions; namespace { -const std::vector precisions = { - element::f32, - // element::f16 // TODO: temporarily commented due to failing in GPU Plugin on constant folding stage +const std::vector precisions = { + ov::element::f32, + // ov::element::f16 // TODO: temporarily commented due to failing in GPU Plugin on constant folding stage }; const std::vectorinputAndQuantizationShapes = { diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/multiply_to_group_convolution_transformation.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/multiply_to_group_convolution_transformation.cpp index 1a98bd811c6..79f77bbfdf4 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/multiply_to_group_convolution_transformation.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/multiply_to_group_convolution_transformation.cpp @@ -7,9 +7,7 @@ using namespace LayerTestsDefinitions; namespace { -const std::vector precisions = { - element::f32 -}; +const std::vector precisions = {ov::element::f32}; namespace shape4d { const std::vector inputShapes = { @@ -18,45 +16,35 @@ const std::vector inputShapes = { }; const std::vector params = { - { - { 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, - {{1.f, 2.f, 3.f}, element::f32, Shape{1, 3, 1, 1}}, - "output/GroupConvolution", - "U8", - false - }, + {{256ul, ov::Shape{1, 1, 1, 1}, {0.f}, {25.5f}, {0.f}, {25.5f}}, + {{1.f, 2.f, 3.f}, ov::element::f32, Shape{1, 3, 1, 1}}, + "output/GroupConvolution", + "U8", + false}, // zero point - { - { 256ul, ov::Shape { 1, 1, 1, 1 }, { -1.28f }, { 1.27f }, { -1.28f }, { 1.27f } }, - {{1.f, 2.f, 3.f}, element::f32, Shape{1, 3, 1, 1}}, - "output/GroupConvolution", - "I8", - false - }, + {{256ul, ov::Shape{1, 1, 1, 1}, {-1.28f}, {1.27f}, {-1.28f}, {1.27f}}, + {{1.f, 2.f, 3.f}, ov::element::f32, Shape{1, 3, 1, 1}}, + "output/GroupConvolution", + "I8", + false}, // zero point - { - { 256ul, ov::Shape { 1, 1, 1, 1 }, { -1.28f }, { 1.27f / 2.f }, { -1.28f }, { 1.27f / 2.f} }, - {{1.f, 2.f, 3.f}, element::f32, Shape{1, 3, 1, 1}}, - "output/GroupConvolution", - "U8", - false - }, + {{256ul, ov::Shape{1, 1, 1, 1}, {-1.28f}, {1.27f / 2.f}, {-1.28f}, {1.27f / 2.f}}, + {{1.f, 2.f, 3.f}, ov::element::f32, Shape{1, 3, 1, 1}}, + "output/GroupConvolution", + "U8", + false}, // Multiply => GroupConvolution optimizations - { - { 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, - {{3.f}, element::f32, Shape{1, 1, 1, 1}}, - "output/GroupConvolution", - "", - false - }, - { - { 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, - {{3.f}, element::f32, Shape{1, 1, 1, 1}}, - "output/GroupConvolution", - "", - true - }, + {{256ul, ov::Shape{1, 1, 1, 1}, {0.f}, {25.5f}, {0.f}, {25.5f}}, + {{3.f}, ov::element::f32, Shape{1, 1, 1, 1}}, + "output/GroupConvolution", + "", + false}, + {{256ul, ov::Shape{1, 1, 1, 1}, {0.f}, {25.5f}, {0.f}, {25.5f}}, + {{3.f}, ov::element::f32, Shape{1, 1, 1, 1}}, + "output/GroupConvolution", + "", + true}, }; INSTANTIATE_TEST_SUITE_P(smoke_LPT, MultiplyToGroupConvolutionTransformation, diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/mvn_transformation.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/mvn_transformation.cpp index d758eaa531e..063323ad6ef 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/mvn_transformation.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/mvn_transformation.cpp @@ -7,25 +7,22 @@ using namespace LayerTestsDefinitions; namespace { - const std::vector precisions = { - element::f32, - element::f16 - }; +const std::vector precisions = {ov::element::f32, ov::element::f16}; - const std::vector inputAndQuantizationShapes = { - { 1ul, 4ul, 16ul, 16ul }, - }; +const std::vector inputAndQuantizationShapes = { + {1ul, 4ul, 16ul, 16ul}, +}; - const std::vector reductionAxes = { { 2, 3 }, { 1, 2, 3 } }; +const std::vector reductionAxes = {{2, 3}, {1, 2, 3}}; - const std::vector normalizeVariance = { true, false }; +const std::vector normalizeVariance = {true, false}; - INSTANTIATE_TEST_SUITE_P(smoke_LPT, MVNTransformation, - ::testing::Combine( - ::testing::ValuesIn(precisions), - ::testing::ValuesIn(inputAndQuantizationShapes), - ::testing::Values(ov::test::utils::DEVICE_GPU), - ::testing::ValuesIn(reductionAxes), - ::testing::ValuesIn(normalizeVariance)), - MVNTransformation::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_LPT, + MVNTransformation, + ::testing::Combine(::testing::ValuesIn(precisions), + ::testing::ValuesIn(inputAndQuantizationShapes), + ::testing::Values(ov::test::utils::DEVICE_GPU), + ::testing::ValuesIn(reductionAxes), + ::testing::ValuesIn(normalizeVariance)), + MVNTransformation::getTestCaseName); } // namespace diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/matrix_nms.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/matrix_nms.cpp index 7a040365fff..515aa2ed3c6 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/matrix_nms.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/matrix_nms.cpp @@ -21,7 +21,7 @@ const auto inputPrecisions = InputPrecisions{ov::element::f32, ov::element::i32, const std::vector sortResultType = {ov::op::v8::MatrixNms::SortResultType::CLASSID, ov::op::v8::MatrixNms::SortResultType::SCORE, ov::op::v8::MatrixNms::SortResultType::NONE}; -const std::vector outType = {element::i32, element::i64}; +const std::vector outType = {ov::element::i32, ov::element::i64}; const std::vector topKParams = {TopKParams{-1, 5}, TopKParams{100, -1}}; const std::vector thresholdParams = {ThresholdParams{0.0f, 2.0f, 0.0f}, ThresholdParams{0.1f, 1.5f, 0.2f}}; diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/multiclass_nms.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/multiclass_nms.cpp index 05ef0be236b..031af8b2306 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/multiclass_nms.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/multiclass_nms.cpp @@ -31,7 +31,7 @@ const std::vector iouThreshold = {0.7f}; const std::vector scoreThreshold = {0.7f}; const std::vector backgroundClass = {-1, 1}; const std::vector keepTopK = {-1, 30}; -const std::vector outType = {element::i32, element::i64}; +const std::vector outType = {ov::element::i32, ov::element::i64}; const std::vector sortResultType = { ov::op::util::MulticlassNmsBase::SortResultType::SCORE, diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/nms_rotated.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/nms_rotated.cpp index 80224b57ebc..830bdd344ce 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/nms_rotated.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/nms_rotated.cpp @@ -19,7 +19,7 @@ const std::vector inShapeParams = { const std::vector maxOutBoxPerClass = {5, 20}; const std::vector threshold = {0.3f, 0.7f}; const std::vector sortResDesc = {true, false}; -const std::vector outType = {element::i32, element::i64}; +const std::vector outType = {ov::element::i32, ov::element::i64}; const std::vector clockwise = {true, false}; const std::vector inputPrecisions = {Precision::FP32, Precision::FP16}; diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/pooling.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/pooling.cpp index af4cdeeb0f4..4567394992a 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/pooling.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/pooling.cpp @@ -9,7 +9,6 @@ using namespace ngraph::helpers; using namespace LayerTestsDefinitions; -using namespace ngraph::element; namespace { const std::vector netPrecisions = { @@ -35,7 +34,7 @@ const std::vector> padEnds = {{0, 0}, {0, 2}}; const std::vector roundingTypes = {ov::op::RoundingType::CEIL, ov::op::RoundingType::FLOOR}; -const std::vector indexElementTypes = {ngraph::element::Type_t::i32}; +const std::vector indexElementTypes = {ov::element::Type_t::i32}; const std::vector axes = {0, 2}; const std::vector inputShapeSmall = {1, 3, 30, 30}; const std::vector inputShapeLarge = {1, 3, 50, 50}; diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/topk.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/topk.cpp index 81950bc5568..ec5c4e15de8 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/topk.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/topk.cpp @@ -74,9 +74,9 @@ void TopKLayerTestGPU::SetUp() { auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); ov::ParameterVector params{std::make_shared(ngPrc, ov::Shape(inputShape))}; - auto k = std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape{}, &keepK); + auto k = std::make_shared(ov::element::Type_t::i64, ngraph::Shape{}, &keepK); auto topk = std::dynamic_pointer_cast( - std::make_shared(params[0], k, axis, mode, sort, ngraph::element::Type_t::i64, stable)); + std::make_shared(params[0], k, axis, mode, sort, ov::element::Type_t::i64, stable)); ngraph::ResultVector results; for (size_t i = 0; i < topk->get_output_size(); i++) { @@ -126,14 +126,14 @@ InferenceEngine::Blob::Ptr TopKLayerTestGPU::GenerateInput(const InferenceEngine rawBlobDataPtr[i] = static_cast(data[i] / divisor); } } else if (InferenceEngine::Precision::BF16 == info.getTensorDesc().getPrecision()) { - auto* rawBlobDataPtr = blob->buffer().as(); + auto* rawBlobDataPtr = blob->buffer().as(); for (size_t i = 0; i < size; i++) { - rawBlobDataPtr[i] = static_cast(data[i] / divisor); + rawBlobDataPtr[i] = static_cast(data[i] / divisor); } } else if (InferenceEngine::Precision::FP16 == info.getTensorDesc().getPrecision()) { - auto* rawBlobDataPtr = blob->buffer().as(); + auto* rawBlobDataPtr = blob->buffer().as(); for (size_t i = 0; i < size; i++) { - rawBlobDataPtr[i] = static_cast(data[i] / divisor); + rawBlobDataPtr[i] = static_cast(data[i] / divisor); } } diff --git a/src/tests/functional/plugin/shared/include/low_precision_transformations/fuse_convert_transformation.hpp b/src/tests/functional/plugin/shared/include/low_precision_transformations/fuse_convert_transformation.hpp index e90a2bad6c2..e9480ca3022 100644 --- a/src/tests/functional/plugin/shared/include/low_precision_transformations/fuse_convert_transformation.hpp +++ b/src/tests/functional/plugin/shared/include/low_precision_transformations/fuse_convert_transformation.hpp @@ -15,12 +15,9 @@ using namespace ngraph; namespace LayerTestsDefinitions { -typedef std::tuple < - element::Type, - ov::PartialShape, - std::string, - ov::builder::subgraph::DequantizationOperations, - bool> FuseConvertTransformationParams; +typedef std:: + tuple + FuseConvertTransformationParams; class FuseConvertTransformation : public testing::WithParamInterface, diff --git a/src/tests/functional/plugin/shared/include/low_precision_transformations/multiply_to_group_convolution_transformation.hpp b/src/tests/functional/plugin/shared/include/low_precision_transformations/multiply_to_group_convolution_transformation.hpp index 6dfb25e6e08..cb4112ba6c9 100644 --- a/src/tests/functional/plugin/shared/include/low_precision_transformations/multiply_to_group_convolution_transformation.hpp +++ b/src/tests/functional/plugin/shared/include/low_precision_transformations/multiply_to_group_convolution_transformation.hpp @@ -26,7 +26,7 @@ public: }; typedef std::tuple < - element::Type, + ov::element::Type, PartialShape, std::string, MultiplyToGroupConvolutionTransformationParam> MultiplyToGroupConvolutionTransformationParams; diff --git a/src/tests/functional/plugin/shared/include/low_precision_transformations/mvn_transformation.hpp b/src/tests/functional/plugin/shared/include/low_precision_transformations/mvn_transformation.hpp index 9d57299b61f..fdb5677ddd6 100644 --- a/src/tests/functional/plugin/shared/include/low_precision_transformations/mvn_transformation.hpp +++ b/src/tests/functional/plugin/shared/include/low_precision_transformations/mvn_transformation.hpp @@ -14,12 +14,7 @@ using namespace ngraph; namespace LayerTestsDefinitions { -typedef std::tuple < - element::Type, - ov::PartialShape, - std::string, - AxisSet, - bool> MVNTransformationParams; +typedef std::tuple MVNTransformationParams; class MVNTransformation : public testing::WithParamInterface, diff --git a/src/tests/functional/plugin/shared/include/single_layer_tests/loop.hpp b/src/tests/functional/plugin/shared/include/single_layer_tests/loop.hpp index 435ff4b6a5a..7c87f19fbe7 100644 --- a/src/tests/functional/plugin/shared/include/single_layer_tests/loop.hpp +++ b/src/tests/functional/plugin/shared/include/single_layer_tests/loop.hpp @@ -48,12 +48,12 @@ TEST_P(TrivialLoopTest, PassThroughBody) { const auto scalarShape = ov::Shape{}; auto start = std::make_shared(prc, shape); - auto count = std::make_shared(ngraph::element::i64, scalarShape, 5); - auto icond = std::make_shared(ngraph::element::boolean, scalarShape, true); + auto count = std::make_shared(ov::element::i64, scalarShape, 5); + auto icond = std::make_shared(ov::element::boolean, scalarShape, true); // Loop body auto b_data = std::make_shared(prc, shape); - auto b_cond = std::make_shared(ngraph::element::boolean, scalarShape); + auto b_cond = std::make_shared(ov::element::boolean, scalarShape); auto body = std::make_shared( ov::OutputVector {b_cond, b_data}, // | passthrough body, no data changes @@ -92,13 +92,13 @@ TEST_P(TrivialLoopTest, UnusedInputBody) { const auto scalarShape = ov::Shape{}; auto start = std::make_shared(prc, shape); - auto count = std::make_shared(ngraph::element::i64, scalarShape, 5); - auto icond = std::make_shared(ngraph::element::boolean, scalarShape, true); + auto count = std::make_shared(ov::element::i64, scalarShape, 5); + auto icond = std::make_shared(ov::element::boolean, scalarShape, true); // Loop body auto b_data = std::make_shared(prc, shape); - auto b_cond = std::make_shared(ngraph::element::boolean, scalarShape, true); - auto b_iter = std::make_shared(ngraph::element::i64, scalarShape); + auto b_cond = std::make_shared(ov::element::boolean, scalarShape, true); + auto b_iter = std::make_shared(ov::element::i64, scalarShape); auto body = std::make_shared( ov::OutputVector {b_cond, b_data}, diff --git a/src/tests/functional/plugin/shared/src/precomp.hpp b/src/tests/functional/plugin/shared/src/precomp.hpp index dfcf51fe79f..593398719c2 100644 --- a/src/tests/functional/plugin/shared/src/precomp.hpp +++ b/src/tests/functional/plugin/shared/src/precomp.hpp @@ -7,11 +7,17 @@ #include #include +#include +#include +#include +#include +#include #include #include #include #include #include +#include #include #include #include @@ -24,8 +30,4 @@ #include #include -#include -#include -#include -#include -#include +#include "openvino/core/type/float16.hpp" diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/base/layer_test_utils.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/base/layer_test_utils.hpp index ca4525331ae..2f42836f6e8 100644 --- a/src/tests/functional/shared_test_classes/include/shared_test_classes/base/layer_test_utils.hpp +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/base/layer_test_utils.hpp @@ -4,28 +4,22 @@ #pragma once -#include -#include -#include -#include -#include #include #include -#include "common_test_utils/ov_test_utils.hpp" #include "common_test_utils/common_utils.hpp" +#include "common_test_utils/ov_test_utils.hpp" #include "common_test_utils/test_common.hpp" - -#include "functional_test_utils/crash_handler.hpp" -#include "functional_test_utils/skip_tests_config.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "functional_test_utils/blob_utils.hpp" +#include "functional_test_utils/crash_handler.hpp" +#include "functional_test_utils/plugin_cache.hpp" #include "functional_test_utils/precision_utils.hpp" -#include "functional_test_utils/summary/op_summary.hpp" +#include "functional_test_utils/skip_tests_config.hpp" #include "functional_test_utils/summary/environment.hpp" - -#include "ov_models/utils/ov_helpers.hpp" +#include "functional_test_utils/summary/op_summary.hpp" +#include "openvino/core/type/bfloat16.hpp" #include "ov_models/pass/convert_prc.hpp" +#include "ov_models/utils/ov_helpers.hpp" namespace LayerTestsUtils { diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/eye.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/eye.hpp index ecd003b923c..6c3f83069fa 100644 --- a/src/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/eye.hpp +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/eye.hpp @@ -9,7 +9,7 @@ namespace LayerTestsDefinitions { using ElementType = ov::element::Type_t; using TargetDevice = std::string; -using LocalElementType = ov::element_type_traits::value_type; +using LocalElementType = ov::element_type_traits::value_type; using EyeLayerTestParams = std::tuple, // eye shape std::vector, // output batch shape diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/multiclass_nms.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/multiclass_nms.hpp index 2541ebca9a0..3c8f9fb246b 100644 --- a/src/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/multiclass_nms.hpp +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/multiclass_nms.hpp @@ -37,8 +37,8 @@ using MulticlassNmsParams = std::tuple, int32_t, // keep_top_k ov::element::Type, // Output type ov::op::util::MulticlassNmsBase::SortResultType, // SortResultType - InputboolVar, // Sort result across batch, normalized - bool, // make output shape static + InputboolVar, // Sort result across batch, normalized + bool, // make output shape static std::string>; class MulticlassNmsLayerTest : public testing::WithParamInterface, diff --git a/src/tests/functional/shared_test_classes/src/base/layer_test_utils.cpp b/src/tests/functional/shared_test_classes/src/base/layer_test_utils.cpp index a9e655e859d..d0d96572bfe 100644 --- a/src/tests/functional/shared_test_classes/src/base/layer_test_utils.cpp +++ b/src/tests/functional/shared_test_classes/src/base/layer_test_utils.cpp @@ -156,9 +156,11 @@ InferenceEngine::Blob::Ptr LayerTestsCommon::GenerateInput(const InferenceEngine return FuncTestUtils::createAndFillBlob(info.getTensorDesc()); } -void LayerTestsCommon::Compare(const std::vector>> &expectedOutputs, - const std::vector &actualOutputs, - float threshold, float abs_threshold) { +void LayerTestsCommon::Compare( + const std::vector>>& expectedOutputs, + const std::vector& actualOutputs, + float threshold, + float abs_threshold) { for (std::size_t outputIndex = 0; outputIndex < expectedOutputs.size(); ++outputIndex) { const auto &expected = expectedOutputs[outputIndex]; const auto &actual = actualOutputs[outputIndex]; @@ -167,98 +169,142 @@ void LayerTestsCommon::Compare(const std::vector -inline void callCompare(const std::pair> &expected, - const T_IE* actualBuffer, size_t size, float threshold, float abs_threshold) { +inline void callCompare(const std::pair>& expected, + const T_IE* actualBuffer, + size_t size, + float threshold, + float abs_threshold) { auto expectedBuffer = expected.second.data(); switch (expected.first) { - case ngraph::element::Type_t::boolean: - case ngraph::element::Type_t::u8: - LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), - actualBuffer, size, threshold, abs_threshold); - break; - case ngraph::element::Type_t::i8: - LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), - actualBuffer, size, threshold, abs_threshold); - break; - case ngraph::element::Type_t::u16: - LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), - actualBuffer, size, threshold, abs_threshold); - break; - case ngraph::element::Type_t::i16: - LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), - actualBuffer, size, threshold, abs_threshold); - break; - case ngraph::element::Type_t::u32: - LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), - actualBuffer, size, threshold, abs_threshold); - break; - case ngraph::element::Type_t::i32: - LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), - actualBuffer, size, threshold, abs_threshold); - break; - case ngraph::element::Type_t::u64: - LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), - actualBuffer, size, threshold, abs_threshold); - break; - case ngraph::element::Type_t::i64: - LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), - actualBuffer, size, threshold, abs_threshold); - break; - case ngraph::element::Type_t::bf16: - LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), - actualBuffer, size, threshold, abs_threshold); - break; - case ngraph::element::Type_t::f16: - LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), - actualBuffer, size, threshold, abs_threshold); - break; - case ngraph::element::Type_t::f32: - LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), - actualBuffer, size, threshold, abs_threshold); - break; - case ngraph::element::Type_t::f64: - LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), - actualBuffer, size, threshold, abs_threshold); - break; - case ngraph::element::Type_t::i4: { - auto expectedOut = ngraph::helpers::convertOutputPrecision( - expected.second, - expected.first, - ngraph::element::Type_t::i8, - size); - LayerTestsCommon::Compare(reinterpret_cast(expectedOut.data()), - actualBuffer, size, threshold, abs_threshold); - break; - } - case ngraph::element::Type_t::u4: { - auto expectedOut = ngraph::helpers::convertOutputPrecision( - expected.second, - expected.first, - ngraph::element::Type_t::u8, - size); - LayerTestsCommon::Compare(reinterpret_cast(expectedOut.data()), - actualBuffer, size, threshold, abs_threshold); - break; - } - case ngraph::element::Type_t::dynamic: - case ngraph::element::Type_t::undefined: - LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), actualBuffer, size, threshold, abs_threshold); - break; - default: FAIL() << "Comparator for " << expected.first << " precision isn't supported"; + case ov::element::Type_t::boolean: + case ov::element::Type_t::u8: + LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), + actualBuffer, + size, + threshold, + abs_threshold); + break; + case ov::element::Type_t::i8: + LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), + actualBuffer, + size, + threshold, + abs_threshold); + break; + case ov::element::Type_t::u16: + LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), + actualBuffer, + size, + threshold, + abs_threshold); + break; + case ov::element::Type_t::i16: + LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), + actualBuffer, + size, + threshold, + abs_threshold); + break; + case ov::element::Type_t::u32: + LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), + actualBuffer, + size, + threshold, + abs_threshold); + break; + case ov::element::Type_t::i32: + LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), + actualBuffer, + size, + threshold, + abs_threshold); + break; + case ov::element::Type_t::u64: + LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), + actualBuffer, + size, + threshold, + abs_threshold); + break; + case ov::element::Type_t::i64: + LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), + actualBuffer, + size, + threshold, + abs_threshold); + break; + case ov::element::Type_t::bf16: + LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), + actualBuffer, + size, + threshold, + abs_threshold); + break; + case ov::element::Type_t::f16: + LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), + actualBuffer, + size, + threshold, + abs_threshold); + break; + case ov::element::Type_t::f32: + LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), + actualBuffer, + size, + threshold, + abs_threshold); + break; + case ov::element::Type_t::f64: + LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), + actualBuffer, + size, + threshold, + abs_threshold); + break; + case ov::element::Type_t::i4: { + auto expectedOut = + ngraph::helpers::convertOutputPrecision(expected.second, expected.first, ov::element::Type_t::i8, size); + LayerTestsCommon::Compare(reinterpret_cast(expectedOut.data()), + actualBuffer, + size, + threshold, + abs_threshold); + break; + } + case ov::element::Type_t::u4: { + auto expectedOut = + ngraph::helpers::convertOutputPrecision(expected.second, expected.first, ov::element::Type_t::u8, size); + LayerTestsCommon::Compare(reinterpret_cast(expectedOut.data()), + actualBuffer, + size, + threshold, + abs_threshold); + break; + } + case ov::element::Type_t::dynamic: + case ov::element::Type_t::undefined: + LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), + actualBuffer, + size, + threshold, + abs_threshold); + break; + default: + FAIL() << "Comparator for " << expected.first << " precision isn't supported"; } return; } -void LayerTestsCommon::Compare(const std::pair> &expected, - const InferenceEngine::Blob::Ptr &actual, +void LayerTestsCommon::Compare(const std::pair>& expected, + const InferenceEngine::Blob::Ptr& actual, float threshold, float abs_threshold) { const auto &precision = actual->getTensorDesc().getPrecision(); auto k = static_cast(expected.first.size()) / precision.size(); // W/A for int4, uint4 - if (expected.first == ngraph::element::Type_t::u4 || expected.first == ngraph::element::Type_t::i4) { + if (expected.first == ov::element::Type_t::u4 || expected.first == ov::element::Type_t::i4) { k /= 2; - } else if (expected.first == ngraph::element::Type_t::undefined || expected.first == ngraph::element::Type_t::dynamic) { + } else if (expected.first == ov::element::Type_t::undefined || expected.first == ov::element::Type_t::dynamic) { k = 1; } ASSERT_EQ(expected.second.size(), actual->byteSize() * k); @@ -296,10 +342,18 @@ void LayerTestsCommon::Compare(const std::pair(expected, reinterpret_cast(actualBuffer), size, threshold, abs_threshold); break; case InferenceEngine::Precision::BF16: - callCompare(expected, reinterpret_cast(actualBuffer), size, threshold, abs_threshold); + callCompare(expected, + reinterpret_cast(actualBuffer), + size, + threshold, + abs_threshold); break; case InferenceEngine::Precision::FP16: - callCompare(expected, reinterpret_cast(actualBuffer), size, threshold, abs_threshold); + callCompare(expected, + reinterpret_cast(actualBuffer), + size, + threshold, + abs_threshold); break; case InferenceEngine::Precision::FP32: callCompare(expected, reinterpret_cast(actualBuffer), size, threshold, abs_threshold); @@ -312,8 +366,8 @@ void LayerTestsCommon::Compare(const std::pair> &expected, - const InferenceEngine::Blob::Ptr &actual) { +void LayerTestsCommon::Compare(const std::pair>& expected, + const InferenceEngine::Blob::Ptr& actual) { Compare(expected, actual, threshold); } @@ -436,16 +490,16 @@ void LayerTestsCommon::Infer() { } void LayerTestsCommon::ConvertRefsParams() { - ngraph::pass::ConvertPrecision().run_on_model(functionRefs); - ngraph::pass::ConvertPrecision().run_on_model(functionRefs); + ngraph::pass::ConvertPrecision().run_on_model(functionRefs); + ngraph::pass::ConvertPrecision().run_on_model(functionRefs); } -std::vector>> LayerTestsCommon::CalculateRefs() { +std::vector>> LayerTestsCommon::CalculateRefs() { ConvertRefsParams(); functionRefs->validate_nodes_and_infer_types(); auto referenceInputs = std::vector>(inputs.size()); - auto refInputsTypes = std::vector(inputs.size()); + auto refInputsTypes = std::vector(inputs.size()); for (std::size_t i = 0; i < inputs.size(); ++i) { const auto &input = inputs[i]; const auto inputSize = input->byteSize(); @@ -463,7 +517,7 @@ std::vector>> LayerTe } const auto &&outputsInfo = executableNetwork.GetOutputsInfo(); - std::vector convertType; + std::vector convertType; convertType.reserve(outputsInfo.size()); for (const auto &output : outputsInfo) { convertType.push_back( @@ -471,7 +525,7 @@ std::vector>> LayerTe output.second->getTensorDesc().getPrecision())); } - std::vector>> expectedOutputs; + std::vector>> expectedOutputs; switch (refMode) { case INTERPRETER: { expectedOutputs = ngraph::helpers::interpreterFunction(functionRefs, referenceInputs, refInputsTypes); @@ -500,8 +554,9 @@ std::vector LayerTestsCommon::GetOutputs() { return outputs; } -void LayerTestsCommon::Compare(const std::vector>> &expectedOutputs, - const std::vector &actualOutputs) { +void LayerTestsCommon::Compare( + const std::vector>>& expectedOutputs, + const std::vector& actualOutputs) { Compare(expectedOutputs, actualOutputs, threshold); } diff --git a/src/tests/functional/shared_test_classes/src/single_layer/adaptive_pooling.cpp b/src/tests/functional/shared_test_classes/src/single_layer/adaptive_pooling.cpp index b2666aab3f9..ce8656427ae 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/adaptive_pooling.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/adaptive_pooling.cpp @@ -41,10 +41,10 @@ void AdaPoolLayerTest::SetUp() { ov::ParameterVector params{std::make_shared(ngPrc, ov::Shape(inputShape))}; ov::Shape pooledShape = {pooledSpatialShape.size() }; - auto pooledParam = ov::test::utils::deprecated::make_constant(ngraph::element::i32, pooledShape, pooledSpatialShape); + auto pooledParam = ov::test::utils::deprecated::make_constant(ov::element::i32, pooledShape, pooledSpatialShape); // we cannot create abstract Op to use polymorphism - auto adapoolMax = std::make_shared(params[0], pooledParam, ngraph::element::i32); + auto adapoolMax = std::make_shared(params[0], pooledParam, ov::element::i32); auto adapoolAvg = std::make_shared(params[0], pooledParam); function = (poolingMode == "max" ? std::make_shared(adapoolMax->outputs(), params, "AdaPoolMax") : diff --git a/src/tests/functional/shared_test_classes/src/single_layer/convolution_backprop.cpp b/src/tests/functional/shared_test_classes/src/single_layer/convolution_backprop.cpp index 1a64d36742b..8e0ec8fc3c0 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/convolution_backprop.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/convolution_backprop.cpp @@ -58,7 +58,7 @@ void ConvolutionBackpropLayerTest::SetUp() { ngraph::builder::makeConvolutionBackpropData(params[0], ngPrc, kernel, stride, padBegin, padEnd, dilation, padType, convOutChannels, false, outPadding)); if (!outputShape.empty()) { - auto outShape = ov::op::v0::Constant::create(ngraph::element::i64, {outputShape.size()}, outputShape); + auto outShape = ov::op::v0::Constant::create(ov::element::i64, {outputShape.size()}, outputShape); convBackpropData = std::dynamic_pointer_cast( ngraph::builder::makeConvolutionBackpropData(params[0], outShape, ngPrc, kernel, stride, padBegin, padEnd, dilation, padType, convOutChannels)); diff --git a/src/tests/functional/shared_test_classes/src/single_layer/convolution_backprop_data.cpp b/src/tests/functional/shared_test_classes/src/single_layer/convolution_backprop_data.cpp index 8e31c8f10d7..94010e9a26e 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/convolution_backprop_data.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/convolution_backprop_data.cpp @@ -60,7 +60,7 @@ void ConvolutionBackpropDataLayerTest::SetUp() { ngraph::builder::makeConvolutionBackpropData(params[0], ngPrc, kernel, stride, padBegin, padEnd, dilation, padType, convOutChannels, false, outPadding)); if (!outputShape.empty()) { - auto outShape = ov::op::v0::Constant::create(ngraph::element::i64, {outputShape.size()}, outputShape); + auto outShape = ov::op::v0::Constant::create(ov::element::i64, {outputShape.size()}, outputShape); convBackpropData = std::dynamic_pointer_cast( ngraph::builder::makeConvolutionBackpropData(params[0], outShape, ngPrc, kernel, stride, padBegin, padEnd, dilation, padType, convOutChannels)); diff --git a/src/tests/functional/shared_test_classes/src/single_layer/eye.cpp b/src/tests/functional/shared_test_classes/src/single_layer/eye.cpp index a857ca4a17f..cf5a13baa14 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/eye.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/eye.cpp @@ -51,15 +51,15 @@ void EyeLayerTest::SetUp() { std::shared_ptr eye_operation; - auto rows_const = std::make_shared(ngraph::element::i32, input_shapes[0], &row_num); + auto rows_const = std::make_shared(ov::element::i32, input_shapes[0], &row_num); rows_const->set_friendly_name("rows"); - auto cols_const = std::make_shared(ngraph::element::i32, input_shapes[1], &col_num); + auto cols_const = std::make_shared(ov::element::i32, input_shapes[1], &col_num); cols_const->set_friendly_name("cols"); - auto diag_const = std::make_shared(ngraph::element::i32, input_shapes[2], &shift); + auto diag_const = std::make_shared(ov::element::i32, input_shapes[2], &shift); diag_const->set_friendly_name("diagInd"); if (!out_batch_shape.empty() && out_batch_shape[0] != 0) { - auto batch_shape_par = std::make_shared(ngraph::element::i32, + auto batch_shape_par = std::make_shared(ov::element::i32, ov::Shape{out_batch_shape.size()}, out_batch_shape.data()); batch_shape_par->set_friendly_name("batchShape"); diff --git a/src/tests/functional/shared_test_classes/src/single_layer/gather.cpp b/src/tests/functional/shared_test_classes/src/single_layer/gather.cpp index 30db678c977..25d9dfcfcd4 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/gather.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/gather.cpp @@ -18,8 +18,8 @@ void GatherLayerTestBase::SetUp(const gatherParamsTuple& params) { ASSERT_EQ(ov::shape_size(indicesShape), indices.size()) << "Indices vector size and provided indices shape doesn't fit each other"; auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); ov::ParameterVector functionParams {std::make_shared(ngPrc, ov::Shape(inputShape))}; - auto indicesNode = ov::op::v0::Constant::create(ngraph::element::i64, ov::Shape(indicesShape), indices); - auto axisNode = ov::op::v0::Constant::create(ngraph::element::i64, ov::Shape({}), {axis}); + auto indicesNode = ov::op::v0::Constant::create(ov::element::i64, ov::Shape(indicesShape), indices); + auto axisNode = ov::op::v0::Constant::create(ov::element::i64, ov::Shape({}), {axis}); auto gather = std::make_shared(functionParams[0], indicesNode, axisNode); ov::ResultVector results{std::make_shared(gather)}; function = std::make_shared(results, functionParams, "gather"); @@ -85,9 +85,9 @@ void Gather7LayerTest::SetUp() { int batchIdx = std::get<1>(axis_batchIdx); auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); ov::ParameterVector functionParams {std::make_shared(ngPrc, ov::Shape(inputShape))}; - auto indicesNode = ov::test::utils::deprecated::make_constant(ngraph::element::i64, indicesShape, {}, true, + auto indicesNode = ov::test::utils::deprecated::make_constant(ov::element::i64, indicesShape, {}, true, inputShape[axis < 0 ? axis + inputShape.size() : axis] - 1, 0); - auto axisNode = ov::op::v0::Constant::create(ngraph::element::i64, ov::Shape({}), { axis }); + auto axisNode = ov::op::v0::Constant::create(ov::element::i64, ov::Shape({}), { axis }); auto gather = std::make_shared(functionParams[0], indicesNode, axisNode, batchIdx); ov::ResultVector results{ std::make_shared(gather) }; function = std::make_shared(results, functionParams, "gather"); @@ -126,10 +126,10 @@ void Gather8LayerTest::SetUp() { int batchIdx = std::get<1>(axis_batchIdx); auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); ov::ParameterVector functionParams {std::make_shared(ngPrc, ov::Shape(inputShape))}; - auto indicesNode = ov::test::utils::deprecated::make_constant(ngraph::element::i64, indicesShape, {}, true, + auto indicesNode = ov::test::utils::deprecated::make_constant(ov::element::i64, indicesShape, {}, true, inputShape[axis < 0 ? axis + inputShape.size() : axis] - 1, -static_cast(inputShape[axis < 0 ? axis + inputShape.size() : axis])); - auto axisNode = ov::op::v0::Constant::create(ngraph::element::i64, ov::Shape({}), { axis }); + auto axisNode = ov::op::v0::Constant::create(ov::element::i64, ov::Shape({}), { axis }); auto gather = std::make_shared(functionParams[0], indicesNode, axisNode, batchIdx); ov::ResultVector results{ std::make_shared(gather) }; function = std::make_shared(results, functionParams, "gather"); @@ -168,9 +168,9 @@ void Gather8IndiceScalarLayerTest::SetUp() { int batchIdx = std::get<1>(axis_batchIdx); auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); ov::ParameterVector functionParams {std::make_shared(ngPrc, ov::Shape(inputShape))}; - auto indicesNode = ov::op::v0::Constant::create(ngraph::element::i64, ov::Shape{}, {inputShape[axis] - 1})->output(0); + auto indicesNode = ov::op::v0::Constant::create(ov::element::i64, ov::Shape{}, {inputShape[axis] - 1})->output(0); - auto axisNode = ov::op::v0::Constant::create(ngraph::element::i64, ov::Shape({}), { axis }); + auto axisNode = ov::op::v0::Constant::create(ov::element::i64, ov::Shape({}), { axis }); auto gather = std::make_shared(functionParams[0], indicesNode, axisNode, batchIdx); ov::ResultVector results{ std::make_shared(gather) }; function = std::make_shared(results, functionParams, "gather"); @@ -220,8 +220,8 @@ void Gather8withIndicesDataLayerTest::SetUp() { int batchIdx = std::get<1>(axis_batchIdx); auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); ov::ParameterVector functionParams {std::make_shared(ngPrc, ov::Shape(inputShape))}; - auto indicesNode = ov::test::utils::deprecated::make_constant(ngraph::element::i64, indicesShape, indicesData); - auto axisNode = ov::op::v0::Constant::create(ngraph::element::i64, ov::Shape({}), { axis }); + auto indicesNode = ov::test::utils::deprecated::make_constant(ov::element::i64, indicesShape, indicesData); + auto axisNode = ov::op::v0::Constant::create(ov::element::i64, ov::Shape({}), { axis }); auto gather = std::make_shared(functionParams[0], indicesNode, axisNode, batchIdx); ov::ResultVector results{ std::make_shared(gather) }; function = std::make_shared(results, functionParams, "gather"); diff --git a/src/tests/functional/shared_test_classes/src/single_layer/group_convolution_backprop_data.cpp b/src/tests/functional/shared_test_classes/src/single_layer/group_convolution_backprop_data.cpp index 466e4fd374d..f62796ea097 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/group_convolution_backprop_data.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/group_convolution_backprop_data.cpp @@ -109,7 +109,7 @@ void GroupConvBackpropLayerTest::SetUp() { ov::ParameterVector params{std::make_shared(ngPrc, ov::Shape(inputShape))}; std::shared_ptr groupConvBackpropData; if (!outputShape.empty()) { - auto outShape = ov::op::v0::Constant::create(ngraph::element::i64, {outputShape.size()}, outputShape); + auto outShape = ov::op::v0::Constant::create(ov::element::i64, {outputShape.size()}, outputShape); groupConvBackpropData = std::dynamic_pointer_cast( ngraph::builder::makeGroupConvolutionBackpropData(params[0], outShape, ngPrc, kernel, stride, padBegin, padEnd, dilation, padType, convOutChannels, numGroups, false, outPadding)); diff --git a/src/tests/functional/shared_test_classes/src/single_layer/loop.cpp b/src/tests/functional/shared_test_classes/src/single_layer/loop.cpp index 95d8639b872..21aaa59b82b 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/loop.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/loop.cpp @@ -59,9 +59,9 @@ namespace LayerTestsDefinitions { types_separate.push_back(el.second); } // Example: - /* auto X = std::make_shared(ngraph::element::f32, ov::Shape{32, 1, 10}); - auto Y = std::make_shared(ngraph::element::f32, ov::Shape{32, 1, 10}); - auto M = std::make_shared(ngraph::element::f32, ov::Shape{32, 1, 10});*/ + /* auto X = std::make_shared(ov::element::f32, ov::Shape{32, 1, 10}); + auto Y = std::make_shared(ov::element::f32, ov::Shape{32, 1, 10}); + auto M = std::make_shared(ov::element::f32, ov::Shape{32, 1, 10});*/ ov::ParameterVector params; for (auto&& shape : inputs_separate) { params.push_back(std::make_shared(ngPrc, ov::Shape(shape))); @@ -70,12 +70,12 @@ namespace LayerTestsDefinitions { // Set up the cell body, a function from (Xi, Yi) -> (Zo) // Body parameters const std::vector body_params_shapes(inputs_separate.size(), ov::PartialShape::dynamic()); - auto current_iteration = std::make_shared(ngraph::element::i64, ov::Shape{1}); + auto current_iteration = std::make_shared(ov::element::i64, ov::Shape{1}); //Example: -/* auto Xi = std::make_shared(ngraph::element::f32, ov::PartialShape::dynamic()); - auto Yi = std::make_shared(ngraph::element::f32, ov::PartialShape::dynamic()); - auto M_body = std::make_shared(ngraph::element::f32, ov::PartialShape::dynamic());*/ +/* auto Xi = std::make_shared(ov::element::f32, ov::PartialShape::dynamic()); + auto Yi = std::make_shared(ov::element::f32, ov::PartialShape::dynamic()); + auto M_body = std::make_shared(ov::element::f32, ov::PartialShape::dynamic());*/ ov::ParameterVector body_params; for (const auto &pshape : body_params_shapes) { @@ -87,23 +87,23 @@ namespace LayerTestsDefinitions { if (is_body_condition_const) { if (body_condition) { body_condition_const = std::make_shared( - ngraph::element::boolean, ov::Shape{1}, true); + ov::element::boolean, ov::Shape{1}, true); } else { body_condition_const = std::make_shared( - ngraph::element::boolean, ov::Shape{1}, false); + ov::element::boolean, ov::Shape{1}, false); } } auto trip_count_const = - std::make_shared(ngraph::element::i64, ov::Shape{1}, trip_count); + std::make_shared(ov::element::i64, ov::Shape{1}, trip_count); std::shared_ptr exec_condition; if (execute_first_iteration) { exec_condition = std::make_shared( - ngraph::element::boolean, ov::Shape{1}, true); + ov::element::boolean, ov::Shape{1}, true); } else { exec_condition = std::make_shared( - ngraph::element::boolean, ov::Shape{1}, false); + ov::element::boolean, ov::Shape{1}, false); } // Body @@ -213,8 +213,8 @@ namespace LayerTestsDefinitions { }; auto start = cond_input_create(prc, ngShape); - auto count = cond_input_create(ngraph::element::i64, scalarShape, max_iter_num, static_iter_num); - auto skip = cond_input_create(ngraph::element::boolean, scalarShape, true, static_continue_cond); + auto count = cond_input_create(ov::element::i64, scalarShape, max_iter_num, static_iter_num); + auto skip = cond_input_create(ov::element::boolean, scalarShape, true, static_continue_cond); // // count skip start count skip start @@ -230,16 +230,16 @@ namespace LayerTestsDefinitions { // Full loop Dynamic exit loop // n_iter = count n_iter = ex_val // - auto b_indx = std::make_shared(ngraph::element::i64, ov::Shape{}); + auto b_indx = std::make_shared(ov::element::i64, ov::Shape{}); auto b_data = std::make_shared(prc, ngShape); auto b_indx_cast = std::make_shared(b_indx, prc); auto b_add = std::make_shared(b_data, b_indx_cast); std::shared_ptr b_cond; if (dynamic_exit == -1) { - b_cond = std::make_shared(ngraph::element::boolean, ov::Shape{}, true); + b_cond = std::make_shared(ov::element::boolean, ov::Shape{}, true); } else { - auto b_exit_value = std::make_shared(ngraph::element::i64, scalarShape, dynamic_exit); + auto b_exit_value = std::make_shared(ov::element::i64, scalarShape, dynamic_exit); b_cond = std::make_shared(b_indx, b_exit_value); } @@ -332,14 +332,14 @@ namespace LayerTestsDefinitions { auto to_slice = std::make_shared(prc, to_slice_shape); auto start = std::make_shared(prc, shape, 0); - auto count = std::make_shared(ngraph::element::i64, scalarShape, num_iteration); - auto icond = std::make_shared(ngraph::element::boolean, scalarShape, true); + auto count = std::make_shared(ov::element::i64, scalarShape, num_iteration); + auto icond = std::make_shared(ov::element::boolean, scalarShape, true); // Loop body auto b_data = std::make_shared(prc, shape); auto b_recu = std::make_shared(prc, shape); auto b_add = std::make_shared(b_data, b_recu); - auto b_cond = std::make_shared(ngraph::element::boolean, scalarShape, true); + auto b_cond = std::make_shared(ov::element::boolean, scalarShape, true); auto body = std::make_shared( ov::OutputVector {b_cond, b_add}, @@ -368,16 +368,16 @@ namespace LayerTestsDefinitions { auto to_slice = std::make_shared(prc, to_slice_shape); auto start = std::make_shared(prc, shape, 0); - auto exit_on = std::make_shared(ngraph::element::i64, scalarShape, num_iteration); - auto count = std::make_shared(ngraph::element::i64, scalarShape, trip_count); - auto icond = std::make_shared(ngraph::element::boolean, scalarShape, true); + auto exit_on = std::make_shared(ov::element::i64, scalarShape, num_iteration); + auto count = std::make_shared(ov::element::i64, scalarShape, trip_count); + auto icond = std::make_shared(ov::element::boolean, scalarShape, true); // Loop body auto b_data = std::make_shared(prc, shape); auto b_recu = std::make_shared(prc, shape); auto b_add = std::make_shared(b_data, b_recu); - auto b_iter = std::make_shared(ngraph::element::i64, scalarShape); - auto b_exit_on = std::make_shared(ngraph::element::i64, scalarShape); + auto b_iter = std::make_shared(ov::element::i64, scalarShape); + auto b_exit_on = std::make_shared(ov::element::i64, scalarShape); auto b_cond = std::make_shared(b_iter, b_exit_on); auto body = std::make_shared( diff --git a/src/tests/functional/shared_test_classes/src/single_layer/lrn.cpp b/src/tests/functional/shared_test_classes/src/single_layer/lrn.cpp index 4e107860ed6..f11ab7c420e 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/lrn.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/lrn.cpp @@ -43,7 +43,7 @@ void LrnLayerTest::SetUp() { auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); ov::ParameterVector params {std::make_shared(ngPrc, ov::Shape(inputShapes))}; - auto axes_node = std::make_shared(ngraph::element::i64, ov::Shape{axes.size()}, axes.data()); + auto axes_node = std::make_shared(ov::element::i64, ov::Shape{axes.size()}, axes.data()); auto lrn = std::make_shared(params[0], axes_node, alpha, beta, bias, size); ov::ResultVector results {std::make_shared(lrn)}; function = std::make_shared(results, params, "lrn"); diff --git a/src/tests/functional/shared_test_classes/src/single_layer/memory.cpp b/src/tests/functional/shared_test_classes/src/single_layer/memory.cpp index d96ea873a40..54ada7058d8 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/memory.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/memory.cpp @@ -110,12 +110,12 @@ void MemoryTest::Infer() { inferRequest.Infer(); } -std::vector>> MemoryTest::CalculateRefs() { +std::vector>> MemoryTest::CalculateRefs() { using namespace ngraph; function->validate_nodes_and_infer_types(); auto referenceInputs = std::vector>(inputs.size()); - auto refInputsTypes = std::vector(inputs.size()); + auto refInputsTypes = std::vector(inputs.size()); ov::TensorVector inputTensors; for (auto& input : inputs) { const auto& dataSize = input->byteSize(); @@ -140,7 +140,7 @@ std::vector>> MemoryTest::Cal ov::TensorVector outputTensors(outInfo.size()); function->evaluate(outputTensors, inputTensors, eval_context); - std::vector>> outputs(outInfo.size()); + std::vector>> outputs(outInfo.size()); for (size_t idx = 0; idx < outInfo.size(); ++idx) { outputs[idx].first = outputTensors[idx].get_element_type(); outputs[idx].second.resize(outputTensors[idx].get_byte_size()); diff --git a/src/tests/functional/shared_test_classes/src/single_layer/non_max_suppression.cpp b/src/tests/functional/shared_test_classes/src/single_layer/non_max_suppression.cpp index 61b225e4d84..c9bafbd21d1 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/non_max_suppression.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/non_max_suppression.cpp @@ -19,7 +19,7 @@ std::string NmsLayerTest::getTestCaseName(const testing::TestParamInfo(expectedBuffer), - reinterpret_cast(actualBuffer), size, - ngraph::float16(threshold), outputIndex); + Compare(reinterpret_cast(expectedBuffer), + reinterpret_cast(actualBuffer), + size, + ov::float16(threshold), + outputIndex); break; case InferenceEngine::Precision::FP32: Compare(reinterpret_cast(expectedBuffer), diff --git a/src/tests/functional/shared_test_classes/src/single_layer/random_uniform.cpp b/src/tests/functional/shared_test_classes/src/single_layer/random_uniform.cpp index 27026e7b02d..c965dd69515 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/random_uniform.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/random_uniform.cpp @@ -84,8 +84,7 @@ void RandomUniformLayerTest::SetUp() { void RandomUniformLayerTest::ConvertRefsParams() { // we shouldn't use default conversion from f16 to f32 - ngraph::pass::ConvertPrecision().run_on_model( - functionRefs); + ngraph::pass::ConvertPrecision().run_on_model(functionRefs); } } // namespace LayerTestsDefinitions diff --git a/src/tests/functional/shared_test_classes/src/single_layer/reorg_yolo.cpp b/src/tests/functional/shared_test_classes/src/single_layer/reorg_yolo.cpp index c32176746e8..3801a534e2e 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/reorg_yolo.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/reorg_yolo.cpp @@ -25,7 +25,7 @@ void ReorgYoloLayerTest::SetUp() { size_t stride; InferenceEngine::Precision netPrecision; std::tie(inputShape, stride, netPrecision, targetDevice) = this->GetParam(); - auto param = std::make_shared(ngraph::element::f32, inputShape); + auto param = std::make_shared(ov::element::f32, inputShape); auto reorg_yolo = std::make_shared(param, stride); function = std::make_shared(std::make_shared(reorg_yolo), ov::ParameterVector{param}, "ReorgYolo"); } diff --git a/src/tests/functional/shared_test_classes/src/single_layer/roi_align.cpp b/src/tests/functional/shared_test_classes/src/single_layer/roi_align.cpp index 1bd8f4dd296..40af92f261c 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/roi_align.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/roi_align.cpp @@ -102,7 +102,7 @@ void ROIAlignLayerTest::SetUp() { ov::Shape idxShape = {coordsShape[0]}; auto coords = std::make_shared(ngPrc, coordsShape, proposalVector.data()); - auto roisIdx = std::make_shared(ngraph::element::i32, idxShape, roiIdxVector.data()); + auto roisIdx = std::make_shared(ov::element::i32, idxShape, roiIdxVector.data()); std::shared_ptr roiAlign = std::make_shared(params[0], coords, @@ -187,7 +187,7 @@ void ROIAlignV9LayerTest::SetUp() { ov::Shape idxShape = {coordsShape[0]}; auto coords = std::make_shared(ngPrc, coordsShape, proposalVector.data()); - auto roisIdx = std::make_shared(ngraph::element::i32, idxShape, roiIdxVector.data()); + auto roisIdx = std::make_shared(ov::element::i32, idxShape, roiIdxVector.data()); std::shared_ptr roiAlign = std::make_shared( params[0], diff --git a/src/tests/functional/shared_test_classes/src/single_layer/squeeze_unsqueeze.cpp b/src/tests/functional/shared_test_classes/src/single_layer/squeeze_unsqueeze.cpp index be280f6c6a3..d7e8ebee7bb 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/squeeze_unsqueeze.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/squeeze_unsqueeze.cpp @@ -45,7 +45,7 @@ void SqueezeUnsqueezeLayerTest::SetUp() { op = std::make_shared(params.front()); } else { OPENVINO_SUPPRESS_DEPRECATED_START - op = ngraph::builder::makeSqueezeUnsqueeze(params.front(), ngraph::element::i64, axesVector, opType); + op = ngraph::builder::makeSqueezeUnsqueeze(params.front(), ov::element::i64, axesVector, opType); OPENVINO_SUPPRESS_DEPRECATED_END } diff --git a/src/tests/functional/shared_test_classes/src/single_layer/tensor_iterator.cpp b/src/tests/functional/shared_test_classes/src/single_layer/tensor_iterator.cpp index e52e6777bc7..7a9a0cc34c9 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/tensor_iterator.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/tensor_iterator.cpp @@ -79,7 +79,7 @@ namespace LayerTestsDefinitions { // 1. Create TensorIterator body. // 2. Set PortMap // 3. Create outer function - auto axis = std::make_shared(ngraph::element::i64, ov::Shape{1}, + auto axis = std::make_shared(ov::element::i64, ov::Shape{1}, std::vector{static_cast(sequence_axis)}); switch (ti_body) { case ngraph::helpers::TensorIteratorBody::LSTM: { diff --git a/src/tests/functional/shared_test_classes/src/single_layer/topk.cpp b/src/tests/functional/shared_test_classes/src/single_layer/topk.cpp index b5a1eb8e555..0cac7708c68 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/topk.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/topk.cpp @@ -78,9 +78,9 @@ InferenceEngine::Blob::Ptr TopKLayerTest::GenerateInput(const InferenceEngine::I rawBlobDataPtr[i] = static_cast(data[i] / divisor); } } else if (InferenceEngine::Precision::FP16 == info.getTensorDesc().getPrecision()) { - auto *rawBlobDataPtr = blob->buffer().as(); + auto* rawBlobDataPtr = blob->buffer().as(); for (size_t i = 0; i < size; i++) { - rawBlobDataPtr[i] = static_cast(data[i] / divisor); + rawBlobDataPtr[i] = static_cast(data[i] / divisor); } } diff --git a/src/tests/functional/shared_test_classes/src/single_layer/transpose.cpp b/src/tests/functional/shared_test_classes/src/single_layer/transpose.cpp index ab108f7be4d..47347234e8c 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/transpose.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/transpose.cpp @@ -34,7 +34,7 @@ void TransposeLayerTest::SetUp() { ov::ParameterVector params{std::make_shared(ngPrc, ov::Shape(inputShape))}; const auto inOrderShape = inputOrder.empty() ? ov::Shape({0}) : ov::Shape({inputShape.size()}); - const auto inputOrderOp = std::make_shared(ngraph::element::i64, + const auto inputOrderOp = std::make_shared(ov::element::i64, inOrderShape, inputOrder); const auto transpose = std::make_shared(params.at(0), inputOrderOp); diff --git a/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/assign_and_read_value.hpp b/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/assign_and_read_value.hpp index 1bbc5acffe6..42bf8fea902 100644 --- a/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/assign_and_read_value.hpp +++ b/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/assign_and_read_value.hpp @@ -17,7 +17,7 @@ class AssignAndReadValueFunction { public: static std::shared_ptr getOriginal( const ov::PartialShape& inputShape, - const element::Type& inputPrecision, + const ov::element::Type& inputPrecision, const ov::element::Type precisionBeforeDequantization, const size_t opsetVersion, const bool FQAfterReadValue, @@ -32,7 +32,7 @@ public: static std::shared_ptr getReference( const ov::PartialShape& inputShape, - const element::Type& inputPrecision, + const ov::element::Type& inputPrecision, const ov::element::Type precisionBeforeDequantization, const size_t opsetVersion, const bool FQAfterReadValue, diff --git a/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/common/builders.hpp b/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/common/builders.hpp index 319d9752569..43cbd4591f6 100644 --- a/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/common/builders.hpp +++ b/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/common/builders.hpp @@ -44,13 +44,15 @@ std::shared_ptr makeElementwise(const std::shared_ptr data, cons description.values); std::shared_ptr operation; - if ((description.outPrecision == element::undefined) || (description.outPrecision == data->get_output_element_type(0))) { + if ((description.outPrecision == ov::element::undefined) || + (description.outPrecision == data->get_output_element_type(0))) { operation = std::make_shared(data, operationConst); } else { operation = std::make_shared>( - std::vector{element::f32, element::f32}, std::vector{}, - ov::op::TemporaryReplaceOutputType(data, element::f32).get(), - ov::op::TemporaryReplaceOutputType(operationConst, element::f32).get()); + std::vector{ov::element::f32, ov::element::f32}, + std::vector{}, + ov::op::TemporaryReplaceOutputType(data, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(operationConst, ov::element::f32).get()); ov::pass::low_precision::NetworkHelper::setOutDataPrecision(operation, description.outPrecision); } @@ -98,11 +100,10 @@ std::shared_ptr makeFakeQuantizeTypeRelaxed( void addAttributes(std::vector> nodes, std::vector attributes); -std::shared_ptr makeConvolution( - const std::shared_ptr& parent, - const element::Type precision, - const bool weightsWithoutFQ, - const element::Type weightsprecision = element::i8); +std::shared_ptr makeConvolution(const std::shared_ptr& parent, + const ov::element::Type precision, + const bool weightsWithoutFQ, + const ov::element::Type weightsprecision = ov::element::i8); } // namespace subgraph } // namespace builder diff --git a/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/convolution_backprop_data.hpp b/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/convolution_backprop_data.hpp index 2f7f6056e5c..3627b9ef37e 100644 --- a/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/convolution_backprop_data.hpp +++ b/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/convolution_backprop_data.hpp @@ -17,36 +17,36 @@ class ConvolutionBackpropDataFunction { public: static std::shared_ptr getWeights( const Shape& shape, - const element::Type& netPrecision, + const ov::element::Type& netPrecision, const builder::subgraph::DequantizationOperations& dequantizationOnWeights, const std::shared_ptr& value = nullptr); static std::shared_ptr getWeights( const Shape& shape, - const element::Type& netPrecision, + const ov::element::Type& netPrecision, const builder::subgraph::FakeQuantizeOnWeights& fqOnWeights, const std::shared_ptr& value = nullptr); static std::shared_ptr getWeights( const Shape& shape, - const element::Type& netPrecision, + const ov::element::Type& netPrecision, const builder::subgraph::FakeQuantizeOnWeights& fqOnWeights, const builder::subgraph::DequantizationOperations& dequantizationOnWeights, const std::shared_ptr& value = nullptr); static std::shared_ptr get( - const element::Type netPrecision, + const ov::element::Type netPrecision, const PartialShape& inputShape, const Shape& outputShape, const builder::subgraph::FakeQuantizeOnData& fqOnData, const std::shared_ptr& weights); static std::shared_ptr getOriginal( - const element::Type precision, - const element::Type netPrecision, + const ov::element::Type precision, + const ov::element::Type netPrecision, const PartialShape& inputShape, const Shape& outputShape, const builder::subgraph::DequantizationOperations& dequantization, const std::shared_ptr& weights); static std::shared_ptr getReference( - const element::Type precision, - const element::Type netPrecision, + const ov::element::Type precision, + const ov::element::Type netPrecision, const PartialShape& inputShape, const Shape& outputShape, const builder::subgraph::DequantizationOperations& dequantization, diff --git a/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/multiply.hpp b/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/multiply.hpp index 7522ec57bcd..52d23bcef7f 100644 --- a/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/multiply.hpp +++ b/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/multiply.hpp @@ -48,7 +48,7 @@ public: class MultiplyFunction : public ElementwiseFunction { public: - static std::shared_ptr get(const element::Type model_precision, const MultiplyValues& actualValues); + static std::shared_ptr get(const ov::element::Type model_precision, const MultiplyValues& actualValues); }; } // namespace subgraph diff --git a/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/multiply_partial_function.hpp b/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/multiply_partial_function.hpp index cd727346267..bbe21215546 100644 --- a/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/multiply_partial_function.hpp +++ b/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/multiply_partial_function.hpp @@ -39,9 +39,7 @@ inline std::ostream& operator<<(std::ostream& out, const MultiplyPartialValues& class MultiplyPartialFunction : public ElementwiseFunction { public: - static std::shared_ptr get( - const element::Type precision, - const MultiplyPartialValues& actualValues); + static std::shared_ptr get(const ov::element::Type precision, const MultiplyPartialValues& actualValues); static std::shared_ptr get( const ov::element::Type precision, diff --git a/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/pad.hpp b/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/pad.hpp index 9e35a2d9acb..d8159db593f 100644 --- a/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/pad.hpp +++ b/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/pad.hpp @@ -15,25 +15,23 @@ namespace subgraph { class PadFunction { public: -static std::shared_ptr get( - const PartialShape& inputShape, - const element::Type precisionBeforeDequantization, - const builder::subgraph::DequantizationOperations& dequantizationBefore, - const std::vector& padsBegin, - const std::vector& padsEnd, - const op::PadMode mode, - const float padValue, - const element::Type precisionAfterOperation, - const builder::subgraph::DequantizationOperations& dequantizationAfter); + static std::shared_ptr get(const PartialShape& inputShape, + const ov::element::Type precisionBeforeDequantization, + const builder::subgraph::DequantizationOperations& dequantizationBefore, + const std::vector& padsBegin, + const std::vector& padsEnd, + const op::PadMode mode, + const float padValue, + const ov::element::Type precisionAfterOperation, + const builder::subgraph::DequantizationOperations& dequantizationAfter); -static std::shared_ptr get( - const PartialShape& inputShape, - const element::Type inputPrecision, - const builder::subgraph::FakeQuantizeOnData& fakeQuantizeOnData, - const std::vector& padsBegin, - const std::vector& padsEnd, - const op::PadMode mode, - const float padValue = 0.f); + static std::shared_ptr get(const PartialShape& inputShape, + const ov::element::Type inputPrecision, + const builder::subgraph::FakeQuantizeOnData& fakeQuantizeOnData, + const std::vector& padsBegin, + const std::vector& padsEnd, + const op::PadMode mode, + const float padValue = 0.f); }; } // namespace subgraph } // namespace builder diff --git a/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/reduce.hpp b/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/reduce.hpp index 47352e0fbcd..f12557f3e6d 100644 --- a/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/reduce.hpp +++ b/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/reduce.hpp @@ -34,8 +34,8 @@ public: const auto reducePrecision = dequantization->get_output_element_type(0); const std::shared_ptr reduce = std::make_shared>( - std::vector{ reducePrecision, constant->get_element_type() }, - std::vector{ reducePrecision }, + std::vector{reducePrecision, constant->get_element_type()}, + std::vector{reducePrecision}, ov::op::TemporaryReplaceOutputType(dequantization, reducePrecision).get(), ov::op::TemporaryReplaceOutputType(constant, constant->get_element_type()).get(), keepDims); @@ -114,8 +114,8 @@ public: constantValues); const std::shared_ptr reduce = std::make_shared>( - std::vector{ precisionAfterOperation, constant->get_element_type() }, - std::vector{ precisionAfterOperation }, + std::vector{precisionAfterOperation, constant->get_element_type()}, + std::vector{precisionAfterOperation}, ov::op::TemporaryReplaceOutputType(dequantization, precisionAfterOperation).get(), ov::op::TemporaryReplaceOutputType(constant, constant->get_element_type()).get(), keepDims); diff --git a/src/tests/ov_helpers/ov_lpt_models/src/add.cpp b/src/tests/ov_helpers/ov_lpt_models/src/add.cpp index f48cfd7e3b5..c68e6096154 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/add.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/add.cpp @@ -96,44 +96,53 @@ std::shared_ptr AddFunction::getOriginal( auto parent = input2; if (additionalLayer == "convolution") { parent = std::make_shared>( - std::vector{ element::f32, element::f32 }, - std::vector{ precision }, - ov::op::TemporaryReplaceOutputType(parent, element::f32).get(), + std::vector{ov::element::f32, ov::element::f32}, + std::vector{precision}, + ov::op::TemporaryReplaceOutputType(parent, ov::element::f32).get(), ov::op::TemporaryReplaceOutputType( - std::make_shared(element::i8, Shape{ 1, 4, 1, 1 }, std::vector{0.8f, 0.8f, 0.8f, 0.8f}), - element::f32).get(), - ov::Strides{ 1, 1 }, - ov::CoordinateDiff{ 0, 0 }, - ov::CoordinateDiff{ 0, 0 }, - ov::Strides{ 1, 1 }); + std::make_shared(ov::element::i8, + Shape{1, 4, 1, 1}, + std::vector{0.8f, 0.8f, 0.8f, 0.8f}), + ov::element::f32) + .get(), + ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, + ov::CoordinateDiff{0, 0}, + ov::Strides{1, 1}); } std::shared_ptr additional_output = nullptr; if (additionalLayer == "convolution_multiconsumers") { parent = std::make_shared>( - std::vector{ element::f32, element::f32 }, - std::vector{ precision }, - ov::op::TemporaryReplaceOutputType(parent, element::f32).get(), - ov::op::TemporaryReplaceOutputType( - std::make_shared(element::i8, Shape{ 1, 4, 1, 1 }, std::vector{0.8f, 0.8f, 0.8f, 0.8f}), - element::f32).get(), - ov::Strides{ 1, 1 }, - ov::CoordinateDiff{ 0, 0 }, - ov::CoordinateDiff{ 0, 0 }, - ov::Strides{ 1, 1 }); + std::vector{ov::element::f32, ov::element::f32}, + std::vector{precision}, + ov::op::TemporaryReplaceOutputType(parent, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType( + std::make_shared(ov::element::i8, + Shape{1, 4, 1, 1}, + std::vector{0.8f, 0.8f, 0.8f, 0.8f}), + ov::element::f32) + .get(), + ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, + ov::CoordinateDiff{0, 0}, + ov::Strides{1, 1}); additional_output = parent; } if (additionalLayer == "group_convolution") { - parent = std::make_shared< ov::op::TypeRelaxed>( - std::vector{ element::f32, element::f32 }, - std::vector{ precision }, - ov::op::TemporaryReplaceOutputType(parent, element::f32).get(), + parent = std::make_shared>( + std::vector{ov::element::f32, ov::element::f32}, + std::vector{precision}, + ov::op::TemporaryReplaceOutputType(parent, ov::element::f32).get(), ov::op::TemporaryReplaceOutputType( - std::make_shared(element::i8, Shape{ 4, 1, 1, 1, 1 }, std::vector{0.8f, 0.8f, 0.8f, 0.8f}), - element::f32).get(), - ov::Strides{ 1, 1 }, - ov::CoordinateDiff{ 0, 0 }, - ov::CoordinateDiff{ 0, 0 }, - ov::Strides{ 1, 1 }); + std::make_shared(ov::element::i8, + Shape{4, 1, 1, 1, 1}, + std::vector{0.8f, 0.8f, 0.8f, 0.8f}), + ov::element::f32) + .get(), + ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, + ov::CoordinateDiff{0, 0}, + ov::Strides{1, 1}); } if (additionalLayer != "") { parent = configure_postops(parent, precision, postops_configuration); @@ -225,10 +234,9 @@ std::shared_ptr AddFunction::getReference( std::shared_ptr input1; std::shared_ptr parent1; if (constInputIndex == 0) { - parent1 = std::make_shared( - dequantizationAfter.empty() ? precision : element::f32, - inputShape1.to_shape(), - constValues); + parent1 = std::make_shared(dequantizationAfter.empty() ? precision : ov::element::f32, + inputShape1.to_shape(), + constValues); } else { input1 = std::make_shared( additionalLayer != "" ? precision : (precision1.is_real() ? precision : precision1), @@ -244,15 +252,14 @@ std::shared_ptr AddFunction::getReference( } auto dequantizationStructure1 = dequantization1; - dequantizationStructure1.multiply.outPrecision = dequantizationAfter.empty() ? precision : element::f32; + dequantizationStructure1.multiply.outPrecision = dequantizationAfter.empty() ? precision : ov::element::f32; const auto dequantizationOp1 = ov::is_type(parent1) ? parent1 : makeDequantization(parent1, dequantizationStructure1); std::shared_ptr input2; if (constInputIndex == 1) { - input2 = std::make_shared( - dequantizationAfter.empty() ? precision : element::f32, - inputShape2.to_shape(), - constValues); + input2 = std::make_shared(dequantizationAfter.empty() ? precision : ov::element::f32, + inputShape2.to_shape(), + constValues); } else { input2 = std::make_shared( precision2.is_real() ? precision : precision2, inputShape2); @@ -260,66 +267,75 @@ std::shared_ptr AddFunction::getReference( auto parent = input2; if (additionalLayer == "convolution") { parent = std::make_shared>( - std::vector{ element::f32, element::f32 }, - std::vector{ precision }, - ov::op::TemporaryReplaceOutputType(parent, element::f32).get(), + std::vector{ov::element::f32, ov::element::f32}, + std::vector{precision}, + ov::op::TemporaryReplaceOutputType(parent, ov::element::f32).get(), ov::op::TemporaryReplaceOutputType( - std::make_shared(element::i8, Shape{ 1, 4, 1, 1 }, std::vector{0.8f, 0.8f, 0.8f, 0.8f}), - element::f32).get(), - ov::Strides{ 1, 1 }, - ov::CoordinateDiff{ 0, 0 }, - ov::CoordinateDiff{ 0, 0 }, - ov::Strides{ 1, 1 }); + std::make_shared(ov::element::i8, + Shape{1, 4, 1, 1}, + std::vector{0.8f, 0.8f, 0.8f, 0.8f}), + ov::element::f32) + .get(), + ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, + ov::CoordinateDiff{0, 0}, + ov::Strides{1, 1}); } std::shared_ptr additional_output = nullptr; if (additionalLayer == "convolution_multiconsumers") { parent = std::make_shared>( - std::vector{ element::f32, element::f32 }, - std::vector{ precision }, - ov::op::TemporaryReplaceOutputType(parent, element::f32).get(), - ov::op::TemporaryReplaceOutputType( - std::make_shared(element::i8, Shape{ 1, 4, 1, 1 }, std::vector{0.8f, 0.8f, 0.8f, 0.8f}), - element::f32).get(), - ov::Strides{ 1, 1 }, - ov::CoordinateDiff{ 0, 0 }, - ov::CoordinateDiff{ 0, 0 }, - ov::Strides{ 1, 1 }); + std::vector{ov::element::f32, ov::element::f32}, + std::vector{precision}, + ov::op::TemporaryReplaceOutputType(parent, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType( + std::make_shared(ov::element::i8, + Shape{1, 4, 1, 1}, + std::vector{0.8f, 0.8f, 0.8f, 0.8f}), + ov::element::f32) + .get(), + ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, + ov::CoordinateDiff{0, 0}, + ov::Strides{1, 1}); additional_output = parent; } if (additionalLayer == "group_convolution") { - parent = std::make_shared< ov::op::TypeRelaxed>( - std::vector{ element::f32, element::f32 }, - std::vector{ precision }, - ov::op::TemporaryReplaceOutputType(parent, element::f32).get(), + parent = std::make_shared>( + std::vector{ov::element::f32, ov::element::f32}, + std::vector{precision}, + ov::op::TemporaryReplaceOutputType(parent, ov::element::f32).get(), ov::op::TemporaryReplaceOutputType( - std::make_shared(element::i8, Shape{ 4, 1, 1, 1, 1 }, std::vector{0.8f, 0.8f, 0.8f, 0.8f}), - element::f32).get(), - ov::Strides{ 1, 1 }, - ov::CoordinateDiff{ 0, 0 }, - ov::CoordinateDiff{ 0, 0 }, - ov::Strides{ 1, 1 }); + std::make_shared(ov::element::i8, + Shape{4, 1, 1, 1, 1}, + std::vector{0.8f, 0.8f, 0.8f, 0.8f}), + ov::element::f32) + .get(), + ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, + ov::CoordinateDiff{0, 0}, + ov::Strides{1, 1}); } if (additionalLayer != "") { parent = configure_postops(parent, precision, postops_configuration); } auto dequantizationStructure2 = dequantization2; - dequantizationStructure2.multiply.outPrecision = dequantizationAfter.empty() ? precision : element::f32; + dequantizationStructure2.multiply.outPrecision = dequantizationAfter.empty() ? precision : ov::element::f32; const auto dequantizationOp2 = ov::is_type(parent) ? parent : makeDequantization(parent, dequantizationStructure2); - const std::shared_ptr add = operationType == "Add" ? - std::dynamic_pointer_cast(std::make_shared>( - std::vector{ element::f32, element::f32 }, - std::vector{ element::f32 }, - ov::op::TemporaryReplaceOutputType(dequantizationOp1, element::f32).get(), - ov::op::TemporaryReplaceOutputType(dequantizationOp2, element::f32).get())) : - std::make_shared>( - std::vector{ element::f32, element::f32 }, - std::vector{ element::f32 }, - ov::op::TemporaryReplaceOutputType(dequantizationOp1, element::f32).get(), - ov::op::TemporaryReplaceOutputType(dequantizationOp2, element::f32).get()); + const std::shared_ptr add = + operationType == "Add" ? std::dynamic_pointer_cast(std::make_shared>( + std::vector{ov::element::f32, ov::element::f32}, + std::vector{ov::element::f32}, + ov::op::TemporaryReplaceOutputType(dequantizationOp1, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(dequantizationOp2, ov::element::f32).get())) + : std::make_shared>( + std::vector{ov::element::f32, ov::element::f32}, + std::vector{ov::element::f32}, + ov::op::TemporaryReplaceOutputType(dequantizationOp1, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(dequantizationOp2, ov::element::f32).get()); - NetworkHelper::setOutDataPrecisionForTypeRelaxed(add, dequantizationAfter.empty() ? precision : element::f32); + NetworkHelper::setOutDataPrecisionForTypeRelaxed(add, dequantizationAfter.empty() ? precision : ov::element::f32); auto& rtInfo = add->get_rt_info(); rtInfo["Variant::std::string"] = "add"; diff --git a/src/tests/ov_helpers/ov_lpt_models/src/align_concat_quantization_parameters.cpp b/src/tests/ov_helpers/ov_lpt_models/src/align_concat_quantization_parameters.cpp index b30234beda1..f2775cd36de 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/align_concat_quantization_parameters.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/align_concat_quantization_parameters.cpp @@ -95,7 +95,9 @@ std::shared_ptr AlignConcatQuantizationParametersFunction::getOrigina const size_t inputChannels = 6ul; const auto shape = Shape{ outputChannels, inputChannels, 1, 1 }; const auto fakeQuantizeOnWeights = ov::test::utils::make_fake_quantize( - std::make_shared(element::f32, shape, std::vector(1.f, ov::shape_size(shape))), + std::make_shared(ov::element::f32, + shape, + std::vector(1.f, ov::shape_size(shape))), precision, 255, {outputChannels, 1, 1, 1}, @@ -135,8 +137,8 @@ std::shared_ptr AlignConcatQuantizationParametersFunction::getReferen std::shared_ptr parent1 = input1; { FakeQuantizeOnData onData = { 256, {}, { -1.28f }, { 1.27f }, { 0.f }, { 255.f }, ov::element::u8}; - parent1 = makeFakeQuantizeTypeRelaxed(input1, element::f32, onData); - ov::pass::low_precision::NetworkHelper::setOutDataPrecisionForTypeRelaxed(parent1, element::u8); + parent1 = makeFakeQuantizeTypeRelaxed(input1, ov::element::f32, onData); + ov::pass::low_precision::NetworkHelper::setOutDataPrecisionForTypeRelaxed(parent1, ov::element::u8); parent1->set_friendly_name("fakeQuantizeOnActivations1"); parent1 = std::make_shared( @@ -169,9 +171,9 @@ std::shared_ptr AlignConcatQuantizationParametersFunction::getReferen const auto input2 = std::make_shared(inputPrecision, ov::Shape(inputShape)); std::shared_ptr parent2 = input2; { - FakeQuantizeOnData onData = { 256, {}, { -0.64f }, { 0.635f }, { 64.f }, { 192.f }, element::u8}; - parent2 = makeFakeQuantizeTypeRelaxed(input2, element::f32, onData); - ov::pass::low_precision::NetworkHelper::setOutDataPrecisionForTypeRelaxed(parent2, element::u8); + FakeQuantizeOnData onData = {256, {}, {-0.64f}, {0.635f}, {64.f}, {192.f}, ov::element::u8}; + parent2 = makeFakeQuantizeTypeRelaxed(input2, ov::element::f32, onData); + ov::pass::low_precision::NetworkHelper::setOutDataPrecisionForTypeRelaxed(parent2, ov::element::u8); parent2->set_friendly_name("fakeQuantizeOnActivations2"); parent2 = std::make_shared( @@ -211,10 +213,10 @@ std::shared_ptr AlignConcatQuantizationParametersFunction::getReferen const size_t outputChannels = 9ul; const size_t inputChannels = 6ul; const auto shape = Shape{ outputChannels, inputChannels, 1, 1 }; - const auto onWeights = std::make_shared( - element::i8, - shape, - std::vector(outputChannels * inputChannels, 127)); + const auto onWeights = + std::make_shared(ov::element::i8, + shape, + std::vector(outputChannels * inputChannels, 127)); parent = std::make_shared( ov::op::TemporaryReplaceOutputType(parent, precision).get(), diff --git a/src/tests/ov_helpers/ov_lpt_models/src/assign_and_read_value.cpp b/src/tests/ov_helpers/ov_lpt_models/src/assign_and_read_value.cpp index 0311f03cc65..4cb6ee3d4ee 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/assign_and_read_value.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/assign_and_read_value.cpp @@ -45,16 +45,15 @@ std::shared_ptr AssignAndReadValueFunction::getOriginal( } std::shared_ptr lastNode = readValue; if (FQAfterReadValue) { - lastNode = builder::subgraph::makeFakeQuantize( - lastNode, - element::f32, - FakeQuantizeOnData{256ul, Shape{}, {0}, {2.55f}, {0}, {2.55f}}); + lastNode = builder::subgraph::makeFakeQuantize(lastNode, + ov::element::f32, + FakeQuantizeOnData{256ul, Shape{}, {0}, {2.55f}, {0}, {2.55f}}); } const auto add = std::make_shared(lastNode, input); const auto FQAfterAdd = builder::subgraph::makeFakeQuantizeTypeRelaxed( - add, - element::f32, - FakeQuantizeOnData{256ul, Shape{}, {0}, {2.55f}, {0}, {2.55f}, precisionBeforeDequantization}); + add, + ov::element::f32, + FakeQuantizeOnData{256ul, Shape{}, {0}, {2.55f}, {0}, {2.55f}, precisionBeforeDequantization}); auto deqStructure = dequantization; deqStructure.multiply.outPrecision = inputPrecision; const auto dequantizationOp = makeDequantization(FQAfterAdd, deqStructure); @@ -89,10 +88,9 @@ std::shared_ptr AssignAndReadValueFunction::getOriginal( throw std::runtime_error("Unknown opset version"); } std::shared_ptr lastNode = readValue; - lastNode = builder::subgraph::makeFakeQuantize( - lastNode, - element::f32, - FakeQuantizeOnData{256ul, Shape{}, {0}, {2.55f}, {0}, {2.55f}}); + lastNode = builder::subgraph::makeFakeQuantize(lastNode, + ov::element::f32, + FakeQuantizeOnData{256ul, Shape{}, {0}, {2.55f}, {0}, {2.55f}}); const auto add = std::make_shared(lastNode, input); const auto FQAfterAdd = fakeQuantize.empty() ? nullptr : ov::test::utils::make_fake_quantize( @@ -120,7 +118,7 @@ std::shared_ptr AssignAndReadValueFunction::getOriginal( std::shared_ptr AssignAndReadValueFunction::getReference( const ov::PartialShape& inputShape, - const element::Type& inputPrecision, + const ov::element::Type& inputPrecision, const ov::element::Type precisionBeforeDequantization, const size_t opsetVersion, const bool FQAfterReadValue, @@ -157,15 +155,21 @@ std::shared_ptr AssignAndReadValueFunction::getReference( if (FQAfterReadValue) { lastNode = builder::subgraph::makeFakeQuantizeTypeRelaxed( - lastNode, - element::f32, - FakeQuantizeOnData{256ul, Shape{}, {0}, {2.55f / dequantizationAfter.multiply.values[0]}, {0}, {2.55f}, inputPrecision}); + lastNode, + ov::element::f32, + FakeQuantizeOnData{256ul, + Shape{}, + {0}, + {2.55f / dequantizationAfter.multiply.values[0]}, + {0}, + {2.55f}, + inputPrecision}); } const auto add = std::make_shared(lastNode, input); const auto FQAfterAdd = builder::subgraph::makeFakeQuantizeTypeRelaxed( - add, - element::f32, - FakeQuantizeOnData{256ul, Shape{}, {0}, {2.55f}, {0}, {2.55f}, precisionBeforeDequantization}); + add, + ov::element::f32, + FakeQuantizeOnData{256ul, Shape{}, {0}, {2.55f}, {0}, {2.55f}, precisionBeforeDequantization}); auto deqStructureBefore = dequantizationBefore; deqStructureBefore.multiply.outPrecision = inputPrecision; diff --git a/src/tests/ov_helpers/ov_lpt_models/src/avg_pool.cpp b/src/tests/ov_helpers/ov_lpt_models/src/avg_pool.cpp index ccfddb4d836..0f181149260 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/avg_pool.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/avg_pool.cpp @@ -53,7 +53,7 @@ std::shared_ptr AvgPoolFunction::getOriginal( } else if (additionalLayer == "convolution") { lastLayer = makeConvolution(lastLayer, precision, false); } else if (additionalLayer == "unsupported_convolution") { - lastLayer = makeConvolution(lastLayer, precision, true, element::f32); + lastLayer = makeConvolution(lastLayer, precision, true, ov::element::f32); } } @@ -134,9 +134,9 @@ std::shared_ptr AvgPoolFunction::getReference( } else if (additionalLayer == "softmax") { lastLayer = std::make_shared(lastLayer); } else if (additionalLayer == "convolution") { - lastLayer = makeConvolution(lastLayer, element::f32, dequantizationAfter.empty()); + lastLayer = makeConvolution(lastLayer, ov::element::f32, dequantizationAfter.empty()); } else if (additionalLayer == "unsupported_convolution") { - lastLayer = makeConvolution(lastLayer, precision, true, element::f32); + lastLayer = makeConvolution(lastLayer, precision, true, ov::element::f32); } } diff --git a/src/tests/ov_helpers/ov_lpt_models/src/common/builders.cpp b/src/tests/ov_helpers/ov_lpt_models/src/common/builders.cpp index 5ec16a126e1..9d6eadfb123 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/common/builders.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/common/builders.cpp @@ -52,18 +52,18 @@ std::shared_ptr makeDequantization( } std::shared_ptr subtractConst = std::make_shared( - dequantizationOperations.subtract.constantPrecision != element::undefined ? - dequantizationOperations.subtract.constantPrecision : - parent.get_element_type(), + dequantizationOperations.subtract.constantPrecision != ov::element::undefined + ? dequantizationOperations.subtract.constantPrecision + : parent.get_element_type(), shape, values); if (dequantizationOperations.subtract.addConvert) { std::shared_ptr subtractConstConvert = std::make_shared( subtractConst, - dequantizationOperations.subtract.outPrecision == element::undefined ? - parent.get_element_type() : - dequantizationOperations.subtract.outPrecision); + dequantizationOperations.subtract.outPrecision == ov::element::undefined + ? parent.get_element_type() + : dequantizationOperations.subtract.outPrecision); auto& rt = subtractConstConvert->get_rt_info(); for (const auto& attribute : dequantizationOperations.subtract.convertAttributes) { @@ -76,27 +76,27 @@ std::shared_ptr makeDequantization( ov::Output leftBranchParent = dequantizationOperations.subtract.constantIndex == 1 ? parent : subtractConst; ov::Output rightBranchParent = dequantizationOperations.subtract.constantIndex == 1 ? subtractConst : parent; - if (((dequantizationOperations.subtract.outPrecision == element::undefined) || - (dequantizationOperations.subtract.outPrecision == parent.get_element_type())) && - (((dequantizationOperations.subtract.constantPrecision == element::undefined) || - (dequantizationOperations.subtract.constantPrecision == parent.get_element_type())) || - dequantizationOperations.subtract.addConvert)) { + if (((dequantizationOperations.subtract.outPrecision == ov::element::undefined) || + (dequantizationOperations.subtract.outPrecision == parent.get_element_type())) && + (((dequantizationOperations.subtract.constantPrecision == ov::element::undefined) || + (dequantizationOperations.subtract.constantPrecision == parent.get_element_type())) || + dequantizationOperations.subtract.addConvert)) { subtract = dequantizationOperations.subtract.constantIndex == 1ul ? std::make_shared(parent, subtractConst) : subtract = std::make_shared(subtractConst, parent); } else { if (dequantizationOperations.subtract.constantIndex == 1ul) { subtract = std::make_shared>( - std::vector{element::f32, element::f32}, - std::vector{ element::f32 }, - ov::op::TemporaryReplaceOutputType(parent, element::f32).get(), - ov::op::TemporaryReplaceOutputType(subtractConst, element::f32).get()); + std::vector{ov::element::f32, ov::element::f32}, + std::vector{ov::element::f32}, + ov::op::TemporaryReplaceOutputType(parent, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(subtractConst, ov::element::f32).get()); } else { subtract = std::make_shared>( - std::vector{element::f32, element::f32}, - std::vector{ element::f32 }, - ov::op::TemporaryReplaceOutputType(subtractConst, element::f32).get(), - ov::op::TemporaryReplaceOutputType(parent, element::f32).get()); + std::vector{ov::element::f32, ov::element::f32}, + std::vector{ov::element::f32}, + ov::op::TemporaryReplaceOutputType(subtractConst, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(parent, ov::element::f32).get()); } ov::pass::low_precision::NetworkHelper::setOutDataPrecision(subtract, dequantizationOperations.subtract.outPrecision); @@ -144,14 +144,12 @@ std::shared_ptr makeMultiply(const ov::Output& parent, const Dequant } std::shared_ptr newMultiply; - if (((multiply.outPrecision == element::undefined) || - (multiply.outPrecision == parent.get_element_type())) && - ((multiply.constantPrecision == element::undefined) || - (multiply.constantPrecision == parent.get_element_type()))) { + if (((multiply.outPrecision == ov::element::undefined) || (multiply.outPrecision == parent.get_element_type())) && + ((multiply.constantPrecision == ov::element::undefined) || + (multiply.constantPrecision == parent.get_element_type()))) { const std::shared_ptr constant = std::make_shared( - multiply.constantPrecision != element::undefined ? - multiply.constantPrecision : - parent.get_element_type(), + multiply.constantPrecision != ov::element::undefined ? multiply.constantPrecision + : parent.get_element_type(), shape, values); @@ -160,24 +158,23 @@ std::shared_ptr makeMultiply(const ov::Output& parent, const Dequant std::make_shared(constant, parent); } else { const std::shared_ptr constant = std::make_shared( - multiply.constantPrecision != element::undefined ? - multiply.constantPrecision : - parent.get_element_type(), + multiply.constantPrecision != ov::element::undefined ? multiply.constantPrecision + : parent.get_element_type(), shape, values); // TODO: use templates - newMultiply = multiply.constantIndex == 1ul ? - std::make_shared>( - std::vector{element::f32, element::f32}, - std::vector{ multiply.outPrecision }, - ov::op::TemporaryReplaceOutputType(parent, element::f32).get(), - ov::op::TemporaryReplaceOutputType(constant, element::f32).get()) : - std::make_shared>( - std::vector{element::f32, element::f32}, - std::vector{ multiply.outPrecision }, - ov::op::TemporaryReplaceOutputType(constant, element::f32).get(), - ov::op::TemporaryReplaceOutputType(parent, element::f32).get()); + newMultiply = multiply.constantIndex == 1ul + ? std::make_shared>( + std::vector{ov::element::f32, ov::element::f32}, + std::vector{multiply.outPrecision}, + ov::op::TemporaryReplaceOutputType(parent, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(constant, ov::element::f32).get()) + : std::make_shared>( + std::vector{ov::element::f32, ov::element::f32}, + std::vector{multiply.outPrecision}, + ov::op::TemporaryReplaceOutputType(constant, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(parent, ov::element::f32).get()); } return newMultiply; @@ -245,7 +242,7 @@ std::shared_ptr makeFakeQuantizeTypeRelaxed( const std::shared_ptr fq = makeFakeQuantize(output, precision, fqOnData); return std::make_shared>( *fq, - fqOnData.outputPrecision == element::undefined ? precision : fqOnData.outputPrecision); + fqOnData.outputPrecision == ov::element::undefined ? precision : fqOnData.outputPrecision); } std::shared_ptr makeFakeQuantize( @@ -258,7 +255,7 @@ std::shared_ptr makeFakeQuantize( if (subgraphOnConstantPath) { const auto topConstant = ov::test::utils::deprecated::make_constant(constantPrecision, ov::Shape{1}, std::vector(1, 0.f), false); - const auto convert = std::make_shared(topConstant, element::f32); + const auto convert = std::make_shared(topConstant, ov::element::f32); const auto subtractMin = std::make_shared( std::make_shared(constantPrecision, ov::Shape{ 1 }, std::vector{fqOnData.outputLowValues[0]}), @@ -355,11 +352,10 @@ void addAttributes(std::vector> nodes, std::vector makeConvolution( - const std::shared_ptr& parent, - const element::Type precision, - const bool weightsWithoutFQ, - const element::Type weightsprecision) { +std::shared_ptr makeConvolution(const std::shared_ptr& parent, + const ov::element::Type precision, + const bool weightsWithoutFQ, + const ov::element::Type weightsprecision) { const size_t outputChannels = parent->get_output_partial_shape(0)[1].get_length() * 2; const size_t inputChannels = parent->get_output_partial_shape(0)[1].get_length(); const auto shape = Shape{ outputChannels, inputChannels, 1, 1 }; diff --git a/src/tests/ov_helpers/ov_lpt_models/src/concat.cpp b/src/tests/ov_helpers/ov_lpt_models/src/concat.cpp index 0b18d5bb67e..deba0f611b7 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/concat.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/concat.cpp @@ -225,14 +225,15 @@ std::shared_ptr ConcatFunction::getOriginalWithNeighbors( convShape[0] = convShape[1] * 2; convShape[2] = convShape[3] = 1; auto convolutionAddition = std::make_shared( - concat1, - std::make_shared( - std::make_shared(ov::opset1::Constant::create(element::i8, convShape, {1}), element::f32), - ov::opset1::Constant::create(element::f32, Shape{}, {1})), - ov::Strides{ 1, 1 }, - ov::CoordinateDiff{ 0, 0 }, - ov::CoordinateDiff{ 0, 0 }, - ov::Strides{ 1, 1 }); + concat1, + std::make_shared( + std::make_shared(ov::opset1::Constant::create(ov::element::i8, convShape, {1}), + ov::element::f32), + ov::opset1::Constant::create(ov::element::f32, Shape{}, {1})), + ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, + ov::CoordinateDiff{0, 0}, + ov::Strides{1, 1}); convolutionAddition->set_friendly_name("convolution_addition"); results.push_back(std::make_shared(convolutionAddition)); } @@ -257,14 +258,15 @@ std::shared_ptr ConcatFunction::getOriginalWithNeighbors( convShape[1] = inputShape[1].get_length(); convShape[2] = convShape[3] = 1; auto convolutionNeighbor = std::make_shared( - fakeQuantize2, - std::make_shared( - std::make_shared(ov::opset1::Constant::create(element::i8, convShape, {1}), element::f32), - ov::opset1::Constant::create(element::f32, Shape{}, {1})), - ov::Strides{ 1, 1 }, - ov::CoordinateDiff{ 0, 0 }, - ov::CoordinateDiff{ 0, 0 }, - ov::Strides{ 1, 1 }); + fakeQuantize2, + std::make_shared( + std::make_shared(ov::opset1::Constant::create(ov::element::i8, convShape, {1}), + ov::element::f32), + ov::opset1::Constant::create(ov::element::f32, Shape{}, {1})), + ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, + ov::CoordinateDiff{0, 0}, + ov::Strides{1, 1}); convolutionNeighbor->set_friendly_name("convolution_neighbor"); results.push_back(std::make_shared(convolutionNeighbor)); } @@ -438,7 +440,7 @@ std::shared_ptr ConcatFunction::getOriginalWithSplitedIntermediate( std::shared_ptr intermediateOp; - const auto constant = std::make_shared(element::i64, Shape{ }, splitedAxis); + const auto constant = std::make_shared(ov::element::i64, Shape{}, splitedAxis); intermediateOp = std::make_shared(fakeQuantize2->output(0), constant, numSplit); intermediateOp->set_friendly_name("intermediate"); @@ -864,18 +866,18 @@ std::shared_ptr ConcatFunction::getOriginalWithIntermediateReshape( input1->set_friendly_name("input1"); const auto fakeQuantize1 = makeFakeQuantize(input1, precision, fqOnData1); const auto reshape1 = std::make_shared( - fakeQuantize1, - ov::opset1::Constant::create(element::i64, Shape{reshapeOutputShape.size()}, reshapeOutputShape), - true); + fakeQuantize1, + ov::opset1::Constant::create(ov::element::i64, Shape{reshapeOutputShape.size()}, reshapeOutputShape), + true); const std::vector inputShape2 = inputShape; const auto input2 = std::make_shared(precision, ov::Shape(inputShape2)); input2->set_friendly_name("input2"); const auto fakeQuantize2 = makeFakeQuantize(input2, precision, fqOnData2); const auto reshape2 = std::make_shared( - fakeQuantize2, - ov::opset1::Constant::create(element::i64, Shape{reshapeOutputShape.size()}, reshapeOutputShape), - true); + fakeQuantize2, + ov::opset1::Constant::create(ov::element::i64, Shape{reshapeOutputShape.size()}, reshapeOutputShape), + true); const std::shared_ptr concat = std::make_shared( ov::OutputVector{ reshape1->output(0), reshape2->output(0) }, 1); concat->set_friendly_name("output"); @@ -1048,7 +1050,9 @@ std::shared_ptr ConcatFunction::get( const auto reshape1 = std::make_shared( parent, - std::make_shared(element::i32, Shape{ intermediateShape.size() }, intermediateShape), + std::make_shared(ov::element::i32, + Shape{intermediateShape.size()}, + intermediateShape), true); const auto maxPool = std::make_shared( @@ -1061,7 +1065,7 @@ std::shared_ptr ConcatFunction::get( const auto reshape2 = std::make_shared( maxPool, - std::make_shared(element::i32, Shape{ originalShape.size() }, originalShape), + std::make_shared(ov::element::i32, Shape{originalShape.size()}, originalShape), true); return reshape2; @@ -1121,7 +1125,7 @@ std::shared_ptr ConcatFunction::get( auto& rtInfo = parent->get_rt_info(); rtInfo["Variant::std::string"] = "concat"; - parent = makeConvolution(parent, element::f32, false); + parent = makeConvolution(parent, ov::element::f32, false); if (!dequantizationAfter.empty()) { parent = makeDequantization(parent, dequantizationAfter); @@ -1202,14 +1206,16 @@ std::shared_ptr ConcatFunction::getReferenceWithNeighbors( convShape[0] = convShape[1] * 2; convShape[2] = convShape[3] = 1; auto convolutionAddition = std::make_shared>( - element::TypeVector{ element::f32, element::f32 }, - element::TypeVector{ element::f32 }, - ov::op::TemporaryReplaceOutputType(mainBranch, element::f32).get(), - ov::op::TemporaryReplaceOutputType(ov::opset1::Constant::create(element::i8, convShape, {1}), element::f32).get(), - ov::Strides{ 1, 1 }, - ov::CoordinateDiff{ 0, 0 }, - ov::CoordinateDiff{ 0, 0 }, - ov::Strides{ 1, 1 }); + ov::element::TypeVector{ov::element::f32, ov::element::f32}, + ov::element::TypeVector{ov::element::f32}, + ov::op::TemporaryReplaceOutputType(mainBranch, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(ov::opset1::Constant::create(ov::element::i8, convShape, {1}), + ov::element::f32) + .get(), + ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, + ov::CoordinateDiff{0, 0}, + ov::Strides{1, 1}); convolutionAddition->set_friendly_name("convolution_addition"); output_name1 = "convolution_addition"; mainBranch = convolutionAddition; @@ -1247,14 +1253,16 @@ std::shared_ptr ConcatFunction::getReferenceWithNeighbors( convShape[1] = inputShape[1].get_length(); convShape[2] = convShape[3] = 1; auto convolutionNeighbor = std::make_shared>( - element::TypeVector{ element::f32, element::f32 }, - element::TypeVector{ element::f32 }, - ov::op::TemporaryReplaceOutputType(neighbor, element::f32).get(), - ov::op::TemporaryReplaceOutputType(ov::opset1::Constant::create(element::i8, convShape, {1}), element::f32).get(), - ov::Strides{ 1, 1 }, - ov::CoordinateDiff{ 0, 0 }, - ov::CoordinateDiff{ 0, 0 }, - ov::Strides{ 1, 1 }); + ov::element::TypeVector{ov::element::f32, ov::element::f32}, + ov::element::TypeVector{ov::element::f32}, + ov::op::TemporaryReplaceOutputType(neighbor, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(ov::opset1::Constant::create(ov::element::i8, convShape, {1}), + ov::element::f32) + .get(), + ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, + ov::CoordinateDiff{0, 0}, + ov::Strides{1, 1}); convolutionNeighbor->set_friendly_name("convolution_neighbor"); output_name2 = "convolution_neighbor"; neighbor = convolutionNeighbor; @@ -1426,13 +1434,13 @@ std::shared_ptr ConcatFunction::getReferenceWithIntermediateAvgPool( parent1->set_friendly_name("concat"); std::shared_ptr parent2 = std::make_shared>( - std::vector{ element::f32, element::f32 }, - std::vector{ element::f32 }, - ov::op::TemporaryReplaceOutputType(intermediateOp, element::f32).get(), - Strides{ 1, 1 }, - Shape{ 1, 1 }, - Shape{ 0, 0 }, - Shape{ 2, 2 }, + std::vector{ov::element::f32, ov::element::f32}, + std::vector{ov::element::f32}, + ov::op::TemporaryReplaceOutputType(intermediateOp, ov::element::f32).get(), + Strides{1, 1}, + Shape{1, 1}, + Shape{0, 0}, + Shape{2, 2}, true, op::RoundingType::FLOOR); parent2->set_friendly_name("avgPool"); @@ -1496,7 +1504,7 @@ std::shared_ptr ConcatFunction::getReferenceWithSplitedIntermediate( std::shared_ptr intermediateOp; - const auto constant = std::make_shared(element::i64, Shape{ }, splitedAxis); + const auto constant = std::make_shared(ov::element::i64, Shape{}, splitedAxis); intermediateOp = std::make_shared(deqBefore2, constant, numSplit); intermediateOp->set_friendly_name("intermediate"); @@ -1994,21 +2002,21 @@ std::shared_ptr ConcatFunction::getReferenceWithIntermediateReshape( const auto input1 = std::make_shared(precision, inputShape); input1->set_friendly_name("input1"); const auto fakeQuantize1 = makeFakeQuantizeTypeRelaxed(input1, precision, fqOnData1); - ov::pass::low_precision::NetworkHelper::setOutDataPrecision(fakeQuantize1, element::u8); + ov::pass::low_precision::NetworkHelper::setOutDataPrecision(fakeQuantize1, ov::element::u8); const auto reshape1 = std::make_shared( - fakeQuantize1, - ov::opset1::Constant::create(element::i64, Shape{reshapeOutputShape.size()}, reshapeOutputShape), - true); + fakeQuantize1, + ov::opset1::Constant::create(ov::element::i64, Shape{reshapeOutputShape.size()}, reshapeOutputShape), + true); const std::vector inputShape2 = inputShape; const auto input2 = std::make_shared(precision, ov::Shape(inputShape2)); input2->set_friendly_name("input2"); const auto fakeQuantize2 = makeFakeQuantizeTypeRelaxed(input2, precision, fqOnData2); - ov::pass::low_precision::NetworkHelper::setOutDataPrecision(fakeQuantize2, element::u8); + ov::pass::low_precision::NetworkHelper::setOutDataPrecision(fakeQuantize2, ov::element::u8); const auto reshape2 = std::make_shared( - fakeQuantize2, - ov::opset1::Constant::create(element::i64, Shape{reshapeOutputShape.size()}, reshapeOutputShape), - true); + fakeQuantize2, + ov::opset1::Constant::create(ov::element::i64, Shape{reshapeOutputShape.size()}, reshapeOutputShape), + true); const std::shared_ptr concat = std::make_shared( ov::OutputVector{ reshape1->output(0), reshape2->output(0) }, 1); concat->set_friendly_name("output_original"); diff --git a/src/tests/ov_helpers/ov_lpt_models/src/convolution.cpp b/src/tests/ov_helpers/ov_lpt_models/src/convolution.cpp index e9b2aa1c09e..6a60cfdf27e 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/convolution.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/convolution.cpp @@ -111,10 +111,11 @@ std::shared_ptr ConvolutionFunction::getOriginal( ov::CoordinateDiff{ 0, 0 }, ov::CoordinateDiff{ 0, 0 }, ov::Strides{ 1, 1 }); - std::shared_ptr convolution = std::make_shared>( - convolutionOriginal, - std::vector{ netPrecision, netPrecision }, - std::vector{ netPrecision }); + std::shared_ptr convolution = + std::make_shared>( + convolutionOriginal, + std::vector{netPrecision, netPrecision}, + std::vector{netPrecision}); convolution->set_friendly_name("output"); auto& rtInfo = convolution->get_rt_info(); rtInfo["Variant::std::string"] = "convolution"; @@ -229,18 +230,19 @@ std::shared_ptr ConvolutionFunction::getReferenceWithIncorrectWeights std::vector(outputChannelsCount * inputChannelsCount, weightsValues[0]) : weightsValues); - auto convolutionOriginal = ov::opset1::Convolution( - ov::op::TemporaryReplaceOutputType(deqBefore, element::f32).get(), - ov::op::TemporaryReplaceOutputType(weights, element::f32).get(), - ov::Strides{ 1, 1 }, - ov::CoordinateDiff{ 0, 0 }, - ov::CoordinateDiff{ 0, 0 }, - ov::Strides{ 1, 1 }); + auto convolutionOriginal = + ov::opset1::Convolution(ov::op::TemporaryReplaceOutputType(deqBefore, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(weights, ov::element::f32).get(), + ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, + ov::CoordinateDiff{0, 0}, + ov::Strides{1, 1}); - std::shared_ptr convolution = std::make_shared>( - convolutionOriginal, - std::vector{ element::f32, element::f32 }, - std::vector{}); + std::shared_ptr convolution = + std::make_shared>( + convolutionOriginal, + std::vector{ov::element::f32, ov::element::f32}, + std::vector{}); const auto deqAfter = makeDequantization(convolution, dequantizationAfter); @@ -305,10 +307,11 @@ std::shared_ptr ConvolutionFunction::getReference( ov::CoordinateDiff{ 0, 0 }, ov::Strides{ 1, 1 }); - std::shared_ptr convolution = std::make_shared>( - convolutionOriginal, - std::vector{ netPrecision, netPrecision }, - std::vector{ netPrecision }); + std::shared_ptr convolution = + std::make_shared>( + convolutionOriginal, + std::vector{netPrecision, netPrecision}, + std::vector{netPrecision}); if (!dequantizationAfter.empty()) { ov::pass::low_precision::NetworkHelper::setOutDataPrecisionForTypeRelaxed(convolution, @@ -368,18 +371,19 @@ std::shared_ptr ConvolutionFunction::get( fakeQuantizeOnWeights.inputLowValues, fakeQuantizeOnWeights.inputHighValues, fakeQuantizeOnWeights.outputLowValues, fakeQuantizeOnWeights.outputHighValues); - auto convolutionOriginal = ov::opset1::Convolution( - ov::op::TemporaryReplaceOutputType(parentOnData, element::f32).get(), - ov::op::TemporaryReplaceOutputType(parentOnWeights, element::f32).get(), - ov::Strides{ 1, 1 }, - ov::CoordinateDiff{ 0, 0 }, - ov::CoordinateDiff{ 0, 0 }, - ov::Strides{ 1, 1 }); + auto convolutionOriginal = + ov::opset1::Convolution(ov::op::TemporaryReplaceOutputType(parentOnData, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(parentOnWeights, ov::element::f32).get(), + ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, + ov::CoordinateDiff{0, 0}, + ov::Strides{1, 1}); - const std::shared_ptr convolution = std::make_shared>( - convolutionOriginal, - std::vector{ element::f32, element::f32 }, - std::vector{}); + const std::shared_ptr convolution = + std::make_shared>( + convolutionOriginal, + std::vector{ov::element::f32, ov::element::f32}, + std::vector{}); convolution->set_friendly_name("convolution"); for (const auto& r : restrictions) { diff --git a/src/tests/ov_helpers/ov_lpt_models/src/convolution_backprop_data.cpp b/src/tests/ov_helpers/ov_lpt_models/src/convolution_backprop_data.cpp index fec7475770a..1a788e24401 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/convolution_backprop_data.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/convolution_backprop_data.cpp @@ -20,12 +20,11 @@ namespace ov { namespace builder { namespace subgraph { -std::shared_ptr ConvolutionBackpropDataFunction::get( - const element::Type netPrecision, - const PartialShape& inputShape, - const Shape& outputShape, - const builder::subgraph::FakeQuantizeOnData& fqOnData, - const std::shared_ptr& weights) { +std::shared_ptr ConvolutionBackpropDataFunction::get(const ov::element::Type netPrecision, + const PartialShape& inputShape, + const Shape& outputShape, + const builder::subgraph::FakeQuantizeOnData& fqOnData, + const std::shared_ptr& weights) { const auto input = std::make_shared(netPrecision, inputShape); const auto fq = makeFakeQuantize(input, netPrecision, fqOnData); @@ -44,15 +43,13 @@ std::shared_ptr ConvolutionBackpropDataFunction::get( std::shared_ptr ConvolutionBackpropDataFunction::getWeights( const Shape& shape, - const element::Type& netPrecision, + const ov::element::Type& netPrecision, const builder::subgraph::FakeQuantizeOnWeights& fqOnWeights, const std::shared_ptr& value) { - const auto weights = value != nullptr ? - value : - std::make_shared( - element::i8, - shape, - std::vector(shape_size(shape), 1)); + const auto weights = + value != nullptr + ? value + : std::make_shared(ov::element::i8, shape, std::vector(shape_size(shape), 1)); const auto convert = std::make_shared(weights, netPrecision); OutputVector convertedOutput(1); convert->constant_fold(convertedOutput, convert->input_values()); @@ -64,16 +61,13 @@ std::shared_ptr ConvolutionBackpropDataFunction::getWeights( std::shared_ptr ConvolutionBackpropDataFunction::getWeights( const Shape& shape, - const element::Type& netPrecision, + const ov::element::Type& netPrecision, const builder::subgraph::DequantizationOperations& dequantizationOnWeights, const std::shared_ptr& value) { auto weights = - value != nullptr ? - value : - std::make_shared( - element::i8, - shape, - std::vector(shape_size(shape), 1)); + value != nullptr + ? value + : std::make_shared(ov::element::i8, shape, std::vector(shape_size(shape), 1)); auto dequantizationStructure = dequantizationOnWeights; dequantizationStructure.setPrecision(netPrecision); if (!dequantizationOnWeights.subtract.constantPrecision.is_real()) { @@ -89,14 +83,14 @@ std::shared_ptr ConvolutionBackpropDataFunction::getWeights( std::shared_ptr ConvolutionBackpropDataFunction::getWeights( const Shape& shape, - const element::Type& netPrecision, + const ov::element::Type& netPrecision, const builder::subgraph::FakeQuantizeOnWeights& fqOnWeights, const builder::subgraph::DequantizationOperations& dequantizationOnWeights, const std::shared_ptr& value) { const auto weights = value != nullptr ? value - : std::make_shared(element::i8, shape, std::vector(shape_size(shape), 1)); + : std::make_shared(ov::element::i8, shape, std::vector(shape_size(shape), 1)); const auto convert = std::make_shared(weights, netPrecision); OutputVector convertedOutput(1); convert->constant_fold(convertedOutput, convert->input_values()); @@ -109,8 +103,8 @@ std::shared_ptr ConvolutionBackpropDataFunction::getWeights( } std::shared_ptr ConvolutionBackpropDataFunction::getOriginal( - const element::Type precision, - const element::Type netPrecision, + const ov::element::Type precision, + const ov::element::Type netPrecision, const PartialShape& inputShape, const Shape& outputShape, const builder::subgraph::DequantizationOperations& dequantization, @@ -133,9 +127,9 @@ std::shared_ptr ConvolutionBackpropDataFunction::getOriginal( return std::make_shared(results, ParameterVector{ input }, "ConvolutionBackpropDataTransformation"); } -std::shared_ptr ConvolutionBackpropDataFunction::getReference( - const element::Type precision, - const element::Type netPrecision, +std::shared_ptr ConvolutionBackpropDataFunction::getReference( + const ov::element::Type precision, + const ov::element::Type netPrecision, const PartialShape& inputShape, const Shape& outputShape, const builder::subgraph::DequantizationOperations& dequantization, @@ -147,14 +141,14 @@ std::shared_ptr ConvolutionBackpropDataFunction::getReference( const auto activations = makeDequantization(input, dequantizationStructure); auto convolutionBackpropData = std::make_shared>( - std::vector{ element::f32, element::f32 }, - std::vector{ dequantizationAfter.empty() ? netPrecision : element::f32 }, - ov::op::TemporaryReplaceOutputType(activations, element::f32).get(), - ov::op::TemporaryReplaceOutputType(weights, element::f32).get(), - Strides{ 1, 1 }, - CoordinateDiff{ 0, 0 }, - CoordinateDiff{ 0, 0 }, - Strides{ 1, 1 }); + std::vector{ov::element::f32, ov::element::f32}, + std::vector{dequantizationAfter.empty() ? netPrecision : ov::element::f32}, + ov::op::TemporaryReplaceOutputType(activations, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(weights, ov::element::f32).get(), + Strides{1, 1}, + CoordinateDiff{0, 0}, + CoordinateDiff{0, 0}, + Strides{1, 1}); auto dequantizationStructureAfter = dequantizationAfter; dequantizationStructureAfter.multiply.outPrecision = netPrecision; diff --git a/src/tests/ov_helpers/ov_lpt_models/src/elementwise_with_multi_parent_dequantization.cpp b/src/tests/ov_helpers/ov_lpt_models/src/elementwise_with_multi_parent_dequantization.cpp index 22607cf1fd2..538f08e5dc7 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/elementwise_with_multi_parent_dequantization.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/elementwise_with_multi_parent_dequantization.cpp @@ -24,22 +24,20 @@ std::shared_ptr ElementwiseWithMultiParentDequantizationFunction::get const auto input1_1 = std::make_shared(precision1, inputShape); const auto input1_2 = std::make_shared(precision1, ov::Shape({ inputShape[0], inputShape[1], 1, 1 })); const std::shared_ptr multiply1 = std::make_shared>( - ov::opset1::Multiply( - ov::op::TemporaryReplaceOutputType(input1_1, element::f32).get(), - ov::op::TemporaryReplaceOutputType(input1_2, element::f32).get()), - std::vector{element::f32, element::f32}, - std::vector{}); + ov::opset1::Multiply(ov::op::TemporaryReplaceOutputType(input1_1, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(input1_2, ov::element::f32).get()), + std::vector{ov::element::f32, ov::element::f32}, + std::vector{}); const std::shared_ptr parent1 = dequantization1.empty() ? multiply1 : makeDequantization(multiply1, dequantization1); const auto input2_1 = std::make_shared(precision1, inputShape); const auto input2_2 = std::make_shared(precision1, ov::Shape({ inputShape[0], inputShape[1], 1, 1 })); const std::shared_ptr multiply2 = std::make_shared>( - ov::opset1::Multiply( - ov::op::TemporaryReplaceOutputType(input2_1, element::f32).get(), - ov::op::TemporaryReplaceOutputType(input2_2, element::f32).get()), - std::vector{element::f32, element::f32}, - std::vector{}); + ov::opset1::Multiply(ov::op::TemporaryReplaceOutputType(input2_1, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(input2_2, ov::element::f32).get()), + std::vector{ov::element::f32, ov::element::f32}, + std::vector{}); const std::shared_ptr parent2 = dequantization2.empty() ? multiply2 : makeDequantization(multiply2, dequantization2); diff --git a/src/tests/ov_helpers/ov_lpt_models/src/fake_quantize.cpp b/src/tests/ov_helpers/ov_lpt_models/src/fake_quantize.cpp index e384b600ca9..875423b4b9c 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/fake_quantize.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/fake_quantize.cpp @@ -25,9 +25,14 @@ std::shared_ptr FakeQuantizeFunction::getOriginalWithMaxPool( const auto input = std::make_shared(precision, inputShape); input->set_friendly_name("input"); - const auto fakeQuantize = ov::test::utils::make_fake_quantize( - input, element::f32, fakeQuantizeOnData.quantizationLevel, fakeQuantizeOnData.constantShape, - fakeQuantizeOnData.inputLowValues, fakeQuantizeOnData.inputHighValues, fakeQuantizeOnData.outputLowValues, fakeQuantizeOnData.outputHighValues); + const auto fakeQuantize = ov::test::utils::make_fake_quantize(input, + ov::element::f32, + fakeQuantizeOnData.quantizationLevel, + fakeQuantizeOnData.constantShape, + fakeQuantizeOnData.inputLowValues, + fakeQuantizeOnData.inputHighValues, + fakeQuantizeOnData.outputLowValues, + fakeQuantizeOnData.outputHighValues); const auto maxPool = std::make_shared( fakeQuantize, Strides{ 1, 1 }, @@ -94,22 +99,23 @@ std::shared_ptr FakeQuantizeFunction::getReference( std::shared_ptr lastOperation = fakeQuantize; if (addNotPrecisionPreservedOperation) { lastOperation = std::make_shared>( - std::vector{element::f32}, std::vector{element::f32}, - ov::op::TemporaryReplaceOutputType(fakeQuantize, element::f32).get(), - Strides{ 1, 1 }, - Shape{ 1, 1 }, - Shape{ 1, 1 }, - Shape{ 2, 2 }, + std::vector{ov::element::f32}, + std::vector{ov::element::f32}, + ov::op::TemporaryReplaceOutputType(fakeQuantize, ov::element::f32).get(), + Strides{1, 1}, + Shape{1, 1}, + Shape{1, 1}, + Shape{2, 2}, true, op::RoundingType::FLOOR); } auto updateDequantization = dequantization; if (!updateDequantization.subtract.empty()) { - updateDequantization.subtract.constantPrecision = element::f32; + updateDequantization.subtract.constantPrecision = ov::element::f32; } if (!updateDequantization.multiply.empty()) { - updateDequantization.multiply.constantPrecision = element::f32; + updateDequantization.multiply.constantPrecision = ov::element::f32; } updateDequantization.multiply.outPrecision = precision; @@ -118,7 +124,7 @@ std::shared_ptr FakeQuantizeFunction::getReference( deq = makeDequantization(lastOperation, updateDequantization); ov::pass::low_precision::NetworkHelper::setOutDataPrecisionForTypeRelaxed(fakeQuantize, fakeQuantizeOutputPrecision); } else { - if (precision == element::f32) { + if (precision == ov::element::f32) { updateDequantization.convert = {}; } deq = makeDequantization(lastOperation, updateDequantization); diff --git a/src/tests/ov_helpers/ov_lpt_models/src/fake_quantize_and_convolution.cpp b/src/tests/ov_helpers/ov_lpt_models/src/fake_quantize_and_convolution.cpp index 364bef53d86..98600ef160d 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/fake_quantize_and_convolution.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/fake_quantize_and_convolution.cpp @@ -186,30 +186,28 @@ std::shared_ptr FakeQuantizeAndConvolutionFunction::get( std::shared_ptr lastOperation; if (operation == "Convolution") { lastOperation = std::make_shared>( - ov::opset1::Convolution( - ov::op::TemporaryReplaceOutputType(parentOnActivation, element::f32).get(), - ov::op::TemporaryReplaceOutputType(parentOnWeights, element::f32).get(), - ov::Strides{ 1, 1 }, - ov::CoordinateDiff{ 0, 0 }, - ov::CoordinateDiff{ 0, 0 }, - ov::Strides{ 1, 1 }), - std::vector{ element::f32, element::f32 }, - std::vector{}); + ov::opset1::Convolution(ov::op::TemporaryReplaceOutputType(parentOnActivation, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(parentOnWeights, ov::element::f32).get(), + ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, + ov::CoordinateDiff{0, 0}, + ov::Strides{1, 1}), + std::vector{ov::element::f32, ov::element::f32}, + std::vector{}); } else if (operation == "GroupConvolution") { lastOperation = std::make_shared>( - ov::opset1::GroupConvolution( - ov::op::TemporaryReplaceOutputType(parentOnActivation, element::f32).get(), - ov::op::TemporaryReplaceOutputType(parentOnWeights, element::f32).get(), - ov::Strides{ 1, 1 }, - ov::CoordinateDiff{ 0, 0 }, - ov::CoordinateDiff{ 0, 0 }, - ov::Strides{ 1, 1 }), - std::vector{ element::f32, element::f32 }, - std::vector{}); + ov::opset1::GroupConvolution(ov::op::TemporaryReplaceOutputType(parentOnActivation, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(parentOnWeights, ov::element::f32).get(), + ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, + ov::CoordinateDiff{0, 0}, + ov::Strides{1, 1}), + std::vector{ov::element::f32, ov::element::f32}, + std::vector{}); if (multiplyAfter) { const auto& O = lastOperation->get_shape()[1]; std::vector weights_val(O, 1); - auto constant = ov::opset1::Constant::create(element::f32, Shape{O, 1, 1}, weights_val); + auto constant = ov::opset1::Constant::create(ov::element::f32, Shape{O, 1, 1}, weights_val); lastOperation = std::make_shared(lastOperation, constant); } } else { diff --git a/src/tests/ov_helpers/ov_lpt_models/src/fake_quantize_and_two_output_branches_with_convolution.cpp b/src/tests/ov_helpers/ov_lpt_models/src/fake_quantize_and_two_output_branches_with_convolution.cpp index 0331ca10039..a967f9b3e16 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/fake_quantize_and_two_output_branches_with_convolution.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/fake_quantize_and_two_output_branches_with_convolution.cpp @@ -26,29 +26,42 @@ std::shared_ptr createConvolution( ov::Shape{ outputChannelsCount, inputChannelsCount, 1, 1 }, std::vector(outputChannelsCount * inputChannelsCount, 1)); - const std::shared_ptr convolution = typeRelaxed ? - std::make_shared>( - std::vector{ element::f32, element::f32 }, std::vector{}, - ov::op::TemporaryReplaceOutputType(parent, element::f32).get(), - ov::op::TemporaryReplaceOutputType(fqOnWeights.empty() ? - weights : - ov::test::utils::make_fake_quantize( - weights, precision, fqOnWeights.quantizationLevel, fqOnWeights.constantShape, - fqOnWeights.inputLowValues, fqOnWeights.inputHighValues, fqOnWeights.outputLowValues, fqOnWeights.outputHighValues), element::f32).get(), - ov::Strides{ 1, 1 }, - ov::CoordinateDiff{ 0, 0 }, - ov::CoordinateDiff{ 0, 0 }, - ov::Strides{ 1, 1 }) : - std::make_shared( - parent, - fqOnWeights.empty() ? weights->output(0) : - ov::test::utils::make_fake_quantize( - weights, precision, fqOnWeights.quantizationLevel, fqOnWeights.constantShape, - fqOnWeights.inputLowValues, fqOnWeights.inputHighValues, fqOnWeights.outputLowValues, fqOnWeights.outputHighValues), - ov::Strides{ 1, 1 }, - ov::CoordinateDiff{ 0, 0 }, - ov::CoordinateDiff{ 0, 0 }, - ov::Strides{ 1, 1 }); + const std::shared_ptr convolution = + typeRelaxed ? std::make_shared>( + std::vector{ov::element::f32, ov::element::f32}, + std::vector{}, + ov::op::TemporaryReplaceOutputType(parent, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType( + fqOnWeights.empty() ? weights + : ov::test::utils::make_fake_quantize(weights, + precision, + fqOnWeights.quantizationLevel, + fqOnWeights.constantShape, + fqOnWeights.inputLowValues, + fqOnWeights.inputHighValues, + fqOnWeights.outputLowValues, + fqOnWeights.outputHighValues), + ov::element::f32) + .get(), + ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, + ov::CoordinateDiff{0, 0}, + ov::Strides{1, 1}) + : std::make_shared( + parent, + fqOnWeights.empty() ? weights->output(0) + : ov::test::utils::make_fake_quantize(weights, + precision, + fqOnWeights.quantizationLevel, + fqOnWeights.constantShape, + fqOnWeights.inputLowValues, + fqOnWeights.inputHighValues, + fqOnWeights.outputLowValues, + fqOnWeights.outputHighValues), + ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, + ov::CoordinateDiff{0, 0}, + ov::Strides{1, 1}); return convolution; } @@ -127,13 +140,13 @@ std::shared_ptr FakeQuantizeAndTwoOutputBranchesWithConvolutionFuncti const std::shared_ptr concat = std::make_shared(NodeVector{ deqAfter1, deqAfter2 }, 1ul); ov::pass::low_precision::NetworkHelper::setOutDataPrecision(concat, precisionAfterOp); if (params.updatePrecisions) { - replace_node( - convolution1->get_input_node_shared_ptr(1), - ov::pass::low_precision::fold(convolution1->get_input_node_shared_ptr(1), element::i8)); + replace_node(convolution1->get_input_node_shared_ptr(1), + ov::pass::low_precision::fold(convolution1->get_input_node_shared_ptr(1), + ov::element::i8)); - replace_node( - convolution2->get_input_node_shared_ptr(1), - ov::pass::low_precision::fold(convolution2->get_input_node_shared_ptr(1), element::i8)); + replace_node(convolution2->get_input_node_shared_ptr(1), + ov::pass::low_precision::fold(convolution2->get_input_node_shared_ptr(1), + ov::element::i8)); } ov::ResultVector results{ std::make_shared(concat) }; diff --git a/src/tests/ov_helpers/ov_lpt_models/src/fake_quantize_precision_selection.cpp b/src/tests/ov_helpers/ov_lpt_models/src/fake_quantize_precision_selection.cpp index 86448280f50..06f06e8a887 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/fake_quantize_precision_selection.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/fake_quantize_precision_selection.cpp @@ -37,16 +37,19 @@ std::shared_ptr FakeQuantizePrecisionSelectionFunction::getOriginal( std::shared_ptr branch1Last; { // branch with limitation precision operation (Convolution) - std::shared_ptr branch1Operation = values.operationBeforeLimitedOperationIsPrecisionTransparent ? - std::dynamic_pointer_cast(std::make_shared( - fakeQuantize, - Strides{ 1, 1 }, Shape{ 1, 1 }, Shape{ 0, 0 }, Shape{ 2, 2 }, - op::RoundingType::FLOOR)) : - std::make_shared>( - ov::opset1::PRelu( - fakeQuantize, - std::make_shared(element::f32, Shape{}, std::vector{ 0.01 })), - element::f32); + std::shared_ptr branch1Operation = + values.operationBeforeLimitedOperationIsPrecisionTransparent + ? std::dynamic_pointer_cast(std::make_shared(fakeQuantize, + Strides{1, 1}, + Shape{1, 1}, + Shape{0, 0}, + Shape{2, 2}, + op::RoundingType::FLOOR)) + : std::make_shared>( + ov::opset1::PRelu( + fakeQuantize, + std::make_shared(ov::element::f32, Shape{}, std::vector{0.01})), + ov::element::f32); const size_t inputChannelsCount = inputShape[1].get_length(); const size_t outputChannelsCount = 2 * inputShape[1].get_length(); @@ -83,8 +86,8 @@ std::shared_ptr FakeQuantizePrecisionSelectionFunction::getOriginal( branch2Last = std::make_shared>( ov::opset1::PRelu( fakeQuantize, - std::make_shared(element::f32, Shape{}, std::vector{ 0.01 })), - element::f32); + std::make_shared(ov::element::f32, Shape{}, std::vector{0.01})), + ov::element::f32); } const std::shared_ptr concat = std::make_shared( @@ -109,14 +112,17 @@ std::shared_ptr FakeQuantizePrecisionSelectionFunction::getReference( fakeQuantize->set_friendly_name("fakeQuantize"); // branch with limitation precision operation (Convolution) - std::shared_ptr branch1Pooling = values.operationBeforeLimitedOperationIsPrecisionTransparent ? - std::dynamic_pointer_cast(std::make_shared( - fakeQuantize, - Strides{ 1, 1 }, Shape{ 1, 1 }, Shape{ 0, 0 }, Shape{ 2, 2 }, - op::RoundingType::FLOOR)) : - std::make_shared>( - fakeQuantize, - std::make_shared(element::f32, Shape{}, std::vector{ 0.01 })); + std::shared_ptr branch1Pooling = + values.operationBeforeLimitedOperationIsPrecisionTransparent + ? std::dynamic_pointer_cast(std::make_shared(fakeQuantize, + Strides{1, 1}, + Shape{1, 1}, + Shape{0, 0}, + Shape{2, 2}, + op::RoundingType::FLOOR)) + : std::make_shared>( + fakeQuantize, + std::make_shared(ov::element::f32, Shape{}, std::vector{0.01})); const size_t inputChannelsCount = inputShape[1]; const size_t outputChannelsCount = 2 * inputShape[1]; @@ -138,14 +144,16 @@ std::shared_ptr FakeQuantizePrecisionSelectionFunction::getReference( values.fakeQuantizeOnWeights.outputLowValues, values.fakeQuantizeOnWeights.outputHighValues); - std::shared_ptr convolution = std::make_shared>( - std::vector{ element::f32, element::f32 }, std::vector{}, - ov::op::TemporaryReplaceOutputType(branch1Pooling, element::f32).get(), - ov::op::TemporaryReplaceOutputType(onWeights, element::f32).get(), - ov::Strides{ 1, 1 }, - ov::CoordinateDiff{ 0, 0 }, - ov::CoordinateDiff{ 0, 0 }, - ov::Strides{ 1, 1 }); + std::shared_ptr convolution = + std::make_shared>( + std::vector{ov::element::f32, ov::element::f32}, + std::vector{}, + ov::op::TemporaryReplaceOutputType(branch1Pooling, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(onWeights, ov::element::f32).get(), + ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, + ov::CoordinateDiff{0, 0}, + ov::Strides{1, 1}); std::shared_ptr branch1Multiply = std::make_shared( convolution, @@ -155,7 +163,7 @@ std::shared_ptr FakeQuantizePrecisionSelectionFunction::getReference( // just another branch std::shared_ptr branch2PRelu = std::make_shared>( fakeQuantize, - std::make_shared(element::f32, Shape{}, std::vector{ 0.01 })); + std::make_shared(ov::element::f32, Shape{}, std::vector{0.01})); const std::shared_ptr branch2Multiply = std::make_shared( branch2PRelu, diff --git a/src/tests/ov_helpers/ov_lpt_models/src/fuse_fake_quantize.cpp b/src/tests/ov_helpers/ov_lpt_models/src/fuse_fake_quantize.cpp index b2d12c65b97..2472bdfff91 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/fuse_fake_quantize.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/fuse_fake_quantize.cpp @@ -100,19 +100,16 @@ std::shared_ptr make_convolution( auto fqOnDataCopy = fqOnData; fqOnDataCopy.outputHighValues = {255.f}; - fqOnDataCopy.outputPrecision = fqOnData.outputPrecision == element::undefined ? ov::element::u8 : fqOnData.outputPrecision; + fqOnDataCopy.outputPrecision = + fqOnData.outputPrecision == ov::element::undefined ? ov::element::u8 : fqOnData.outputPrecision; std::shared_ptr lastNode = makeFakeQuantizeTypeRelaxed(lastDequantization, precisionFqOnData, fqOnDataCopy); - lastNode = makeDequantization( - lastNode, - { - lastNode->output(0).get_element_type() != element::f32 ? - DequantizationOperations::Convert{element::f32} : - DequantizationOperations::Convert{}, - {}, - {{0.01f}, - precisionFqOnData} - }); + lastNode = makeDequantization(lastNode, + {lastNode->output(0).get_element_type() != ov::element::f32 + ? DequantizationOperations::Convert{ov::element::f32} + : DequantizationOperations::Convert{}, + {}, + {{0.01f}, precisionFqOnData}}); lastNode->set_friendly_name("output"); ov::ResultVector results{ std::make_shared(lastNode) }; diff --git a/src/tests/ov_helpers/ov_lpt_models/src/fuse_subtract_to_fake_quantize.cpp b/src/tests/ov_helpers/ov_lpt_models/src/fuse_subtract_to_fake_quantize.cpp index 9ee92058e78..96af6bd5fd4 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/fuse_subtract_to_fake_quantize.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/fuse_subtract_to_fake_quantize.cpp @@ -40,7 +40,7 @@ std::shared_ptr FuseSubtractToFakeQuantizeFunction::get( const DequantizationOperations& dequantization2) { const auto input = std::make_shared(ov::element::f32, inputShape); - const auto axis = std::make_shared(element::i64, Shape{}, 1ul); + const auto axis = std::make_shared(ov::element::i64, Shape{}, 1ul); const std::shared_ptr split = std::make_shared(input, axis, 2ul); const auto fakeQuantize = makeFakeQuantize(split->output(0), ov::element::f32, fqOnData); diff --git a/src/tests/ov_helpers/ov_lpt_models/src/group_convolution.cpp b/src/tests/ov_helpers/ov_lpt_models/src/group_convolution.cpp index 0366757643e..c211652ec67 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/group_convolution.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/group_convolution.cpp @@ -125,10 +125,7 @@ std::shared_ptr createWeightsOriginal( weights = std::make_shared( weights, - ov::opset1::Constant::create( - element::i64, - Shape{ static_cast(rankLength) + 1ul }, - values), + ov::opset1::Constant::create(ov::element::i64, Shape{static_cast(rankLength) + 1ul}, values), true); } } @@ -333,18 +330,19 @@ std::shared_ptr GroupConvolutionFunction::get( addReshape); } - auto convolutionOriginal = ov::opset1::GroupConvolution( - ov::op::TemporaryReplaceOutputType(deqBefore, element::f32).get(), - ov::op::TemporaryReplaceOutputType(weights, element::f32).get(), - ov::Strides{ 1, 1 }, - ov::CoordinateDiff{ 0, 0 }, - ov::CoordinateDiff{ 0, 0 }, - ov::Strides{ 1, 1 }); + auto convolutionOriginal = + ov::opset1::GroupConvolution(ov::op::TemporaryReplaceOutputType(deqBefore, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(weights, ov::element::f32).get(), + ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, + ov::CoordinateDiff{0, 0}, + ov::Strides{1, 1}); - std::shared_ptr convolution = std::make_shared>( - convolutionOriginal, - std::vector{ element::f32, element::f32 }, - std::vector{}); + std::shared_ptr convolution = + std::make_shared>( + convolutionOriginal, + std::vector{ov::element::f32, ov::element::f32}, + std::vector{}); ov::pass::low_precision::NetworkHelper::setOutDataPrecisionForTypeRelaxed(convolution, precisionAfterOperation); const auto deqAfter = makeDequantization(convolution, dequantizationAfter); diff --git a/src/tests/ov_helpers/ov_lpt_models/src/markup_avg_pool_precisions.cpp b/src/tests/ov_helpers/ov_lpt_models/src/markup_avg_pool_precisions.cpp index 2bef07a2ed9..15eeef441fd 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/markup_avg_pool_precisions.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/markup_avg_pool_precisions.cpp @@ -25,10 +25,10 @@ std::shared_ptr createConvolution( const size_t inputChannels = inputShape[1]; const auto shape = Shape{ outputChannels, inputChannels, 1, 1 }; const auto fakeQuantizeOnWeights = ov::test::utils::make_fake_quantize( - std::make_shared(element::f32, shape, std::vector(1.f, ov::shape_size(shape))), + std::make_shared(ov::element::f32, shape, std::vector(1.f, ov::shape_size(shape))), precision, 255, - { outputChannels, 1, 1, 1 }, + {outputChannels, 1, 1, 1}, std::vector(outputChannels, -1.27f), std::vector(outputChannels, 1.27f), std::vector(outputChannels, -1.27f), diff --git a/src/tests/ov_helpers/ov_lpt_models/src/mat_mul.cpp b/src/tests/ov_helpers/ov_lpt_models/src/mat_mul.cpp index 6a6455994bf..95d9941dab4 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/mat_mul.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/mat_mul.cpp @@ -116,14 +116,13 @@ std::shared_ptr MatMulFunction::getOriginal( return function; } -std::shared_ptr MatMulFunction::getOriginal( - const element::Type netPrecision, - const ov::PartialShape& inputShape1, - const ov::element::Type precisionBeforeDequantization1, - const DequantizationOperations& dequantization1, - const ov::PartialShape& inputShape2, - const ov::element::Type precisionBeforeDequantization2, - const DequantizationOperations& dequantization2) { +std::shared_ptr MatMulFunction::getOriginal(const ov::element::Type netPrecision, + const ov::PartialShape& inputShape1, + const ov::element::Type precisionBeforeDequantization1, + const DequantizationOperations& dequantization1, + const ov::PartialShape& inputShape2, + const ov::element::Type precisionBeforeDequantization2, + const DequantizationOperations& dequantization2) { if (!dequantization1.convert.empty() && (precisionBeforeDequantization1 == dequantization1.convert.outPrecision)) { throw std::runtime_error("unexpected input arguments for branch 1"); } @@ -235,9 +234,10 @@ std::shared_ptr MatMulFunction::getReference( auto dequantization2Op = makeDequantization(input2, deqSructure2); std::shared_ptr matMul = std::make_shared>( - std::vector{ element::f32, element::f32 }, std::vector{ element::f32 }, - ov::op::TemporaryReplaceOutputType(dequantization1Op, element::f32).get(), - ov::op::TemporaryReplaceOutputType(dequantization2Op, element::f32).get(), + std::vector{ov::element::f32, ov::element::f32}, + std::vector{ov::element::f32}, + ov::op::TemporaryReplaceOutputType(dequantization1Op, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(dequantization2Op, ov::element::f32).get(), false, false); @@ -274,9 +274,10 @@ std::shared_ptr MatMulFunction::getReference( weights.values); const std::shared_ptr matMul = std::make_shared>( - std::vector{ element::f32, element::f32 }, std::vector{}, - ov::op::TemporaryReplaceOutputType(lastDequantizationBefore, element::f32).get(), - ov::op::TemporaryReplaceOutputType(weightsConst, element::f32).get(), + std::vector{ov::element::f32, ov::element::f32}, + std::vector{}, + ov::op::TemporaryReplaceOutputType(lastDequantizationBefore, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(weightsConst, ov::element::f32).get(), false, false); matMul->set_friendly_name("matMul"); diff --git a/src/tests/ov_helpers/ov_lpt_models/src/move_dequantization_after.cpp b/src/tests/ov_helpers/ov_lpt_models/src/move_dequantization_after.cpp index 15ca179c946..a15dbfe137c 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/move_dequantization_after.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/move_dequantization_after.cpp @@ -29,8 +29,8 @@ namespace subgraph { op::RoundingType::FLOOR); const auto targetOp = std::make_shared>( op, - std::vector{ element::f32, element::f32 }, - std::vector{}); + std::vector{ov::element::f32, ov::element::f32}, + std::vector{}); auto& rtInfo = targetOp->get_rt_info(); rtInfo["Variant::std::string"] = "targetOp"; @@ -58,8 +58,8 @@ namespace subgraph { op::RoundingType::FLOOR); const auto targetOp = std::make_shared>( op, - std::vector{ element::f32, element::f32 }, - std::vector{}); + std::vector{ov::element::f32, ov::element::f32}, + std::vector{}); ov::pass::low_precision::NetworkHelper::setOutDataPrecisionForTypeRelaxed(targetOp, precisionAfterOperation); auto& rtInfo = targetOp->get_rt_info(); rtInfo["Variant::std::string"] = "targetOp"; diff --git a/src/tests/ov_helpers/ov_lpt_models/src/move_fake_quantize.cpp b/src/tests/ov_helpers/ov_lpt_models/src/move_fake_quantize.cpp index a5dcbb85e7d..755416d6727 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/move_fake_quantize.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/move_fake_quantize.cpp @@ -54,10 +54,13 @@ std::shared_ptr MoveFakeQuantize::get( inputs[0] = std::make_shared(inputPrecision, newInputShape); inputs[0]->set_friendly_name("input"); - const auto axis_constant = std::make_shared(element::i32, Shape{}, std::vector({axis})); + const auto axis_constant = + std::make_shared(ov::element::i32, Shape{}, std::vector({axis})); std::vector split_lengths_values(inputShapes.size(), 1); split_lengths_values[split_lengths_values.size() - 1] = channels - (split_lengths_values.size() - 1); - const auto split_lengths = std::make_shared(element::i32, Shape{split_lengths_values.size()}, split_lengths_values); + const auto split_lengths = std::make_shared(ov::element::i32, + Shape{split_lengths_values.size()}, + split_lengths_values); const auto split = std::make_shared(inputs[0], axis_constant, split_lengths); for (size_t i = 0; i < concatInputsCount; i++) { // added unary op to avoid Split -> Concat pair elimination diff --git a/src/tests/ov_helpers/ov_lpt_models/src/multiply.cpp b/src/tests/ov_helpers/ov_lpt_models/src/multiply.cpp index b3807069326..3ee79e41fab 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/multiply.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/multiply.cpp @@ -34,8 +34,8 @@ BranchNodes makeBranch(const MultiplyBranch& branch) { branch.constant.values)); if (!branch.fake_quantize.empty()) { - if ((parent->get_output_element_type(0) != element::f32) && - (parent->get_output_element_type(0) != element::f16)) { + if ((parent->get_output_element_type(0) != ov::element::f32) && + (parent->get_output_element_type(0) != ov::element::f16)) { throw std::runtime_error("unexpected precision before FakeQuantize"); } parent = makeFakeQuantize(parent, parent->get_output_element_type(0), branch.fake_quantize); @@ -47,16 +47,17 @@ BranchNodes makeBranch(const MultiplyBranch& branch) { } } // namespace multiply_function -std::shared_ptr MultiplyFunction::get(const element::Type model_precision, const MultiplyValues& actualValues) { +std::shared_ptr MultiplyFunction::get(const ov::element::Type model_precision, + const MultiplyValues& actualValues) { const auto branchNodes1 = multiply_function::makeBranch(actualValues.branch1); const auto branchNodes2 = multiply_function::makeBranch(actualValues.branch2); // branchNodes1.dequantization & branchNodes2.dequantization can have different input types std::shared_ptr parent = std::make_shared>( - std::vector{ element::f32, element::f32 }, - std::vector{ actualValues.after_dequantization.empty() ? model_precision : element::f32 }, - ov::op::TemporaryReplaceOutputType(branchNodes1.dequantization, element::f32).get(), - ov::op::TemporaryReplaceOutputType(branchNodes2.dequantization, element::f32).get()); + std::vector{ov::element::f32, ov::element::f32}, + std::vector{actualValues.after_dequantization.empty() ? model_precision : ov::element::f32}, + ov::op::TemporaryReplaceOutputType(branchNodes1.dequantization, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(branchNodes2.dequantization, ov::element::f32).get()); auto& rtInfo = parent->get_rt_info(); rtInfo["Variant::std::string"] = "multiply"; diff --git a/src/tests/ov_helpers/ov_lpt_models/src/multiply_partial_function.cpp b/src/tests/ov_helpers/ov_lpt_models/src/multiply_partial_function.cpp index d899d73bfd6..e9dbee779ee 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/multiply_partial_function.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/multiply_partial_function.cpp @@ -40,9 +40,8 @@ BranchNodes getBranch(const MultiplyPartialBranch& branch) { } } // namespace multiply_partial_function -std::shared_ptr MultiplyPartialFunction::get( - const element::Type precision, - const MultiplyPartialValues& actualValues) { +std::shared_ptr MultiplyPartialFunction::get(const ov::element::Type precision, + const MultiplyPartialValues& actualValues) { auto branch1Structure = actualValues.branch1; branch1Structure.precisionBeforeDequantization = precision; branch1Structure.dequantization.multiply.outPrecision = precision; @@ -53,14 +52,14 @@ std::shared_ptr MultiplyPartialFunction::get( const auto branchNodes1 = multiply_partial_function::getBranch(actualValues.branch1); const auto branchNodes2 = multiply_partial_function::getBranch(actualValues.branch2); - auto multiplyOriginal = ov::opset1::Multiply( - ov::op::TemporaryReplaceOutputType(branchNodes1.dequantization, element::f32).get(), - ov::op::TemporaryReplaceOutputType(branchNodes2.dequantization, element::f32).get()); + auto multiplyOriginal = + ov::opset1::Multiply(ov::op::TemporaryReplaceOutputType(branchNodes1.dequantization, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(branchNodes2.dequantization, ov::element::f32).get()); const std::shared_ptr multiply = std::make_shared>( multiplyOriginal, - std::vector{element::f32, element::f32}, - std::vector{precision}); + std::vector{ov::element::f32, ov::element::f32}, + std::vector{precision}); auto& rtInfo = multiply->get_rt_info(); rtInfo["Variant::std::string"] = "multiply"; multiply->set_friendly_name("output"); @@ -114,9 +113,10 @@ std::shared_ptr MultiplyPartialFunction::get( fakeQuantize1->set_friendly_name("fakeQuantize1"); } - const std::shared_ptr input2 = secondInputIsConstant ? - ov::test::utils::deprecated::make_constant(element::f32, Shape{}, std::vector{0.5f}, false) : - std::make_shared(precision, inputShape2); + const std::shared_ptr input2 = + secondInputIsConstant + ? ov::test::utils::deprecated::make_constant(ov::element::f32, Shape{}, std::vector{0.5f}, false) + : std::make_shared(precision, inputShape2); const auto fakeQuantize2 = fq2.empty() ? nullptr : ov::test::utils::make_fake_quantize( diff --git a/src/tests/ov_helpers/ov_lpt_models/src/multiply_to_group_convolution.cpp b/src/tests/ov_helpers/ov_lpt_models/src/multiply_to_group_convolution.cpp index ae367c01cb7..958ce5ba480 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/multiply_to_group_convolution.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/multiply_to_group_convolution.cpp @@ -78,10 +78,10 @@ std::shared_ptr MultiplyToGroupConvolutionFunction::getReference( ov::Strides dilations(spatialDimsSize, 1ul); const auto gconv = std::make_shared>( - std::vector{ element::f32, element::f32 }, - std::vector{ element::f32 }, - ov::op::TemporaryReplaceOutputType(input, element::f32).get(), - ov::op::TemporaryReplaceOutputType(weights, element::f32).get(), + std::vector{ov::element::f32, ov::element::f32}, + std::vector{ov::element::f32}, + ov::op::TemporaryReplaceOutputType(input, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(weights, ov::element::f32).get(), strides, pads, pads, diff --git a/src/tests/ov_helpers/ov_lpt_models/src/mvn.cpp b/src/tests/ov_helpers/ov_lpt_models/src/mvn.cpp index 31acca679ad..885fea1a35e 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/mvn.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/mvn.cpp @@ -13,7 +13,7 @@ namespace builder { namespace subgraph { std::shared_ptr MVNFunction::getOriginal( - const element::Type precision, + const ov::element::Type precision, const ov::PartialShape& inputShape, const AxisSet& reductionAxes, const bool& normalizeVariance, @@ -28,12 +28,13 @@ std::shared_ptr MVNFunction::getOriginal( if (opset_version == 2) { mvn = std::make_shared(dequantizationOp, reductionAxes, normalizeVariance); } else if (opset_version == 6) { - mvn = std::make_shared( - dequantizationOp, - std::make_shared(element::i64, Shape{reductionAxes.size()}, reductionAxes.to_vector()), - normalizeVariance, - 1e-9, - ov::op::MVNEpsMode::INSIDE_SQRT); + mvn = std::make_shared(dequantizationOp, + std::make_shared(ov::element::i64, + Shape{reductionAxes.size()}, + reductionAxes.to_vector()), + normalizeVariance, + 1e-9, + ov::op::MVNEpsMode::INSIDE_SQRT); } mvn->set_friendly_name("output"); auto& rtInfo = mvn->get_rt_info(); @@ -61,7 +62,7 @@ std::shared_ptr MVNFunction::getOriginal( } std::shared_ptr MVNFunction::getReference( - const element::Type precision, + const ov::element::Type precision, const ov::PartialShape& inputShape, const AxisSet& reductionAxes, const bool& normalizeVariance, @@ -79,15 +80,17 @@ std::shared_ptr MVNFunction::getReference( if (opset_version == 2) { mvn = std::make_shared>( ov::op::v0::MVN(dequantizationOpBefore, reductionAxes, normalizeVariance), - dequantizationAfter.empty() ? precision : element::f32); + dequantizationAfter.empty() ? precision : ov::element::f32); } else if (opset_version == 6) { mvn = std::make_shared>( ov::op::v6::MVN(dequantizationOpBefore, - std::make_shared(element::i64, Shape{reductionAxes.size()}, reductionAxes.to_vector()), - normalizeVariance, - 1e-9, - ov::op::MVNEpsMode::INSIDE_SQRT), - dequantizationAfter.empty() ? precision : element::f32); + std::make_shared(ov::element::i64, + Shape{reductionAxes.size()}, + reductionAxes.to_vector()), + normalizeVariance, + 1e-9, + ov::op::MVNEpsMode::INSIDE_SQRT), + dequantizationAfter.empty() ? precision : ov::element::f32); } auto& rtInfo = mvn->get_rt_info(); rtInfo["Variant::std::string"] = "mvn"; diff --git a/src/tests/ov_helpers/ov_lpt_models/src/normalize_dequantization.cpp b/src/tests/ov_helpers/ov_lpt_models/src/normalize_dequantization.cpp index a394f3b26f6..498174f6455 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/normalize_dequantization.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/normalize_dequantization.cpp @@ -28,8 +28,8 @@ namespace subgraph { op::RoundingType::FLOOR); const auto targetOp = std::make_shared>( op, - std::vector{ element::f32, element::f32 }, - std::vector{}); + std::vector{ov::element::f32, ov::element::f32}, + std::vector{}); auto& rtInfo = targetOp->get_rt_info(); rtInfo["Variant::std::string"] = "targetOp"; diff --git a/src/tests/ov_helpers/ov_lpt_models/src/normalize_l2.cpp b/src/tests/ov_helpers/ov_lpt_models/src/normalize_l2.cpp index cbb60a9c7c9..39acc8b444a 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/normalize_l2.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/normalize_l2.cpp @@ -106,9 +106,9 @@ std::shared_ptr NormalizeL2Function::getReference( const auto axesNode = std::make_shared(ov::element::i64, ov::Shape{ axes.size() }, axes); const auto normalizeL2 = std::make_shared>( - std::vector{ element::f32, axesNode->output(0).get_element_type() }, - std::vector{dequantizationAfter.empty() ? precision : element::f32}, - ov::op::TemporaryReplaceOutputType(deqBefore, element::f32).get(), + std::vector{ov::element::f32, axesNode->output(0).get_element_type()}, + std::vector{dequantizationAfter.empty() ? precision : ov::element::f32}, + ov::op::TemporaryReplaceOutputType(deqBefore, ov::element::f32).get(), axesNode, 1e-6, epsMode); diff --git a/src/tests/ov_helpers/ov_lpt_models/src/pad.cpp b/src/tests/ov_helpers/ov_lpt_models/src/pad.cpp index 5b93ae73743..72972ba3bb8 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/pad.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/pad.cpp @@ -13,29 +13,31 @@ namespace ov { namespace builder { namespace subgraph { -std::shared_ptr PadFunction::get( - const PartialShape& inputShape, - const element::Type precisionBeforeDequantization, - const builder::subgraph::DequantizationOperations& dequantizationBefore, - const std::vector& padsBegin, - const std::vector& padsEnd, - const op::PadMode mode, - const float padValue, - const element::Type precisionAfterOperation, - const builder::subgraph::DequantizationOperations& dequantizationAfter) { +std::shared_ptr PadFunction::get(const PartialShape& inputShape, + const ov::element::Type precisionBeforeDequantization, + const builder::subgraph::DequantizationOperations& dequantizationBefore, + const std::vector& padsBegin, + const std::vector& padsEnd, + const op::PadMode mode, + const float padValue, + const ov::element::Type precisionAfterOperation, + const builder::subgraph::DequantizationOperations& dequantizationAfter) { const auto input = std::make_shared(precisionBeforeDequantization, inputShape); const auto deqBefore = makeDequantization(input, dequantizationBefore); - const auto padsBeginConst = ov::opset1::Constant::create(element::i64, Shape{ padsBegin.size() }, padsBegin); - const auto padsEndConst = ov::opset1::Constant::create(element::i64, Shape{ padsEnd.size() }, padsEnd); + const auto padsBeginConst = ov::opset1::Constant::create(ov::element::i64, Shape{padsBegin.size()}, padsBegin); + const auto padsEndConst = ov::opset1::Constant::create(ov::element::i64, Shape{padsEnd.size()}, padsEnd); const auto padsValueConst = ov::opset1::Constant::create(deqBefore->get_output_element_type(0), Shape{}, { padValue }); const auto pad = std::make_shared>( - std::vector{ precisionAfterOperation, element::u64, element::u64, precisionAfterOperation}, - std::vector{ precisionAfterOperation }, + std::vector{precisionAfterOperation, + ov::element::u64, + ov::element::u64, + precisionAfterOperation}, + std::vector{precisionAfterOperation}, ov::op::TemporaryReplaceOutputType(deqBefore, precisionAfterOperation).get(), - ov::op::TemporaryReplaceOutputType(padsBeginConst, element::i64).get(), - ov::op::TemporaryReplaceOutputType(padsEndConst, element::i64).get(), + ov::op::TemporaryReplaceOutputType(padsBeginConst, ov::element::i64).get(), + ov::op::TemporaryReplaceOutputType(padsEndConst, ov::element::i64).get(), ov::op::TemporaryReplaceOutputType(padsValueConst, precisionAfterOperation).get(), mode); @@ -49,19 +51,18 @@ std::shared_ptr PadFunction::get( return function; } -std::shared_ptr PadFunction::get( - const PartialShape& inputShape, - const element::Type inputPrecision, - const builder::subgraph::FakeQuantizeOnData& fakeQuantize, - const std::vector& padsBegin, - const std::vector& padsEnd, - const op::PadMode mode, - const float padValue) { +std::shared_ptr PadFunction::get(const PartialShape& inputShape, + const ov::element::Type inputPrecision, + const builder::subgraph::FakeQuantizeOnData& fakeQuantize, + const std::vector& padsBegin, + const std::vector& padsEnd, + const op::PadMode mode, + const float padValue) { const auto input = std::make_shared(inputPrecision, inputShape); const auto fqOnData = makeFakeQuantize(input, inputPrecision, fakeQuantize); - const auto padsBeginConst = ov::opset1::Constant::create(element::i64, Shape{ padsBegin.size() }, padsBegin); - const auto padsEndConst = ov::opset1::Constant::create(element::i64, Shape{ padsEnd.size() }, padsEnd); + const auto padsBeginConst = ov::opset1::Constant::create(ov::element::i64, Shape{padsBegin.size()}, padsBegin); + const auto padsEndConst = ov::opset1::Constant::create(ov::element::i64, Shape{padsEnd.size()}, padsEnd); const auto padsValueConst = ov::opset1::Constant::create(inputPrecision, Shape{}, { padValue }); const auto pad = std::make_shared(fqOnData, padsBeginConst, padsEndConst, padsValueConst, mode); pad->set_friendly_name("Pad"); diff --git a/src/tests/ov_helpers/ov_lpt_models/src/precision_propagation.cpp b/src/tests/ov_helpers/ov_lpt_models/src/precision_propagation.cpp index 7db40bc3612..20ab785a7cc 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/precision_propagation.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/precision_propagation.cpp @@ -123,10 +123,12 @@ std::shared_ptr PrecisionPropagationFunction::getOriginalWithNeighbor const size_t inputChannels = 6ul; const auto shape = Shape{ outputChannels, inputChannels, 1, 1 }; const auto fakeQuantizeOnWeights = ov::test::utils::make_fake_quantize( - std::make_shared(element::f32, shape, std::vector(ov::shape_size(shape), 1.f)), + std::make_shared(ov::element::f32, + shape, + std::vector(ov::shape_size(shape), 1.f)), precision, 255, - { outputChannels, 1, 1, 1 }, + {outputChannels, 1, 1, 1}, std::vector(outputChannels, -1.27f), std::vector(outputChannels, 1.27f), std::vector(outputChannels, -1.27f), @@ -233,21 +235,24 @@ std::shared_ptr PrecisionPropagationFunction::getReferenceWithNeighbo { const auto shape = Shape{ 1, inputChannels, 1, 1 }; - std::shared_ptr subtractConst = std::make_shared( - element::u8, - shape, - std::vector(ov::shape_size(shape), 128.f)); + std::shared_ptr subtractConst = + std::make_shared(ov::element::u8, + shape, + std::vector(ov::shape_size(shape), 128.f)); auto subtract = std::make_shared>( - std::vector{element::f32, element::f32}, - std::vector{ element::f32 }, - ov::op::TemporaryReplaceOutputType(result2, element::f32).get(), - ov::op::TemporaryReplaceOutputType(subtractConst, element::f32).get()); + std::vector{ov::element::f32, ov::element::f32}, + std::vector{ov::element::f32}, + ov::op::TemporaryReplaceOutputType(result2, ov::element::f32).get(), + ov::op::TemporaryReplaceOutputType(subtractConst, ov::element::f32).get()); result2 = subtract; } const auto shape = Shape{ outputChannels, inputChannels, 1, 1 }; - const auto fakeQuantizeOnWeights = std::make_shared(element::i8, shape, std::vector(ov::shape_size(shape), 100.f)); + const auto fakeQuantizeOnWeights = + std::make_shared(ov::element::i8, + shape, + std::vector(ov::shape_size(shape), 100.f)); fakeQuantizeOnWeights->set_friendly_name("fakeQuantizeOnWeights"); result2 = std::make_shared( diff --git a/src/tests/ov_helpers/ov_lpt_models/src/recurrent_cell.cpp b/src/tests/ov_helpers/ov_lpt_models/src/recurrent_cell.cpp index 9cf14450b1d..dd04f421287 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/recurrent_cell.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/recurrent_cell.cpp @@ -70,7 +70,7 @@ std::shared_ptr RecurrentCellFunction::get( dequantizations[3]); auto B = ov::opset1::Constant::create(inputPrecision, inputWeightsShapes[2], {1}); auto max_seq_length = inputActivationsShapes[0][1].get_max_length(); - auto seq_lengths = ov::opset1::Constant::create(element::i32, Shape{1}, {max_seq_length}); + auto seq_lengths = ov::opset1::Constant::create(ov::element::i32, Shape{1}, {max_seq_length}); std::shared_ptr rnn_layer; switch (type) { diff --git a/src/tests/ov_helpers/ov_lpt_models/src/reshape.cpp b/src/tests/ov_helpers/ov_lpt_models/src/reshape.cpp index 8dc6785a083..cb2e9dc9be5 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/reshape.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/reshape.cpp @@ -22,7 +22,8 @@ std::shared_ptr ReshapeFunction::getOriginal( std::shared_ptr reshape_pattern; if (!reshapeConstValues.empty()) { - reshape_pattern = ov::opset1::Constant::create(element::i64, Shape{ reshapeConstValues.size() }, reshapeConstValues); + reshape_pattern = + ov::opset1::Constant::create(ov::element::i64, Shape{reshapeConstValues.size()}, reshapeConstValues); } else { reshape_pattern = std::make_shared(dequantizationOp); } @@ -67,7 +68,8 @@ std::shared_ptr ReshapeFunction::getReference( std::shared_ptr reshape_pattern; if (!reshapeConstValues.empty()) { - reshape_pattern = ov::opset1::Constant::create(element::i64, Shape{ reshapeConstValues.size() }, reshapeConstValues); + reshape_pattern = + ov::opset1::Constant::create(ov::element::i64, Shape{reshapeConstValues.size()}, reshapeConstValues); } else { reshape_pattern = makeDequantization(quantizationOpBefore, dequantizationAfter); reshape_pattern = std::make_shared(reshape_pattern); diff --git a/src/tests/ov_helpers/ov_lpt_models/src/shuffle_channels.cpp b/src/tests/ov_helpers/ov_lpt_models/src/shuffle_channels.cpp index e4c9843e32a..6baebfc4ebc 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/shuffle_channels.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/shuffle_channels.cpp @@ -13,7 +13,7 @@ namespace ov { namespace builder { namespace subgraph { std::shared_ptr ShuffleChannelsFunction::getOriginal( - const element::Type inputPrecision, + const ov::element::Type inputPrecision, const PartialShape& inputShape, const builder::subgraph::DequantizationOperations& deqBefore, const std::int64_t axis, diff --git a/src/tests/ov_helpers/ov_lpt_models/src/split.cpp b/src/tests/ov_helpers/ov_lpt_models/src/split.cpp index dac97be92d2..96c16091c1a 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/split.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/split.cpp @@ -16,7 +16,7 @@ namespace ov { namespace builder { namespace subgraph { std::shared_ptr SplitFunction::getOriginal( - const element::Type& precision, + const ov::element::Type& precision, const ov::PartialShape& inputShape, const ov::element::Type precisionBeforeDequantization, const ov::builder::subgraph::DequantizationOperations& dequantization, @@ -27,7 +27,7 @@ std::shared_ptr SplitFunction::getOriginal( auto dequantizationStructure = dequantization; dequantizationStructure.multiply.outPrecision = precision; const auto dequantizationOp = makeDequantization(input, dequantization); - const auto constant = std::make_shared(element::i64, Shape{ }, splitedAxis); + const auto constant = std::make_shared(ov::element::i64, Shape{ }, splitedAxis); const auto split = std::make_shared(dequantizationOp, constant, numSplits); ov::ResultVector results; @@ -55,7 +55,7 @@ std::shared_ptr SplitFunction::getOriginal( fakeQuantize.outputLowValues, fakeQuantize.outputHighValues); - auto constant = std::make_shared(element::i64, Shape{ }, splitedAxis); + auto constant = std::make_shared(ov::element::i64, Shape{ }, splitedAxis); const std::shared_ptr split = std::make_shared(fq, constant, numSplit); ov::ResultVector results; @@ -66,7 +66,7 @@ std::shared_ptr SplitFunction::getOriginal( } std::shared_ptr SplitFunction::getReference( - const element::Type& precision, + const ov::element::Type& precision, const ov::PartialShape& inputShape, const ov::element::Type inputPrecision, const ov::builder::subgraph::DequantizationOperations& dequantizationBefore, @@ -77,7 +77,7 @@ std::shared_ptr SplitFunction::getReference( const auto input = std::make_shared(inputPrecision, inputShape); const auto deqBefore = makeDequantization(input, dequantizationBefore); - const auto constant = std::make_shared(element::i64, Shape{ }, splitedAxis); + const auto constant = std::make_shared(ov::element::i64, Shape{ }, splitedAxis); const auto split = std::make_shared(deqBefore, constant, numSplit); ov::ResultVector results; diff --git a/src/tests/ov_helpers/ov_lpt_models/src/squeeze.cpp b/src/tests/ov_helpers/ov_lpt_models/src/squeeze.cpp index 089e8ca90e1..2717cc6ce77 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/squeeze.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/squeeze.cpp @@ -23,7 +23,7 @@ std::shared_ptr SqueezeFunction::getOriginal( const auto squeeze = std::make_shared( dequantizationOp, - std::make_shared(element::i64, Shape{ axes.size() }, axes)); + std::make_shared(ov::element::i64, Shape{axes.size()}, axes)); squeeze->set_friendly_name("output"); @@ -46,7 +46,7 @@ std::shared_ptr SqueezeFunction::getOriginal( const std::shared_ptr squeeze = std::make_shared( fakeQuantize == nullptr ? input : fakeQuantize, - std::make_shared(element::i64, Shape{ axes.size() }, axes)); + std::make_shared(ov::element::i64, Shape{axes.size()}, axes)); ov::ResultVector results{ std::make_shared(squeeze) }; return std::make_shared(results, ov::ParameterVector{ input }, "SqueezeTransformation"); @@ -63,7 +63,8 @@ std::shared_ptr SqueezeFunction::getReference( const std::shared_ptr dequantizationOpBefore = makeDequantization(input, dequantizationBefore); const auto squeeze = std::make_shared>( - ov::opset1::Squeeze(dequantizationOpBefore, std::make_shared(element::i64, Shape{ axes.size() }, axes)), + ov::opset1::Squeeze(dequantizationOpBefore, + std::make_shared(ov::element::i64, Shape{axes.size()}, axes)), precisionAfterOperation); const std::shared_ptr dequantizationOpAfter = makeDequantization(squeeze, dequantizationAfter); dequantizationOpAfter->set_friendly_name("output"); diff --git a/src/tests/ov_helpers/ov_lpt_models/src/transformations_after_split.cpp b/src/tests/ov_helpers/ov_lpt_models/src/transformations_after_split.cpp index 46912596203..3dfe0725779 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/transformations_after_split.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/transformations_after_split.cpp @@ -17,11 +17,11 @@ namespace builder { namespace subgraph { std::shared_ptr TransformationsAfterSplitFunction::get(const std::string transformationName) { - const auto input = std::make_shared(element::u8, Shape{ 1, 9, 16, 16 }); + const auto input = std::make_shared(ov::element::u8, Shape{1, 9, 16, 16}); const size_t outputSize = 2ul; - const auto axis = ov::opset1::Constant::create(element::i64, Shape{}, { 2 }); - const auto splitLength = ov::opset1::Constant::create(element::i64, Shape{ outputSize }, { 8, 8 }); + const auto axis = ov::opset1::Constant::create(ov::element::i64, Shape{}, {2}); + const auto splitLength = ov::opset1::Constant::create(ov::element::i64, Shape{outputSize}, {8, 8}); const auto variadicSplit = std::make_shared(input, axis, splitLength); ResultVector results; @@ -43,16 +43,16 @@ std::shared_ptr TransformationsAfterSplitFunction::getLayerByTransformatio const ov::Output parent) { if (transformationName == "AddTransformationWithoutConcat") { const auto dequantization = makeDequantization(parent, { {}, {}, { 3.f } }); - const auto addConstant = ov::opset1::Constant::create(element::u8, Shape{}, { 128.f }); + const auto addConstant = ov::opset1::Constant::create(ov::element::u8, Shape{}, {128.f}); return std::make_shared(dequantization, addConstant); } if (transformationName == "AddTransformationWithConcat") { - const auto dequantization = makeDequantization(parent, { {element::f32}, {}, { 0.1f } }); - const auto addConstant = ov::opset1::Constant::create(element::f32, Shape{}, { 128.f }); + const auto dequantization = makeDequantization(parent, {{ov::element::f32}, {}, {0.1f}}); + const auto addConstant = ov::opset1::Constant::create(ov::element::f32, Shape{}, {128.f}); return std::make_shared(dequantization, addConstant); } if (transformationName == "AvgPoolTransformation") { - const auto dequantization = makeDequantization(parent, { {element::f32}, {}, { 0.1f } }); + const auto dequantization = makeDequantization(parent, {{ov::element::f32}, {}, {0.1f}}); return std::make_shared( dequantization, Strides{ 1, 1 }, @@ -63,13 +63,13 @@ std::shared_ptr TransformationsAfterSplitFunction::getLayerByTransformatio op::RoundingType::FLOOR); } if (transformationName == "ClampTransformation") { - const auto dequantization = makeDequantization(parent, { {element::f32}, {}, { 0.1f } }); + const auto dequantization = makeDequantization(parent, {{ov::element::f32}, {}, {0.1f}}); return std::make_shared(dequantization, 0.0, 6.0); } if (transformationName == "ConvolutionTransformation") { - const auto dequantizationOnData = makeDequantization(parent, { {element::f32}, {}, { 0.1f } }); - const auto weights = ov::opset1::Constant::create(element::i8, Shape{ 3, 9, 1, 1 }, { 2 }); - const auto dequantizationOnWeights = makeDequantization(weights, { {element::f32}, {}, {0.3f} }); + const auto dequantizationOnData = makeDequantization(parent, {{ov::element::f32}, {}, {0.1f}}); + const auto weights = ov::opset1::Constant::create(ov::element::i8, Shape{3, 9, 1, 1}, {2}); + const auto dequantizationOnWeights = makeDequantization(weights, {{ov::element::f32}, {}, {0.3f}}); return std::make_shared( dequantizationOnData, dequantizationOnWeights, @@ -79,9 +79,9 @@ std::shared_ptr TransformationsAfterSplitFunction::getLayerByTransformatio Strides{ 1, 1 }); } if (transformationName == "AsymmetricConvolutionTransformation") { - const auto dequantizationOnData = makeDequantization(parent, { {element::f32}, { 128.f }, { 0.1f } }); - const auto weights = ov::opset1::Constant::create(element::i8, Shape{ 3, 9, 1, 1 }, { 2 }); - const auto dequantizationOnWeights = makeDequantization(weights, { {element::f32}, {}, {0.3f} }); + const auto dequantizationOnData = makeDequantization(parent, {{ov::element::f32}, {128.f}, {0.1f}}); + const auto weights = ov::opset1::Constant::create(ov::element::i8, Shape{3, 9, 1, 1}, {2}); + const auto dequantizationOnWeights = makeDequantization(weights, {{ov::element::f32}, {}, {0.3f}}); return std::make_shared( dequantizationOnData, dequantizationOnWeights, @@ -91,16 +91,16 @@ std::shared_ptr TransformationsAfterSplitFunction::getLayerByTransformatio Strides{ 1, 1 }); } if (transformationName == "DepthToSpaceTransformation") { - const auto dequantization = makeDequantization(parent, { {element::f32}, {}, { 0.1f } }); + const auto dequantization = makeDequantization(parent, {{ov::element::f32}, {}, {0.1f}}); return std::make_shared(dequantization, ov::opset1::DepthToSpace::DepthToSpaceMode::BLOCKS_FIRST, 3); } if (transformationName == "FakeQuantizeTransformation") { - const auto dequantization = makeDequantization(parent, { {element::f32}, {}, { 0.1f } }); - return makeFakeQuantize(dequantization, element::f32, { 256, Shape{}, { 0.f }, { 255.f }, { 0.f }, { 127.f } }); + const auto dequantization = makeDequantization(parent, {{ov::element::f32}, {}, {0.1f}}); + return makeFakeQuantize(dequantization, ov::element::f32, {256, Shape{}, {0.f}, {255.f}, {0.f}, {127.f}}); } if (transformationName == "InterpolateTransformation") { - const auto dequantization = makeDequantization(parent, { {element::f32}, {}, { 0.1f } }); - const auto outShape = ov::opset1::Constant::create(element::i64, Shape{ 4 }, { 1, 4, 32, 32 }); + const auto dequantization = makeDequantization(parent, {{ov::element::f32}, {}, {0.1f}}); + const auto outShape = ov::opset1::Constant::create(ov::element::i64, Shape{4}, {1, 4, 32, 32}); ov::op::v0::Interpolate::Attributes attributes; attributes.axes = AxisSet{ 2, 3 }; @@ -113,13 +113,13 @@ std::shared_ptr TransformationsAfterSplitFunction::getLayerByTransformatio return std::make_shared(dequantization, outShape, attributes); } if (transformationName == "MatMulTransformation") { - const auto dequantizationOnData = makeDequantization(parent, { {element::f32}, {}, { 0.1f } }); - const auto weights = ov::opset1::Constant::create(element::i8, Shape{ 16, 16 }, { 2 }); - const auto dequantizationOnWeights = makeDequantization(weights, { {element::f32}, {}, { 0.3f } }); + const auto dequantizationOnData = makeDequantization(parent, {{ov::element::f32}, {}, {0.1f}}); + const auto weights = ov::opset1::Constant::create(ov::element::i8, Shape{16, 16}, {2}); + const auto dequantizationOnWeights = makeDequantization(weights, {{ov::element::f32}, {}, {0.3f}}); return std::make_shared(dequantizationOnData, dequantizationOnWeights); } if (transformationName == "MaxPoolTransformation") { - const auto dequantization = makeDequantization(parent, { {element::f32}, {}, { 0.1f } }); + const auto dequantization = makeDequantization(parent, {{ov::element::f32}, {}, {0.1f}}); return std::make_shared( dequantization, Strides{ 1, 1 }, @@ -128,75 +128,77 @@ std::shared_ptr TransformationsAfterSplitFunction::getLayerByTransformatio Shape{ 2, 2 }); } if (transformationName == "MultiplyTransformation") { - const auto dequantization = makeDequantization(parent, { {}, {}, {{ 2.f }, element::f32, {}} }); + const auto dequantization = makeDequantization(parent, {{}, {}, {{2.f}, ov::element::f32, {}}}); return makeDequantization(dequantization, { {}, {}, { 0.2f } }); } if (transformationName == "MVNTransformation") { - const auto dequantization = makeDequantization(parent, { {element::f32}, {}, { 0.1f } }); + const auto dequantization = makeDequantization(parent, {{ov::element::f32}, {}, {0.1f}}); return std::make_shared(dequantization, AxisSet{ 2, 3 }); } if (transformationName == "NormalizeL2Transformation") { - const auto dequantization = makeDequantization(parent, { {element::f32}, {}, { 0.1f } }); - const auto axesNode = ov::opset1::Constant::create(element::i64, ov::Shape{ 3 }, { 1, 2, 3 }); + const auto dequantization = makeDequantization(parent, {{ov::element::f32}, {}, {0.1f}}); + const auto axesNode = ov::opset1::Constant::create(ov::element::i64, ov::Shape{3}, {1, 2, 3}); return std::make_shared(dequantization, axesNode, 1e-6, ov::op::EpsMode::ADD); } if (transformationName == "PReluTransformation") { - const auto dequantization = makeDequantization(parent, { {element::f32}, {}, { 0.1f } }); - const auto slope = std::make_shared(element::f32, Shape{}, std::vector { 0.1f }); + const auto dequantization = makeDequantization(parent, {{ov::element::f32}, {}, {0.1f}}); + const auto slope = std::make_shared(ov::element::f32, Shape{}, std::vector{0.1f}); return std::make_shared(dequantization, slope); } if (transformationName == "ReluTransformation") { - const auto dequantization = makeDequantization(parent, { {element::f32}, {}, { 0.1f } }); + const auto dequantization = makeDequantization(parent, {{ov::element::f32}, {}, {0.1f}}); return std::make_shared(dequantization); } if (transformationName == "ReshapeTransformation") { - const auto dequantization = makeDequantization(parent, { {element::f32}, {}, { 0.1f } }); - const auto reshapeConst = ov::opset1::Constant::create(element::i64, ov::Shape{ 3 }, { 1, 3, -1 }); + const auto dequantization = makeDequantization(parent, {{ov::element::f32}, {}, {0.1f}}); + const auto reshapeConst = ov::opset1::Constant::create(ov::element::i64, ov::Shape{3}, {1, 3, -1}); return std::make_shared(dequantization, reshapeConst, false); } if (transformationName == "SqueezeTransformation") { - const auto dequantization = makeDequantization(parent, { {element::f32}, {}, { 0.1f } }); - const auto squeezeConst = ov::opset1::Constant::create(element::i64, ov::Shape{ 1 }, { 0 }); + const auto dequantization = makeDequantization(parent, {{ov::element::f32}, {}, {0.1f}}); + const auto squeezeConst = ov::opset1::Constant::create(ov::element::i64, ov::Shape{1}, {0}); return std::make_shared(dequantization, squeezeConst); } if (transformationName == "StridedSliceTransformation") { - const auto dequantization = makeDequantization(parent, { {element::f32}, {}, { 0.1f } }); + const auto dequantization = makeDequantization(parent, {{ov::element::f32}, {}, {0.1f}}); std::vector mask{ 1, 0, 1, 1 }; - const auto beginParam = ov::opset1::Constant::create(element::i64, Shape{ 4 }, { 0, 0, 0, 0 }); - const auto endParam = ov::opset1::Constant::create(element::i64, Shape{ 4 }, { 1, 2, 1, 1 }); - const auto stridesParam = ov::opset1::Constant::create(element::i64, Shape{ 4 }, { 1, 1, 1, 1 }); + const auto beginParam = ov::opset1::Constant::create(ov::element::i64, Shape{4}, {0, 0, 0, 0}); + const auto endParam = ov::opset1::Constant::create(ov::element::i64, Shape{4}, {1, 2, 1, 1}); + const auto stridesParam = ov::opset1::Constant::create(ov::element::i64, Shape{4}, {1, 1, 1, 1}); return std::make_shared(dequantization, beginParam, endParam, stridesParam, mask, mask); } if (transformationName == "TransposeTransformation") { - const auto dequantization = makeDequantization(parent, { {element::f32}, {}, { 0.1f } }); - const auto transposeConstant = ov::opset1::Constant::create(element::i64, Shape{ 4 }, { 0, 1, 3, 2 }); + const auto dequantization = makeDequantization(parent, {{ov::element::f32}, {}, {0.1f}}); + const auto transposeConstant = ov::opset1::Constant::create(ov::element::i64, Shape{4}, {0, 1, 3, 2}); return std::make_shared(dequantization, transposeConstant); } if (transformationName == "UnsqueezeTransformation") { - const auto dequantization = makeDequantization(parent, { {element::f32}, {}, { 0.1f } }); - const auto unsqueezeConst = ov::opset1::Constant::create(element::i64, ov::Shape{ 1 }, { 0 }); + const auto dequantization = makeDequantization(parent, {{ov::element::f32}, {}, {0.1f}}); + const auto unsqueezeConst = ov::opset1::Constant::create(ov::element::i64, ov::Shape{1}, {0}); return std::make_shared(dequantization, unsqueezeConst); } if (transformationName == "FuseConvertTransformation") { - return makeDequantization(parent, { {element::f32}, {}, { 0.1f } }); + return makeDequantization(parent, {{ov::element::f32}, {}, {0.1f}}); } if (transformationName == "FuseSubtractToFakeQuantizeTransformation") { // INT8 before FakeQuantize, all operations before FakeQuantize have been fused: need to have TypeRelaxed here - const auto fakeQuantize = makeFakeQuantizeTypeRelaxed(parent, element::f32, { 256, Shape{}, { 0.f }, { 255.f }, { 0.f }, { 127.f } }); - return makeDequantization(fakeQuantize, { {}, {{ 128.f }, element::f32, {}}, {} }); + const auto fakeQuantize = + makeFakeQuantizeTypeRelaxed(parent, ov::element::f32, {256, Shape{}, {0.f}, {255.f}, {0.f}, {127.f}}); + return makeDequantization(fakeQuantize, {{}, {{128.f}, ov::element::f32, {}}, {}}); } if (transformationName == "FuseMultiplyToFakeQuantizeTransformation") { // INT8 before FakeQuantize, all operations before FakeQuantize have been fused: need to have TypeRelaxed here - const auto fakeQuantize = makeFakeQuantizeTypeRelaxed(parent, element::f32, { 256, Shape{}, { 0.f }, { 255.f }, { 0.f }, { 127.f } }); - return makeDequantization(fakeQuantize, { {}, {}, {{ 2.f }, element::f32, {}} }); + const auto fakeQuantize = + makeFakeQuantizeTypeRelaxed(parent, ov::element::f32, {256, Shape{}, {0.f}, {255.f}, {0.f}, {127.f}}); + return makeDequantization(fakeQuantize, {{}, {}, {{2.f}, ov::element::f32, {}}}); } if (transformationName == "MultiplyToGroupConvolutionTransformation") { - return makeDequantization(parent, { {}, {{ 128.f }, element::f32, {}}, { 2.f } }); + return makeDequantization(parent, {{}, {{128.f}, ov::element::f32, {}}, {2.f}}); } if (transformationName == "SubtractMultiplyToMultiplyAddTransformation") { - return makeDequantization(parent, { {}, {{ 128.f }, element::f32, {}}, { 2.f } }); + return makeDequantization(parent, {{}, {{128.f}, ov::element::f32, {}}, {2.f}}); } throw std::runtime_error("unexpected additional layer name"); } diff --git a/src/tests/ov_helpers/ov_lpt_models/src/unsqueeze.cpp b/src/tests/ov_helpers/ov_lpt_models/src/unsqueeze.cpp index afac23e39f4..2b2d7a63b5c 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/unsqueeze.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/unsqueeze.cpp @@ -23,7 +23,7 @@ namespace subgraph { const auto unsqueeze = std::make_shared( dequantizationOp, - std::make_shared(element::i64, Shape{ axes.size() }, axes)); + std::make_shared(ov::element::i64, Shape{axes.size()}, axes)); unsqueeze->set_friendly_name("output"); @@ -46,7 +46,7 @@ std::shared_ptr UnsqueezeFunction::getOriginal( const std::shared_ptr unsqueeze = std::make_shared( fakeQuantize == nullptr ? input : fakeQuantize, - std::make_shared(element::i64, Shape{ axes.size() }, axes)); + std::make_shared(ov::element::i64, Shape{axes.size()}, axes)); ov::ResultVector results{ std::make_shared(unsqueeze) }; return std::make_shared(results, ov::ParameterVector{ input }, "UnsqueezeTransformation"); @@ -63,7 +63,8 @@ std::shared_ptr UnsqueezeFunction::getReference( const std::shared_ptr dequantizationOpBefore = makeDequantization(input, dequantizationBefore); const auto unsqueeze = std::make_shared>( - ov::op::v0::Unsqueeze(dequantizationOpBefore, std::make_shared(element::i64, Shape{ axes.size() }, axes)), + ov::op::v0::Unsqueeze(dequantizationOpBefore, + std::make_shared(ov::element::i64, Shape{axes.size()}, axes)), precisionAfterOperation); const std::shared_ptr dequantizationOpAfter = makeDequantization(unsqueeze, dequantizationAfter); dequantizationOpAfter->set_friendly_name("output"); diff --git a/src/tests/ov_helpers/ov_lpt_models/src/variadic_split.cpp b/src/tests/ov_helpers/ov_lpt_models/src/variadic_split.cpp index 2d99b8f6f04..82cdeb986d4 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/variadic_split.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/variadic_split.cpp @@ -23,8 +23,9 @@ namespace subgraph { const auto input = std::make_shared(precisionBeforeDequantization, inputShape); const std::shared_ptr dequantizationOp = makeDequantization(input, dequantization); - const auto constantAxis = std::make_shared(element::i64, Shape{ }, splitedAxis); - const auto constantLengths = std::make_shared(element::i64, Shape{ splitLengths.size() }, splitLengths); + const auto constantAxis = std::make_shared(ov::element::i64, Shape{}, splitedAxis); + const auto constantLengths = + std::make_shared(ov::element::i64, Shape{splitLengths.size()}, splitLengths); const std::shared_ptr variadicSplit = std::make_shared(dequantizationOp, constantAxis, constantLengths); ov::ResultVector results; @@ -53,8 +54,9 @@ std::shared_ptr VariadicSplitFunction::getOriginal( fakeQuantize.outputLowValues, fakeQuantize.outputHighValues); - const auto constantAxis = std::make_shared(element::i64, Shape{ }, splitedAxis); - const auto constantLengths = std::make_shared(element::i64, Shape{ splitLengths.size() }, splitLengths); + const auto constantAxis = std::make_shared(ov::element::i64, Shape{}, splitedAxis); + const auto constantLengths = + std::make_shared(ov::element::i64, Shape{splitLengths.size()}, splitLengths); const std::shared_ptr variadicSplit = std::make_shared(fakeQuantize.empty() ? input : fq, constantAxis, constantLengths); @@ -77,8 +79,9 @@ std::shared_ptr VariadicSplitFunction::getReference( const auto deqBefore = makeDequantization(input, dequantizationBefore); - const auto constantAxis = std::make_shared(element::i64, Shape{ }, splitedAxis); - const auto constantLengths = std::make_shared(element::i64, Shape{ splitLengths.size() }, splitLengths); + const auto constantAxis = std::make_shared(ov::element::i64, Shape{}, splitedAxis); + const auto constantLengths = + std::make_shared(ov::element::i64, Shape{splitLengths.size()}, splitLengths); const auto variadicSplit = std::make_shared(deqBefore, constantAxis, constantLengths); ov::ResultVector results; diff --git a/src/tests/ov_helpers/ov_models/include/ov_models/builders.hpp b/src/tests/ov_helpers/ov_models/include/ov_models/builders.hpp index 98d08578d66..aebba067958 100644 --- a/src/tests/ov_helpers/ov_models/include/ov_models/builders.hpp +++ b/src/tests/ov_helpers/ov_models/include/ov_models/builders.hpp @@ -68,12 +68,12 @@ std::shared_ptr makeConstant(const ov::element::Type& type, return weightsNode; } OPENVINO_DEPRECATED("This function is deprecated and will be removed soon.") -std::shared_ptr makeInputLayer(const element::Type& type, +std::shared_ptr makeInputLayer(const ov::element::Type& type, ov::test::utils::InputLayerType inputType, const std::vector& shape); std::shared_ptr makeConvolution(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, const std::vector& filterSize, const std::vector& strides, const std::vector& padsBegin, @@ -87,7 +87,7 @@ std::shared_ptr makeConvolution(const ov::Output& in, std::shared_ptr makeConvolution(const ov::Output& in_data, const ov::Output& in_weights, - const element::Type& type, + const ov::element::Type& type, const std::vector& filterSize, const std::vector& strides, const std::vector& padsBegin, @@ -99,7 +99,7 @@ std::shared_ptr makeConvolution(const ov::Output& in_data, const std::vector& biasesWeights = {}); std::shared_ptr makeGroupConvolution(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, const std::vector& filterSize, const std::vector& strides, const std::vector& padsBegin, @@ -114,7 +114,7 @@ std::shared_ptr makeGroupConvolution(const ov::Output& in, std::shared_ptr makeGroupConvolution(const ov::Output& in, const ov::Output& weights, - const element::Type& type, + const ov::element::Type& type, const std::vector& strides, const std::vector& padsBegin, const std::vector& padsEnd, @@ -124,7 +124,7 @@ std::shared_ptr makeGroupConvolution(const ov::Output& in, const std::vector& biasesWeights = {}); std::shared_ptr makeConvolutionBackpropData(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, const std::vector& filterSize, const std::vector& strides, const std::vector& padsBegin, @@ -139,7 +139,7 @@ std::shared_ptr makeConvolutionBackpropData(const ov::Output& in std::shared_ptr makeConvolutionBackpropData(const ov::Output& in, const ov::Output& weights, - const element::Type& type, + const ov::element::Type& type, const std::vector& strides, const std::vector& padsBegin, const std::vector& padsEnd, @@ -151,7 +151,7 @@ std::shared_ptr makeConvolutionBackpropData(const ov::Output& in std::shared_ptr makeConvolutionBackpropData(const ov::Output& in, const ov::Output& outputShape, - const element::Type& type, + const ov::element::Type& type, const std::vector& filterSize, const std::vector& strides, const std::vector& padsBegin, @@ -172,13 +172,13 @@ std::shared_ptr makeCTCGreedyDecoderSeqLen(const ov::Output& inp const ov::Output& sequenceLength, int blankIndex, bool mergeRepeated, - const element::Type& idxPrecision = element::i32); + const ov::element::Type& idxPrecision = ov::element::i32); OPENVINO_DEPRECATED("This function is deprecated and will be removed soon.") std::shared_ptr makeCTCGreedyDecoderSeqLen(const ov::Output& inputData, int blankIndex, bool mergeRepeated, - const element::Type& idxPrecision = element::i32); + const ov::element::Type& idxPrecision = ov::element::i32); OPENVINO_DEPRECATED("This function is deprecated and will be removed soon.") std::shared_ptr makeCTCLoss(const ov::Output& logitsNode, @@ -186,14 +186,14 @@ std::shared_ptr makeCTCLoss(const ov::Output& logitsNode, std::vector>& labels, std::vector& labelsLength, int blankIndex, - const element::Type& fType, - const element::Type& iType, + const ov::element::Type& fType, + const ov::element::Type& iType, const bool preprocessCollapseRepeated, const bool ctcMergeRepeated, const bool unique); std::shared_ptr makeGroupConvolutionBackpropData(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, const std::vector& filterSize, const std::vector& strides, const std::vector& padsBegin, @@ -209,7 +209,7 @@ std::shared_ptr makeGroupConvolutionBackpropData(const ov::Output makeGroupConvolutionBackpropData(const ov::Output& in, const ov::Output& weights, - const element::Type& type, + const ov::element::Type& type, const std::vector& strides, const std::vector& padsBegin, const std::vector& padsEnd, @@ -221,7 +221,7 @@ std::shared_ptr makeGroupConvolutionBackpropData(const ov::Output makeGroupConvolutionBackpropData(const ov::Output& in, const ov::Output& outputShape, - const element::Type& type, + const ov::element::Type& type, const std::vector& filterSize, const std::vector& strides, const std::vector& padsBegin, @@ -248,18 +248,18 @@ std::shared_ptr makeBinaryConvolution(const ov::Output& in, OPENVINO_DEPRECATED("This function is deprecated and will be removed soon.") std::shared_ptr makeSplit(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, size_t numSplits, int64_t axis); std::shared_ptr makeActivation(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, ov::test::utils::ActivationTypes activationType, std::vector inShape = {}, std::vector constantsValue = {}); std::shared_ptr makeActivation(const ov::ParameterVector& parameters, - const element::Type& type, + const ov::element::Type& type, ov::test::utils::ActivationTypes activationType); std::shared_ptr makeEltwise(const ov::Output& in0, @@ -268,14 +268,14 @@ std::shared_ptr makeEltwise(const ov::Output& in0, OPENVINO_DEPRECATED("This function is deprecated and will be removed soon.") std::shared_ptr makeBatchToSpace(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, const std::vector& blockShape, const std::vector& cropsBegin, const std::vector& cropsEnd); OPENVINO_DEPRECATED("This function is deprecated and will be removed soon.") std::shared_ptr makeSpaceToBatch(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, const std::vector& blockShape, const std::vector& padsBegin, const std::vector& padsEnd); @@ -286,7 +286,7 @@ std::shared_ptr makeSlice(const ov::Output& in, const std::vector& end, const std::vector& stride, const std::vector& axes, - const element::Type& type); + const ov::element::Type& type); OPENVINO_DEPRECATED("This function is deprecated and will be removed soon.") std::shared_ptr makeSlice(const ov::Output& in, @@ -319,7 +319,7 @@ std::shared_ptr makeMVN6(const ov::Output& in, OPENVINO_DEPRECATED("This function is deprecated and will be removed soon.") std::shared_ptr makeSqueezeUnsqueeze(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, const std::vector& squeeze_indices, ov::test::utils::SqueezeOpType opType); @@ -332,7 +332,7 @@ OPENVINO_DEPRECATED("This function is deprecated and will be removed soon.") std::shared_ptr makeProposal(const ov::Output& class_probs, const ov::Output& class_logits, const std::vector& image_info, - const element::Type& type, + const ov::element::Type& type, size_t base_size, size_t pre_nms_topn, size_t post_nms_topn, @@ -349,7 +349,7 @@ std::shared_ptr makeProposal(const ov::Output& class_probs, std::string framework); std::shared_ptr makeFakeQuantize(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, std::size_t levels, std::vector constShapes, const std::vector& inputLowData, @@ -358,13 +358,13 @@ std::shared_ptr makeFakeQuantize(const ov::Output& in, const std::vector& outputHighData); std::shared_ptr makeFakeQuantize(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, std::size_t levels, std::vector constShapes, const int32_t seed = 1); -std::shared_ptr makeEmbeddingBagOffsetsSum(const element::Type& dataType, - const element::Type& indicesType, +std::shared_ptr makeEmbeddingBagOffsetsSum(const ov::element::Type& dataType, + const ov::element::Type& indicesType, const ov::Output& emb_table_node, const std::vector& indices, const std::vector& offsets, @@ -372,8 +372,8 @@ std::shared_ptr makeEmbeddingBagOffsetsSum(const element::Type& dataTy bool with_weights, bool with_default_index); -std::shared_ptr makeEmbeddingSegmentsSum(const element::Type& dataType, - const element::Type& indicesType, +std::shared_ptr makeEmbeddingSegmentsSum(const ov::element::Type& dataType, + const ov::element::Type& indicesType, const ov::Output& emb_table_node, const std::vector& indices, const std::vector& segment_ids, @@ -409,7 +409,7 @@ std::shared_ptr makeLogical(const ov::Output& in0, std::shared_ptr makeLogical(const ov::ParameterVector& inputs, ov::test::utils::LogicalTypes logicalType); std::shared_ptr makeFullyConnected(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, const size_t outputSize, bool addBias = true, const ov::Shape& weightsShape = {}, @@ -464,12 +464,12 @@ std::shared_ptr makeRNN( std::shared_ptr makeGatherND(const ov::Output& dataNode, const ov::Shape& indicesShape, - const element::Type& indicesType, + const ov::element::Type& indicesType, const std::size_t batchDims); std::shared_ptr makeGatherND8(const ov::Output& dataNode, const ov::Shape& indicesShape, - const element::Type& indicesType, + const ov::element::Type& indicesType, const std::size_t batchDims); enum class NmsVersion { NmsVersion5, NmsVersion9 }; @@ -477,8 +477,8 @@ enum class NmsVersion { NmsVersion5, NmsVersion9 }; OPENVINO_DEPRECATED("This function is deprecated and will be removed soon.") std::shared_ptr makeNms(const ov::Output& boxes, const ov::Output& scores, - const element::Type& maxBoxesPrec, - const element::Type& thrPrec, + const ov::element::Type& maxBoxesPrec, + const ov::element::Type& thrPrec, const int32_t& maxOutBoxesPerClass, const float& iouThr, const float& scoreThr, diff --git a/src/tests/ov_helpers/ov_models/include/ov_models/pass/convert_prc.hpp b/src/tests/ov_helpers/ov_models/include/ov_models/pass/convert_prc.hpp index e1b753fd1d0..0bc2e4b0b04 100644 --- a/src/tests/ov_helpers/ov_models/include/ov_models/pass/convert_prc.hpp +++ b/src/tests/ov_helpers/ov_models/include/ov_models/pass/convert_prc.hpp @@ -23,7 +23,7 @@ template class ConvertConstantsPrecision : public ov::pass::MatcherPass { public: ConvertConstantsPrecision() { - auto constant = std::make_shared(element::f32, ov::Shape{1}, std::vector{0}); + auto constant = std::make_shared(ov::element::f32, ov::Shape{1}, std::vector{0}); ov::matcher_pass_callback callback = [](ov::pass::pattern::Matcher& m) { auto constant = std::dynamic_pointer_cast(m.get_match_root()); diff --git a/src/tests/ov_helpers/ov_models/include/ov_models/preprocess/preprocess_builders.hpp b/src/tests/ov_helpers/ov_models/include/ov_models/preprocess/preprocess_builders.hpp index 4dcb76c5c42..a5df7c797fd 100644 --- a/src/tests/ov_helpers/ov_models/include/ov_models/preprocess/preprocess_builders.hpp +++ b/src/tests/ov_helpers/ov_models/include/ov_models/preprocess/preprocess_builders.hpp @@ -38,7 +38,7 @@ inline std::vector generic_postprocess_functions(); /// -------- Functions --------------- -inline std::shared_ptr create_preprocess_1input(element::Type type, const PartialShape& shape) { +inline std::shared_ptr create_preprocess_1input(ov::element::Type type, const PartialShape& shape) { auto data1 = std::make_shared(type, shape); data1->set_friendly_name("input1"); data1->output(0).get_tensor().set_names({"input1"}); @@ -56,7 +56,7 @@ inline std::shared_ptr create_preprocess_1input(element::Type type, const return std::make_shared(ResultVector{res}, ParameterVector{data1}); } -inline std::shared_ptr create_preprocess_2inputs(element::Type type, const PartialShape& shape) { +inline std::shared_ptr create_preprocess_2inputs(ov::element::Type type, const PartialShape& shape) { auto data1 = std::make_shared(type, shape); data1->set_friendly_name("input1"); data1->output(0).get_tensor().set_names({"input1"}); @@ -83,8 +83,8 @@ inline std::shared_ptr create_preprocess_2inputs(element::Type type, cons } inline std::shared_ptr create_preprocess_2inputs_trivial() { - auto data1 = std::make_shared(element::f32, Shape{1, 3, 1, 1}); - auto data2 = std::make_shared(element::f32, Shape{1, 3, 1, 1}); + auto data1 = std::make_shared(ov::element::f32, Shape{1, 3, 1, 1}); + auto data2 = std::make_shared(ov::element::f32, Shape{1, 3, 1, 1}); data1->set_friendly_name("input1"); data1->output(0).get_tensor().set_names({"input1"}); @@ -100,7 +100,7 @@ inline std::shared_ptr create_preprocess_2inputs_trivial() { inline std::shared_ptr mean_only() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, Shape{1, 3, 24, 24}); + auto function = create_preprocess_1input(ov::element::f32, Shape{1, 3, 24, 24}); auto p = PrePostProcessor(function); p.input().preprocess().mean(1.1f); function = p.build(); @@ -109,7 +109,7 @@ inline std::shared_ptr mean_only() { inline std::shared_ptr scale_only() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, Shape{1, 3, 24, 24}); + auto function = create_preprocess_1input(ov::element::f32, Shape{1, 3, 24, 24}); auto p = PrePostProcessor(function); p.input().preprocess().scale(2.1f); function = p.build(); @@ -118,7 +118,7 @@ inline std::shared_ptr scale_only() { inline std::shared_ptr mean_scale() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, Shape{1, 3, 24, 24}); + auto function = create_preprocess_1input(ov::element::f32, Shape{1, 3, 24, 24}); auto p = PrePostProcessor(function); p.input().preprocess().mean(1.1f).scale(2.1f); function = p.build(); @@ -127,7 +127,7 @@ inline std::shared_ptr mean_scale() { inline std::shared_ptr scale_mean() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, Shape{1, 3, 24, 24}); + auto function = create_preprocess_1input(ov::element::f32, Shape{1, 3, 24, 24}); auto p = PrePostProcessor(function); p.input().preprocess().scale(2.1f).mean(1.1f); function = p.build(); @@ -136,7 +136,7 @@ inline std::shared_ptr scale_mean() { inline std::shared_ptr mean_vector() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, Shape{1, 3, 24, 24}); + auto function = create_preprocess_1input(ov::element::f32, Shape{1, 3, 24, 24}); auto p = PrePostProcessor(function); p.input().tensor().set_layout("NCHW"); p.input().preprocess().mean({2.2f, 3.3f, 4.4f}); @@ -146,7 +146,7 @@ inline std::shared_ptr mean_vector() { inline std::shared_ptr scale_vector() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, Shape{1, 3, 24, 24}); + auto function = create_preprocess_1input(ov::element::f32, Shape{1, 3, 24, 24}); auto p = PrePostProcessor(function); p.input().tensor().set_layout("NCHW"); p.input().preprocess().scale({2.2f, 3.3f, 4.4f}); @@ -156,26 +156,26 @@ inline std::shared_ptr scale_vector() { inline std::shared_ptr convert_element_type_and_mean() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::u8, Shape{1, 3, 24, 24}); + auto function = create_preprocess_1input(ov::element::u8, Shape{1, 3, 24, 24}); auto p = PrePostProcessor(function); - p.input().preprocess().convert_element_type(element::f32).mean(0.2f).convert_element_type(element::u8); + p.input().preprocess().convert_element_type(ov::element::f32).mean(0.2f).convert_element_type(ov::element::u8); function = p.build(); return function; } inline std::shared_ptr tensor_element_type_and_mean() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::u8, Shape{1, 3, 12, 12}); + auto function = create_preprocess_1input(ov::element::u8, Shape{1, 3, 12, 12}); auto p = PrePostProcessor(function); - p.input().tensor().set_element_type(element::f32); - p.input().preprocess().mean(0.1f).convert_element_type(element::u8); + p.input().tensor().set_element_type(ov::element::f32); + p.input().preprocess().mean(0.1f).convert_element_type(ov::element::u8); function = p.build(); return function; } inline std::shared_ptr custom_preprocessing() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::i32, Shape{3, 4, 10, 20}); + auto function = create_preprocess_1input(ov::element::i32, Shape{3, 4, 10, 20}); auto p = PrePostProcessor(function); p.input().preprocess().custom([](const Output& node) { auto abs = std::make_shared(node); @@ -188,11 +188,11 @@ inline std::shared_ptr custom_preprocessing() { inline std::shared_ptr multiple_ops() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::u8, Shape{1, 3, 3, 3}); + auto function = create_preprocess_1input(ov::element::u8, Shape{1, 3, 3, 3}); auto p = PrePostProcessor(function); auto p1 = std::move(p); p = std::move(p1); - p.input().tensor().set_element_type(element::f32).set_layout("?CHW"); + p.input().tensor().set_element_type(ov::element::f32).set_layout("?CHW"); p.input() .preprocess() .mean(1.f) @@ -204,14 +204,14 @@ inline std::shared_ptr multiple_ops() { abs->set_friendly_name(node.get_node_shared_ptr()->get_friendly_name() + "/abs"); return abs; }); - p.input().preprocess().convert_element_type(element::u8); + p.input().preprocess().convert_element_type(ov::element::u8); function = p.build(); return function; } inline std::shared_ptr two_inputs_basic() { using namespace ov::preprocess; - auto function = create_preprocess_2inputs(element::f32, Shape{1, 3, 1, 1}); + auto function = create_preprocess_2inputs(ov::element::f32, Shape{1, 3, 1, 1}); auto p = PrePostProcessor(function); p.input(1).preprocess().mean(1.f).scale(2.0f); function = p.build(); @@ -229,7 +229,7 @@ inline std::shared_ptr two_inputs_trivial() { inline std::shared_ptr reuse_network_layout() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{4, 3, 2, 1}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{4, 3, 2, 1}); function->get_parameters().front()->set_layout("NC??"); auto p = PrePostProcessor(function); p.input().preprocess().mean({1.1f, 2.2f, 3.3f}).scale({2.f, 3.f, 4.f}); @@ -239,7 +239,7 @@ inline std::shared_ptr reuse_network_layout() { inline std::shared_ptr tensor_layout() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{4, 3, 2, 1}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{4, 3, 2, 1}); function->get_parameters().front()->set_layout("NC??"); auto p = PrePostProcessor(function); p.input().tensor().set_layout("NC??"); @@ -250,7 +250,7 @@ inline std::shared_ptr tensor_layout() { inline std::shared_ptr resize_linear() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{1, 3, 10, 10}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{1, 3, 10, 10}); auto p = PrePostProcessor(function); p.input().tensor().set_spatial_static_shape(20, 20); p.input().preprocess().resize(ResizeAlgorithm::RESIZE_LINEAR); @@ -261,7 +261,7 @@ inline std::shared_ptr resize_linear() { inline std::shared_ptr resize_nearest() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{1, 3, 10, 10}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{1, 3, 10, 10}); auto p = PrePostProcessor(function); p.input().tensor().set_spatial_static_shape(20, 20); p.input().preprocess().resize(ResizeAlgorithm::RESIZE_NEAREST); @@ -272,7 +272,7 @@ inline std::shared_ptr resize_nearest() { inline std::shared_ptr resize_linear_nhwc() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{1, 10, 10, 3}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{1, 10, 10, 3}); auto p = PrePostProcessor(function); p.input().tensor().set_spatial_static_shape(20, 20); p.input().preprocess().resize(ResizeAlgorithm::RESIZE_LINEAR); @@ -283,7 +283,7 @@ inline std::shared_ptr resize_linear_nhwc() { inline std::shared_ptr resize_cubic() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{1, 3, 20, 20}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{1, 3, 20, 20}); auto p = PrePostProcessor(function); p.input().tensor().set_spatial_static_shape(10, 10); p.input().preprocess().resize(ResizeAlgorithm::RESIZE_CUBIC); @@ -294,7 +294,7 @@ inline std::shared_ptr resize_cubic() { inline std::shared_ptr resize_and_convert_layout() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{1, 30, 20, 3}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{1, 30, 20, 3}); auto p = PrePostProcessor(function); p.input().tensor().set_layout("NHWC").set_spatial_static_shape(40, 30); p.input().preprocess().convert_layout().resize(ResizeAlgorithm::RESIZE_LINEAR); @@ -305,7 +305,7 @@ inline std::shared_ptr resize_and_convert_layout() { inline std::shared_ptr convert_layout_by_dims() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{1, 30, 20, 3}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{1, 30, 20, 3}); auto p = PrePostProcessor(function); p.input().preprocess().convert_layout({0, 3, 1, 2}); function = p.build(); @@ -314,9 +314,9 @@ inline std::shared_ptr convert_layout_by_dims() { inline std::shared_ptr convert_layout_hwc_to_nchw() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{1, 3, 30, 20}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{1, 3, 30, 20}); auto p = PrePostProcessor(function); - p.input().tensor().set_layout("HWC").set_element_type(element::u8); + p.input().tensor().set_layout("HWC").set_element_type(ov::element::u8); p.input().model().set_layout("NCHW"); function = p.build(); return function; @@ -324,7 +324,7 @@ inline std::shared_ptr convert_layout_hwc_to_nchw() { inline std::shared_ptr resize_and_convert_layout_i8() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::i8, PartialShape{1, 30, 20, 3}); + auto function = create_preprocess_1input(ov::element::i8, PartialShape{1, 30, 20, 3}); auto p = PrePostProcessor(function); p.input().tensor().set_layout("NHWC").set_spatial_static_shape(40, 30); p.input().preprocess().convert_layout().resize(ResizeAlgorithm::RESIZE_LINEAR); @@ -335,7 +335,7 @@ inline std::shared_ptr resize_and_convert_layout_i8() { inline std::shared_ptr cvt_color_nv12_to_rgb_single_plane() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{1, 20, 20, 3}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{1, 20, 20, 3}); auto p = PrePostProcessor(function); p.input().tensor().set_color_format(ColorFormat::NV12_SINGLE_PLANE); p.input().preprocess().convert_color(ColorFormat::RGB); @@ -345,7 +345,7 @@ inline std::shared_ptr cvt_color_nv12_to_rgb_single_plane() { inline std::shared_ptr cvt_color_nv12_to_bgr_two_planes() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{1, 20, 20, 3}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{1, 20, 20, 3}); auto p = PrePostProcessor(function); p.input().tensor().set_color_format(ColorFormat::NV12_TWO_PLANES); p.input().preprocess().convert_color(ColorFormat::BGR); @@ -355,18 +355,18 @@ inline std::shared_ptr cvt_color_nv12_to_bgr_two_planes() { inline std::shared_ptr cvt_color_nv12_cvt_layout_resize() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{1, 3, 10, 10}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{1, 3, 10, 10}); auto p = PrePostProcessor(function); p.input() .tensor() .set_color_format(ColorFormat::NV12_TWO_PLANES) - .set_element_type(element::u8) + .set_element_type(ov::element::u8) .set_spatial_static_shape(20, 20); p.input() .preprocess() .convert_color(ColorFormat::RGB) .convert_layout() - .convert_element_type(element::f32) + .convert_element_type(ov::element::f32) .resize(ResizeAlgorithm::RESIZE_LINEAR); p.input().model().set_layout("NCHW"); function = p.build(); @@ -375,7 +375,7 @@ inline std::shared_ptr cvt_color_nv12_cvt_layout_resize() { inline std::shared_ptr cvt_color_i420_to_rgb_single_plane() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{1, 20, 20, 3}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{1, 20, 20, 3}); auto p = PrePostProcessor(function); p.input().tensor().set_color_format(ColorFormat::I420_SINGLE_PLANE); p.input().preprocess().convert_color(ColorFormat::RGB); @@ -384,7 +384,7 @@ inline std::shared_ptr cvt_color_i420_to_rgb_single_plane() { inline std::shared_ptr cvt_color_i420_to_bgr_three_planes() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{1, 20, 20, 3}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{1, 20, 20, 3}); auto p = PrePostProcessor(function); p.input().tensor().set_color_format(ColorFormat::I420_THREE_PLANES); p.input().preprocess().convert_color(ColorFormat::BGR); @@ -393,7 +393,7 @@ inline std::shared_ptr cvt_color_i420_to_bgr_three_planes() { inline std::shared_ptr cvt_color_bgrx_to_bgr() { using namespace ov::preprocess; - auto function = create_preprocess_2inputs(element::f32, PartialShape{1, 160, 160, 3}); + auto function = create_preprocess_2inputs(ov::element::f32, PartialShape{1, 160, 160, 3}); auto p = PrePostProcessor(function); p.input(0).tensor().set_color_format(ColorFormat::BGRX); p.input(0).preprocess().convert_color(ColorFormat::BGR); @@ -404,7 +404,7 @@ inline std::shared_ptr cvt_color_bgrx_to_bgr() { inline std::shared_ptr resize_dynamic() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{1, 3, 20, 20}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{1, 3, 20, 20}); auto p = PrePostProcessor(function); p.input().tensor().set_spatial_dynamic_shape(); p.input().preprocess().resize(ResizeAlgorithm::RESIZE_LINEAR); @@ -415,7 +415,7 @@ inline std::shared_ptr resize_dynamic() { inline std::shared_ptr crop_basic() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{1, 3, 10, 10}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{1, 3, 10, 10}); auto p = PrePostProcessor(function); p.input().tensor().set_shape({1, 3, 40, 40}); p.input().preprocess().crop({0, 0, 5, 10}, {1, 3, 15, 20}); @@ -425,7 +425,7 @@ inline std::shared_ptr crop_basic() { inline std::shared_ptr crop_negative() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{1, 3, -1, -1}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{1, 3, -1, -1}); auto p = PrePostProcessor(function); p.input().tensor().set_shape({1, 3, 40, 40}); p.input().preprocess().crop({0, 0, 5, 10}, {1, 3, -5, -5}); @@ -435,7 +435,7 @@ inline std::shared_ptr crop_negative() { inline std::shared_ptr crop_dynamic() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{1, 3, -1, -1}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{1, 3, -1, -1}); auto p = PrePostProcessor(function); p.input().tensor().set_shape(PartialShape{1, 3, -1, -1}); p.input().preprocess().crop({0, 0, 50, 50}, {1, 3, 60, 150}); @@ -482,7 +482,7 @@ inline std::vector generic_preprocess_functions() { inline std::shared_ptr cvt_color_rgb_to_bgr() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{1, 20, 30, 3}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{1, 20, 30, 3}); auto p = PrePostProcessor(function); p.output().model().set_layout("NHWC").set_color_format(ColorFormat::RGB); p.output().postprocess().convert_color(ColorFormat::BGR); @@ -492,7 +492,7 @@ inline std::shared_ptr cvt_color_rgb_to_bgr() { inline std::shared_ptr cvt_color_bgr_to_rgb() { using namespace ov::preprocess; - auto function = create_preprocess_1input(element::f32, PartialShape{1, 20, 30, 3}); + auto function = create_preprocess_1input(ov::element::f32, PartialShape{1, 20, 30, 3}); auto p = PrePostProcessor(function); p.output().model().set_layout("NHWC").set_color_format(ColorFormat::BGR); p.output().postprocess().convert_color(ColorFormat::RGB); diff --git a/src/tests/ov_helpers/ov_models/include/ov_models/utils/ov_helpers.hpp b/src/tests/ov_helpers/ov_models/include/ov_models/utils/ov_helpers.hpp index d140301b236..9a634a165c7 100644 --- a/src/tests/ov_helpers/ov_models/include/ov_models/utils/ov_helpers.hpp +++ b/src/tests/ov_helpers/ov_models/include/ov_models/utils/ov_helpers.hpp @@ -116,8 +116,8 @@ std::shared_ptr foldFunction(const std::shared_ptr& functi const std::vector& inputTypes = {}); std::vector convertOutputPrecision(const std::vector& output, - const element::Type_t& fromPrecision, - const element::Type_t& toPrecision, + const ov::element::Type_t& fromPrecision, + const ov::element::Type_t& toPrecision, const size_t elementsCount); // todo: remove the following function from the source code after cleaning up VPU repo diff --git a/src/tests/ov_helpers/ov_models/ov_builders/src/broadcast.cpp b/src/tests/ov_helpers/ov_models/ov_builders/src/broadcast.cpp index 64c2ec8d995..521aec892c7 100644 --- a/src/tests/ov_helpers/ov_models/ov_builders/src/broadcast.cpp +++ b/src/tests/ov_helpers/ov_models/ov_builders/src/broadcast.cpp @@ -45,15 +45,15 @@ std::vector get_axes_mapping(const Shape& output_shape, const AxisSet& b /// Output get_axes_mapping_output(const Shape& output_shape, const AxisSet& broadcast_axes) { std::vector axes_mapping{get_axes_mapping(output_shape, broadcast_axes)}; - return ov::op::v0::Constant::create(element::i64, Shape{axes_mapping.size()}, axes_mapping); + return ov::op::v0::Constant::create(ov::element::i64, Shape{axes_mapping.size()}, axes_mapping); } static Output get_axes_mapping_output(const PartialShape& output_shape, const Output& input_shape, std::size_t start_match_axis) { - const auto one_node = ov::op::v0::Constant::create(element::i64, Shape{}, {1}); - const auto zero_node = ov::op::v0::Constant::create(element::i64, Shape{}, {0}); - const auto start_match_axis_node = ov::op::v0::Constant::create(element::i64, Shape{}, {start_match_axis}); + const auto one_node = ov::op::v0::Constant::create(ov::element::i64, Shape{}, {1}); + const auto zero_node = ov::op::v0::Constant::create(ov::element::i64, Shape{}, {0}); + const auto start_match_axis_node = ov::op::v0::Constant::create(ov::element::i64, Shape{}, {start_match_axis}); const auto target_shape_rank_node = ov::op::util::reshape(std::make_shared(input_shape), Shape{}); @@ -73,7 +73,7 @@ static Output get_axes_mapping_output(const PartialShape& output_shape, Output make_broadcast(const Output& node, const Shape& target_shape, const AxisSet& broadcast_axes) { return std::make_shared( node, - ov::op::v0::Constant::create(element::i64, Shape{target_shape.size()}, target_shape), + ov::op::v0::Constant::create(ov::element::i64, Shape{target_shape.size()}, target_shape), get_axes_mapping_output(target_shape, broadcast_axes)); } @@ -81,7 +81,7 @@ Output make_broadcast(const Output& node, const Shape& target_shape, const auto node_shape = std::make_shared(node); return std::make_shared( node, - ov::op::v0::Constant::create(element::i64, Shape{target_shape.size()}, target_shape), + ov::op::v0::Constant::create(ov::element::i64, Shape{target_shape.size()}, target_shape), get_axes_mapping_output(target_shape, node_shape, start_match_axis)); } } // namespace util diff --git a/src/tests/ov_helpers/ov_models/ov_builders/src/reshape.cpp b/src/tests/ov_helpers/ov_models/ov_builders/src/reshape.cpp index ef3471bf819..1d72fc625b0 100644 --- a/src/tests/ov_helpers/ov_models/ov_builders/src/reshape.cpp +++ b/src/tests/ov_helpers/ov_models/ov_builders/src/reshape.cpp @@ -29,10 +29,10 @@ std::shared_ptr reshape(const Output& value, const Shape& shape) { auto value_rank = value.get_shape().size(); AxisVector axes_vector(value_rank); std::iota(axes_vector.begin(), axes_vector.end(), 0); - auto axes = ov::op::v0::Constant::create(element::i64, Shape{value_rank}, axes_vector); + auto axes = ov::op::v0::Constant::create(ov::element::i64, Shape{value_rank}, axes_vector); return std::make_shared(value, axes); } else { - auto out_pattern = ov::op::v0::Constant::create(element::i64, + auto out_pattern = ov::op::v0::Constant::create(ov::element::i64, Shape{shape.size()}, std::vector(shape.begin(), shape.end())); @@ -42,7 +42,7 @@ std::shared_ptr reshape(const Output& value, const Shape& shape) { std::shared_ptr reorder_axes(const Output& value, std::vector axes_order) { const auto axes_order_const = - ov::op::v0::Constant::create(element::i64, + ov::op::v0::Constant::create(ov::element::i64, Shape{axes_order.size()}, std::vector(axes_order.begin(), axes_order.end())); return std::make_shared(value, axes_order_const); @@ -58,7 +58,7 @@ std::shared_ptr transpose(const Output& value) { } const auto input_rank = std::make_shared(std::make_shared(value)); - const auto neg_one = ov::op::v0::Constant::create(element::i64, Shape{}, {-1}); + const auto neg_one = ov::op::v0::Constant::create(ov::element::i64, Shape{}, {-1}); const auto start_node = std::make_shared(input_rank, neg_one); const auto reverse_axes_order = std::make_shared(reshape(start_node, Shape{}), // start neg_one, // stop (exclusive) @@ -77,7 +77,7 @@ namespace { /// \return The new Constant node representing normalized axis value. /// std::shared_ptr get_normalized_axis_node(const std::shared_ptr node_rank, int64_t axis) { - auto axis_node = ov::op::v0::Constant::create(element::i64, Shape{1}, {axis}); + auto axis_node = ov::op::v0::Constant::create(ov::element::i64, Shape{1}, {axis}); // shortcut for already positive value if (axis >= 0) { return axis_node; @@ -95,9 +95,9 @@ std::shared_ptr flatten(const Output& value, int axis) { // [d_{axis}, ..., d_n] std::shared_ptr output_shape; if (axis == 0) { - output_shape = ov::op::v0::Constant::create(element::i64, Shape{2}, {1, -1}); + output_shape = ov::op::v0::Constant::create(ov::element::i64, Shape{2}, {1, -1}); } else if (axis == 1) { - output_shape = ov::op::v0::Constant::create(element::i64, Shape{2}, {0, -1}); + output_shape = ov::op::v0::Constant::create(ov::element::i64, Shape{2}, {0, -1}); } else { const auto value_shape = std::make_shared(value); const auto value_rank = std::make_shared(value_shape); @@ -105,16 +105,16 @@ std::shared_ptr flatten(const Output& value, int axis) { const auto first_part_dims = std::make_shared(value_shape, - ov::op::v0::Constant::create(element::i64, {1}, {0}), + ov::op::v0::Constant::create(ov::element::i64, {1}, {0}), axis_node, std::vector{0}, std::vector{0}); const auto first_part_dims_length = std::make_shared(first_part_dims, - ov::op::v0::Constant::create(element::i64, {}, {0}), + ov::op::v0::Constant::create(ov::element::i64, {}, {0}), true); - const auto remaining_part_length = ov::op::v0::Constant::create(element::i64, {1}, {-1}); + const auto remaining_part_length = ov::op::v0::Constant::create(ov::element::i64, {1}, {-1}); output_shape = std::make_shared(OutputVector{first_part_dims_length, remaining_part_length}, 0); diff --git a/src/tests/ov_helpers/ov_models/ov_builders/src/split.cpp b/src/tests/ov_helpers/ov_models/ov_builders/src/split.cpp index af87cf8781f..3a154ecb4f5 100644 --- a/src/tests/ov_helpers/ov_models/ov_builders/src/split.cpp +++ b/src/tests/ov_helpers/ov_models/ov_builders/src/split.cpp @@ -12,16 +12,16 @@ namespace ov { namespace op { namespace util { OutputVector split(const Output& value, const std::vector& split_lengths, int64_t axis) { - const auto axis_node = ov::op::v0::Constant::create(element::i64, Shape{}, {axis}); + const auto axis_node = ov::op::v0::Constant::create(ov::element::i64, Shape{}, {axis}); const auto split_lengths_node = - ov::op::v0::Constant::create(element::i64, Shape{split_lengths.size()}, split_lengths); + ov::op::v0::Constant::create(ov::element::i64, Shape{split_lengths.size()}, split_lengths); const auto variadic_split = std::make_shared(value, axis_node, split_lengths_node); return variadic_split->outputs(); } OutputVector split(const Output& value, int64_t num_splits, int64_t axis) { - const auto axis_node = ov::op::v0::Constant::create(element::i64, Shape{}, {axis}); + const auto axis_node = ov::op::v0::Constant::create(ov::element::i64, Shape{}, {axis}); const auto split = std::make_shared(value, axis_node, num_splits); return split->outputs(); diff --git a/src/tests/ov_helpers/ov_models/src/activation.cpp b/src/tests/ov_helpers/ov_models/src/activation.cpp index d7cc3c43290..4d246b0f6b3 100644 --- a/src/tests/ov_helpers/ov_models/src/activation.cpp +++ b/src/tests/ov_helpers/ov_models/src/activation.cpp @@ -51,7 +51,7 @@ namespace ngraph { namespace builder { std::shared_ptr makeActivation(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, ov::test::utils::ActivationTypes activationType, std::vector inShape, std::vector constantsValue) { @@ -154,7 +154,7 @@ std::shared_ptr makeActivation(const ov::Output& in, } std::shared_ptr makeActivation(const ov::ParameterVector& parameters, - const element::Type& type, + const ov::element::Type& type, ov::test::utils::ActivationTypes activationType) { switch (activationType) { case ov::test::utils::ActivationTypes::LeakyRelu: diff --git a/src/tests/ov_helpers/ov_models/src/batch_to_space.cpp b/src/tests/ov_helpers/ov_models/src/batch_to_space.cpp index 517b238465e..2e08f8219e5 100644 --- a/src/tests/ov_helpers/ov_models/src/batch_to_space.cpp +++ b/src/tests/ov_helpers/ov_models/src/batch_to_space.cpp @@ -10,7 +10,7 @@ namespace ngraph { namespace builder { std::shared_ptr makeBatchToSpace(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, const std::vector& blockShape, const std::vector& cropsBegin, const std::vector& cropsEnd) { diff --git a/src/tests/ov_helpers/ov_models/src/binary_convolution.cpp b/src/tests/ov_helpers/ov_models/src/binary_convolution.cpp index 2cf302b8a79..9c29139c399 100644 --- a/src/tests/ov_helpers/ov_models/src/binary_convolution.cpp +++ b/src/tests/ov_helpers/ov_models/src/binary_convolution.cpp @@ -26,11 +26,11 @@ std::shared_ptr makeBinaryConvolution(const ov::Output& in, auto shape = in.get_shape(); std::vector filterWeightsShape = {numOutChannels, shape[1]}; filterWeightsShape.insert(filterWeightsShape.end(), filterSize.begin(), filterSize.end()); - auto filterWeightsNode = std::make_shared(element::u1, filterWeightsShape); + auto filterWeightsNode = std::make_shared(ov::element::u1, filterWeightsShape); const size_t byteNum = (ov::shape_size(filterWeightsShape) + 7) / 8; int8_t* buffer = const_cast(filterWeightsNode->get_data_ptr()); if (filterWeihgts.size() == 0) { - std::vector weihgts = NGraphFunctions::Utils::generateVector(byteNum); + std::vector weihgts = NGraphFunctions::Utils::generateVector(byteNum); for (size_t i = 0; i < byteNum; i++) buffer[i] = weihgts[i]; } else { diff --git a/src/tests/ov_helpers/ov_models/src/convolution.cpp b/src/tests/ov_helpers/ov_models/src/convolution.cpp index 4e3fb11c692..a1ded216860 100644 --- a/src/tests/ov_helpers/ov_models/src/convolution.cpp +++ b/src/tests/ov_helpers/ov_models/src/convolution.cpp @@ -15,7 +15,7 @@ namespace ngraph { namespace builder { std::shared_ptr makeConvolution(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, const std::vector& filterSize, const std::vector& strides, const std::vector& padsBegin, @@ -52,7 +52,7 @@ std::shared_ptr makeConvolution(const ov::Output& in, std::shared_ptr makeConvolution(const ov::Output& in_data, const ov::Output& in_weights, - const element::Type& type, + const ov::element::Type& type, const std::vector& filterSize, const std::vector& strides, const std::vector& padsBegin, diff --git a/src/tests/ov_helpers/ov_models/src/convolution_backprop_data.cpp b/src/tests/ov_helpers/ov_models/src/convolution_backprop_data.cpp index eced9c1f7ab..1d91c5f0dd6 100644 --- a/src/tests/ov_helpers/ov_models/src/convolution_backprop_data.cpp +++ b/src/tests/ov_helpers/ov_models/src/convolution_backprop_data.cpp @@ -14,7 +14,7 @@ namespace ngraph { namespace builder { std::shared_ptr makeConvolutionBackpropData(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, const std::vector& filterSize, const std::vector& strides, const std::vector& padsBegin, @@ -48,7 +48,7 @@ std::shared_ptr makeConvolutionBackpropData(const ov::Output& in, std::shared_ptr makeConvolutionBackpropData(const ov::Output& in, const ov::Output& weights, - const element::Type& type, + const ov::element::Type& type, const std::vector& strides, const std::vector& padsBegin, const std::vector& padsEnd, @@ -88,7 +88,7 @@ std::shared_ptr makeConvolutionBackpropData(const ov::Output& in, std::shared_ptr makeConvolutionBackpropData(const ov::Output& in, const ov::Output& outputShape, - const element::Type& type, + const ov::element::Type& type, const std::vector& filterSize, const std::vector& strides, const std::vector& padsBegin, diff --git a/src/tests/ov_helpers/ov_models/src/ctc_greedy_decoder_seq_len.cpp b/src/tests/ov_helpers/ov_models/src/ctc_greedy_decoder_seq_len.cpp index 67a9ef5a1b0..34b75a96e90 100644 --- a/src/tests/ov_helpers/ov_models/src/ctc_greedy_decoder_seq_len.cpp +++ b/src/tests/ov_helpers/ov_models/src/ctc_greedy_decoder_seq_len.cpp @@ -17,12 +17,12 @@ std::shared_ptr makeCTCGreedyDecoderSeqLen(const ov::Output& inp const ov::Output& sequenceLengthData, int32_t blankIndex, bool mergeRepeated, - const element::Type& idxPrecision) { + const ov::element::Type& idxPrecision) { const auto blankIndexNode = [&] { - if (idxPrecision == element::i32) { + if (idxPrecision == ov::element::i32) { const auto blankIdxDataI32 = std::vector{blankIndex}; return ov::test::utils::deprecated::make_constant(idxPrecision, {1}, blankIdxDataI32); - } else if (idxPrecision == element::i64) { + } else if (idxPrecision == ov::element::i64) { const auto blankIdxDataI64 = std::vector{blankIndex}; return ov::test::utils::deprecated::make_constant(idxPrecision, {1}, blankIdxDataI64); } @@ -40,15 +40,15 @@ std::shared_ptr makeCTCGreedyDecoderSeqLen(const ov::Output& inp std::shared_ptr makeCTCGreedyDecoderSeqLen(const ov::Output& inputData, int32_t blankIndex, bool mergeRepeated, - const element::Type& idxPrecision) { + const ov::element::Type& idxPrecision) { const auto sequenceLengthData = [&] { const size_t N = inputData.get_shape().at(0); const size_t T = inputData.get_shape().at(1); - if (idxPrecision == element::i32) { + if (idxPrecision == ov::element::i32) { const auto sequenceLengthI32 = std::vector(N, T); return ov::test::utils::deprecated::make_constant(idxPrecision, {N}, sequenceLengthI32); - } else if (idxPrecision == element::i64) { + } else if (idxPrecision == ov::element::i64) { const auto sequenceLengthI64 = std::vector(N, T); return ov::test::utils::deprecated::make_constant(idxPrecision, {N}, sequenceLengthI64); } diff --git a/src/tests/ov_helpers/ov_models/src/ctc_loss.cpp b/src/tests/ov_helpers/ov_models/src/ctc_loss.cpp index bef5cc57634..768071ed174 100644 --- a/src/tests/ov_helpers/ov_models/src/ctc_loss.cpp +++ b/src/tests/ov_helpers/ov_models/src/ctc_loss.cpp @@ -18,8 +18,8 @@ std::shared_ptr makeCTCLoss(const ov::Output& logitsNode, std::vector>& labels, std::vector& labelsLength, int blankIndex, - const element::Type& fType, - const element::Type& iType, + const ov::element::Type& fType, + const ov::element::Type& iType, const bool preprocessCollapseRepeated, const bool ctcMergeRepeated, const bool unique) { diff --git a/src/tests/ov_helpers/ov_models/src/embedding_bag_offsets_sum.cpp b/src/tests/ov_helpers/ov_models/src/embedding_bag_offsets_sum.cpp index 4b3d6194e31..0fe0eb4677c 100644 --- a/src/tests/ov_helpers/ov_models/src/embedding_bag_offsets_sum.cpp +++ b/src/tests/ov_helpers/ov_models/src/embedding_bag_offsets_sum.cpp @@ -12,8 +12,8 @@ namespace ngraph { namespace builder { -std::shared_ptr makeEmbeddingBagOffsetsSum(const element::Type& dataType, - const element::Type& indicesType, +std::shared_ptr makeEmbeddingBagOffsetsSum(const ov::element::Type& dataType, + const ov::element::Type& indicesType, const ov::Output& embTableNode, const std::vector& indices, const std::vector& offsets, diff --git a/src/tests/ov_helpers/ov_models/src/embedding_segments_sum.cpp b/src/tests/ov_helpers/ov_models/src/embedding_segments_sum.cpp index 583ff93d6b5..e700375e364 100644 --- a/src/tests/ov_helpers/ov_models/src/embedding_segments_sum.cpp +++ b/src/tests/ov_helpers/ov_models/src/embedding_segments_sum.cpp @@ -13,8 +13,8 @@ namespace ngraph { namespace builder { -std::shared_ptr makeEmbeddingSegmentsSum(const element::Type& dataType, - const element::Type& indicesType, +std::shared_ptr makeEmbeddingSegmentsSum(const ov::element::Type& dataType, + const ov::element::Type& indicesType, const ov::Output& embTableNode, const std::vector& indices, const std::vector& segment_ids, diff --git a/src/tests/ov_helpers/ov_models/src/fake_quantize.cpp b/src/tests/ov_helpers/ov_models/src/fake_quantize.cpp index 4becd996203..514c75728ae 100644 --- a/src/tests/ov_helpers/ov_models/src/fake_quantize.cpp +++ b/src/tests/ov_helpers/ov_models/src/fake_quantize.cpp @@ -14,7 +14,7 @@ namespace ngraph { namespace builder { std::shared_ptr makeFakeQuantize(const ov::Output& in, - const element::Type& constantType, + const ov::element::Type& constantType, std::size_t levels, std::vector constShapes, const std::vector& inputLowData, diff --git a/src/tests/ov_helpers/ov_models/src/fully_connected.cpp b/src/tests/ov_helpers/ov_models/src/fully_connected.cpp index 4163422a544..f5da3e34312 100644 --- a/src/tests/ov_helpers/ov_models/src/fully_connected.cpp +++ b/src/tests/ov_helpers/ov_models/src/fully_connected.cpp @@ -14,7 +14,7 @@ namespace ngraph { namespace builder { std::shared_ptr makeFullyConnected(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, const size_t outputSize, bool addBias, const ov::Shape& weightsShape, diff --git a/src/tests/ov_helpers/ov_models/src/gather_nd.cpp b/src/tests/ov_helpers/ov_models/src/gather_nd.cpp index 5a1a1c7ea60..1d3493ada88 100644 --- a/src/tests/ov_helpers/ov_models/src/gather_nd.cpp +++ b/src/tests/ov_helpers/ov_models/src/gather_nd.cpp @@ -15,7 +15,7 @@ namespace builder { std::shared_ptr makeGatherND(const ov::Output& dataNode, const ov::Shape& indicesShape, - const element::Type& indicesType, + const ov::element::Type& indicesType, const std::size_t batchDims) { const auto indices = [&] { const auto& dataShape = dataNode.get_shape(); @@ -26,7 +26,7 @@ std::shared_ptr makeGatherND(const ov::Output& dataNode, const auto maxDim = *std::max_element(begin(dataShape), end(dataShape)); auto indicesValues = - NGraphFunctions::Utils::generateVector(indicesCount * sliceRank, maxDim, 0); + NGraphFunctions::Utils::generateVector(indicesCount * sliceRank, maxDim, 0); auto indicesData = indicesValues.data(); for (int i = 0; i < indicesCount; i++) { for (int dim = 0; dim < sliceRank; dim++) { @@ -45,7 +45,7 @@ std::shared_ptr makeGatherND(const ov::Output& dataNode, std::shared_ptr makeGatherND8(const ov::Output& dataNode, const ov::Shape& indicesShape, - const element::Type& indicesType, + const ov::element::Type& indicesType, const std::size_t batchDims) { const auto indices = [&] { const auto& dataShape = dataNode.get_shape(); @@ -56,7 +56,7 @@ std::shared_ptr makeGatherND8(const ov::Output& dataNode, const auto maxDim = *std::max_element(begin(dataShape), end(dataShape)); auto indicesValues = - NGraphFunctions::Utils::generateVector(indicesCount * sliceRank, maxDim, 0); + NGraphFunctions::Utils::generateVector(indicesCount * sliceRank, maxDim, 0); auto indicesData = indicesValues.data(); for (int i = 0; i < indicesCount; i++) { for (int dim = 0; dim < sliceRank; dim++) { diff --git a/src/tests/ov_helpers/ov_models/src/group_convolution.cpp b/src/tests/ov_helpers/ov_models/src/group_convolution.cpp index d857fe890f2..fef06704cca 100644 --- a/src/tests/ov_helpers/ov_models/src/group_convolution.cpp +++ b/src/tests/ov_helpers/ov_models/src/group_convolution.cpp @@ -14,7 +14,7 @@ namespace ngraph { namespace builder { std::shared_ptr makeGroupConvolution(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, const std::vector& filterSize, const std::vector& strides, const std::vector& padsBegin, @@ -52,7 +52,7 @@ std::shared_ptr makeGroupConvolution(const ov::Output& in, std::shared_ptr makeGroupConvolution(const ov::Output& in, const ov::Output& weights, - const element::Type& type, + const ov::element::Type& type, const std::vector& strides, const std::vector& padsBegin, const std::vector& padsEnd, diff --git a/src/tests/ov_helpers/ov_models/src/group_convolution_backprop_data.cpp b/src/tests/ov_helpers/ov_models/src/group_convolution_backprop_data.cpp index ce4fda98e97..246b3ff460b 100644 --- a/src/tests/ov_helpers/ov_models/src/group_convolution_backprop_data.cpp +++ b/src/tests/ov_helpers/ov_models/src/group_convolution_backprop_data.cpp @@ -14,7 +14,7 @@ namespace ngraph { namespace builder { std::shared_ptr makeGroupConvolutionBackpropData(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, const std::vector& filterSize, const std::vector& strides, const std::vector& padsBegin, @@ -54,7 +54,7 @@ std::shared_ptr makeGroupConvolutionBackpropData(const ov::Output& i std::shared_ptr makeGroupConvolutionBackpropData(const ov::Output& in, const ov::Output& weights, - const element::Type& type, + const ov::element::Type& type, const std::vector& strides, const std::vector& padsBegin, const std::vector& padsEnd, @@ -93,7 +93,7 @@ std::shared_ptr makeGroupConvolutionBackpropData(const ov::Output& i std::shared_ptr makeGroupConvolutionBackpropData(const ov::Output& in, const ov::Output& outputShape, - const element::Type& type, + const ov::element::Type& type, const std::vector& filterSize, const std::vector& strides, const std::vector& padsBegin, diff --git a/src/tests/ov_helpers/ov_models/src/gru_cell.cpp b/src/tests/ov_helpers/ov_models/src/gru_cell.cpp index 63d63facb64..1363e3ceb0f 100644 --- a/src/tests/ov_helpers/ov_models/src/gru_cell.cpp +++ b/src/tests/ov_helpers/ov_models/src/gru_cell.cpp @@ -63,14 +63,15 @@ std::shared_ptr makeGRU(const OutputVector& in, case ov::test::utils::SequenceTestsMode::CONVERT_TO_TI_MAX_SEQ_LEN_CONST: { std::vector lengths(in[0].get_partial_shape()[0].get_min_length(), in[0].get_partial_shape()[1].get_min_length()); - seq_lengths = ov::test::utils::deprecated::make_constant(element::i64, constants[3], lengths, false); + seq_lengths = + ov::test::utils::deprecated::make_constant(ov::element::i64, constants[3], lengths, false); break; } case ov::test::utils::SequenceTestsMode::CONVERT_TO_TI_RAND_SEQ_LEN_CONST: case ov::test::utils::SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_CONST: { for (size_t i = 0; i <= in[0].get_shape().at(0); ++i) { std::vector lengths; - seq_lengths = ov::test::utils::deprecated::make_constant(element::i64, + seq_lengths = ov::test::utils::deprecated::make_constant(ov::element::i64, constants[3], lengths, true, diff --git a/src/tests/ov_helpers/ov_models/src/input_layer.cpp b/src/tests/ov_helpers/ov_models/src/input_layer.cpp index 06f5ca2e252..121127141da 100644 --- a/src/tests/ov_helpers/ov_models/src/input_layer.cpp +++ b/src/tests/ov_helpers/ov_models/src/input_layer.cpp @@ -12,7 +12,7 @@ namespace ngraph { namespace builder { -std::shared_ptr makeInputLayer(const element::Type& type, +std::shared_ptr makeInputLayer(const ov::element::Type& type, ov::test::utils::InputLayerType inputType, const std::vector& shape) { std::shared_ptr input; diff --git a/src/tests/ov_helpers/ov_models/src/lstm_cell.cpp b/src/tests/ov_helpers/ov_models/src/lstm_cell.cpp index 9a9122f8fe5..e9a586d3faf 100644 --- a/src/tests/ov_helpers/ov_models/src/lstm_cell.cpp +++ b/src/tests/ov_helpers/ov_models/src/lstm_cell.cpp @@ -82,14 +82,15 @@ std::shared_ptr makeLSTM(const std::vector>& in, case ov::test::utils::SequenceTestsMode::CONVERT_TO_TI_MAX_SEQ_LEN_CONST: { std::vector lengths(in[0].get_partial_shape()[0].get_min_length(), in[0].get_partial_shape()[1].get_min_length()); - seq_lengths = ov::test::utils::deprecated::make_constant(element::i64, constants[3], lengths, false); + seq_lengths = + ov::test::utils::deprecated::make_constant(ov::element::i64, constants[3], lengths, false); break; } case ov::test::utils::SequenceTestsMode::CONVERT_TO_TI_RAND_SEQ_LEN_CONST: case ov::test::utils::SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_CONST: { for (size_t i = 0; i <= in[0].get_shape().at(0); ++i) { std::vector lengths; - seq_lengths = ov::test::utils::deprecated::make_constant(element::i64, + seq_lengths = ov::test::utils::deprecated::make_constant(ov::element::i64, constants[3], lengths, true, diff --git a/src/tests/ov_helpers/ov_models/src/non_max_suppression.cpp b/src/tests/ov_helpers/ov_models/src/non_max_suppression.cpp index 95e808fd7e1..d318bed19e8 100644 --- a/src/tests/ov_helpers/ov_models/src/non_max_suppression.cpp +++ b/src/tests/ov_helpers/ov_models/src/non_max_suppression.cpp @@ -13,8 +13,8 @@ namespace builder { template std::shared_ptr makeNms(const ov::Output& boxes, const ov::Output& scores, - const element::Type& maxBoxesPrec, - const element::Type& thrPrec, + const ov::element::Type& maxBoxesPrec, + const ov::element::Type& thrPrec, const int32_t& maxOutBoxesPerClass, const float& iouThr, const float& scoreThr, @@ -48,8 +48,8 @@ std::shared_ptr makeNms(const ov::Output& boxes, std::shared_ptr makeNms(const ov::Output& boxes, const ov::Output& scores, - const element::Type& maxBoxesPrec, - const element::Type& thrPrec, + const ov::element::Type& maxBoxesPrec, + const ov::element::Type& thrPrec, const int32_t& maxOutBoxesPerClass, const float& iouThr, const float& scoreThr, diff --git a/src/tests/ov_helpers/ov_models/src/proposal.cpp b/src/tests/ov_helpers/ov_models/src/proposal.cpp index e94c39931bc..801bb6228f5 100644 --- a/src/tests/ov_helpers/ov_models/src/proposal.cpp +++ b/src/tests/ov_helpers/ov_models/src/proposal.cpp @@ -16,7 +16,7 @@ namespace builder { std::shared_ptr makeProposal(const ov::Output& class_probs, const ov::Output& class_logits, const std::vector& image_info, - const element::Type& type, + const ov::element::Type& type, size_t base_size, size_t pre_nms_topn, size_t post_nms_topn, diff --git a/src/tests/ov_helpers/ov_models/src/rnn_cell.cpp b/src/tests/ov_helpers/ov_models/src/rnn_cell.cpp index 69cb155d08c..e4651f9ccf3 100644 --- a/src/tests/ov_helpers/ov_models/src/rnn_cell.cpp +++ b/src/tests/ov_helpers/ov_models/src/rnn_cell.cpp @@ -60,14 +60,15 @@ std::shared_ptr makeRNN(const OutputVector& in, case ov::test::utils::SequenceTestsMode::CONVERT_TO_TI_MAX_SEQ_LEN_CONST: { std::vector lengths(in[0].get_partial_shape()[0].get_min_length(), in[0].get_partial_shape()[1].get_min_length()); - seq_lengths = ov::test::utils::deprecated::make_constant(element::i64, constants[3], lengths, false); + seq_lengths = + ov::test::utils::deprecated::make_constant(ov::element::i64, constants[3], lengths, false); break; } case ov::test::utils::SequenceTestsMode::CONVERT_TO_TI_RAND_SEQ_LEN_CONST: case ov::test::utils::SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_CONST: { for (size_t i = 0; i <= in[0].get_shape().at(0); ++i) { std::vector lengths; - seq_lengths = ov::test::utils::deprecated::make_constant(element::i64, + seq_lengths = ov::test::utils::deprecated::make_constant(ov::element::i64, constants[3], lengths, true, diff --git a/src/tests/ov_helpers/ov_models/src/space_to_batch.cpp b/src/tests/ov_helpers/ov_models/src/space_to_batch.cpp index d004ce01433..30bdfd87fc3 100644 --- a/src/tests/ov_helpers/ov_models/src/space_to_batch.cpp +++ b/src/tests/ov_helpers/ov_models/src/space_to_batch.cpp @@ -10,7 +10,7 @@ namespace ngraph { namespace builder { std::shared_ptr makeSpaceToBatch(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, const std::vector& blockShape, const std::vector& padsBegin, const std::vector& padsEnd) { diff --git a/src/tests/ov_helpers/ov_models/src/split.cpp b/src/tests/ov_helpers/ov_models/src/split.cpp index 01d2748e841..2a78f8e5a8a 100644 --- a/src/tests/ov_helpers/ov_models/src/split.cpp +++ b/src/tests/ov_helpers/ov_models/src/split.cpp @@ -12,7 +12,7 @@ namespace ngraph { namespace builder { std::shared_ptr makeSplit(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, size_t numSplits, int64_t axis) { auto splitAxisOp = diff --git a/src/tests/ov_helpers/ov_models/src/squeeze_unsqueeze.cpp b/src/tests/ov_helpers/ov_models/src/squeeze_unsqueeze.cpp index 0bcb8171249..6c77012b02a 100644 --- a/src/tests/ov_helpers/ov_models/src/squeeze_unsqueeze.cpp +++ b/src/tests/ov_helpers/ov_models/src/squeeze_unsqueeze.cpp @@ -13,7 +13,7 @@ namespace ngraph { namespace builder { std::shared_ptr makeSqueezeUnsqueeze(const ov::Output& in, - const element::Type& type, + const ov::element::Type& type, const std::vector& squeeze_indices, ov::test::utils::SqueezeOpType opType) { auto constant = std::make_shared(type, ov::Shape{squeeze_indices.size()}, squeeze_indices); diff --git a/src/tests/ov_helpers/ov_models/src/strided_slice.cpp b/src/tests/ov_helpers/ov_models/src/strided_slice.cpp index ee59092399e..e617e23ed3c 100644 --- a/src/tests/ov_helpers/ov_models/src/strided_slice.cpp +++ b/src/tests/ov_helpers/ov_models/src/strided_slice.cpp @@ -14,7 +14,7 @@ std::shared_ptr makeSlice(const ov::Output& in, const std::vector& end, const std::vector& stride, const std::vector& axes, - const element::Type& type) { + const ov::element::Type& type) { ov::Shape constShape = {begin.size()}; auto beginNode = std::make_shared(ov::element::i64, constShape, begin.data()); auto endNode = std::make_shared(ov::element::i64, constShape, end.data()); diff --git a/src/tests/ov_helpers/ov_models/src/utils/ov_helpers.cpp b/src/tests/ov_helpers/ov_models/src/utils/ov_helpers.cpp index d670b111180..a1b670d757b 100644 --- a/src/tests/ov_helpers/ov_models/src/utils/ov_helpers.cpp +++ b/src/tests/ov_helpers/ov_models/src/utils/ov_helpers.cpp @@ -68,9 +68,9 @@ std::vector>> interpreter const auto& parameterSize = shape_size(parameterShape) * parameterType.size(); auto input = inputs[parameterIndex]; - const auto inType = inputTypes.empty() ? element::undefined : inputTypes[i]; + const auto inType = inputTypes.empty() ? ov::element::undefined : inputTypes[i]; - if (inType != element::undefined && inType != parameterType) { + if (inType != ov::element::undefined && inType != parameterType) { input = ngraph::helpers::convertOutputPrecision(input, inType, parameterType, shape_size(parameterShape)); } @@ -198,7 +198,7 @@ std::shared_ptr foldFunction(const std::shared_ptr& functi " types"); } - std::vector paramElementTypes; + std::vector paramElementTypes; std::vector paramShapes; std::vector> vecTmpConvertedInputs; vecTmpConvertedInputs.reserve(inputs.size()); @@ -213,9 +213,9 @@ std::shared_ptr foldFunction(const std::shared_ptr& functi auto parameterIndex = function->get_parameter_index(param); auto& input = inputs[parameterIndex]; - const auto inpType = inputTypes.empty() ? element::undefined : inputTypes[i]; + const auto inpType = inputTypes.empty() ? ov::element::undefined : inputTypes[i]; - if (inpType != element::undefined && inpType != paramElementTypes.back()) { + if (inpType != ov::element::undefined && inpType != paramElementTypes.back()) { vecTmpConvertedInputs.emplace_back( convertOutputPrecision(input, inpType, param->get_element_type(), shape_size(param->get_shape()))); inBuffers.push_back(vecTmpConvertedInputs.back().data()); @@ -346,59 +346,59 @@ public: const uint8_t* data; }; -template ::type = true> -const fundamental_type_for* cast_to(const uint8_t* data) { - return reinterpret_cast*>(data); +const ov::fundamental_type_for* cast_to(const uint8_t* data) { + return reinterpret_cast*>(data); } -template ::type = true> -fundamental_type_for* cast_to(uint8_t* data) { - return reinterpret_cast*>(data); +ov::fundamental_type_for* cast_to(uint8_t* data) { + return reinterpret_cast*>(data); } -template ::type = true> +template ::type = true> LowPrecistionConstRange<1, uint8_t> cast_to(const uint8_t* data) { return LowPrecistionConstRange<1, uint8_t>(data); } -template ::type = true> +template ::type = true> LowPrecistionRange<1, uint8_t> cast_to(uint8_t* data) { return LowPrecistionRange<1, uint8_t>(data); } -template ::type = true> +template ::type = true> LowPrecistionConstRange<4, uint8_t> cast_to(const uint8_t* data) { return LowPrecistionConstRange<4, uint8_t>(data); } -template ::type = true> +template ::type = true> LowPrecistionRange<4, uint8_t> cast_to(uint8_t* data) { return LowPrecistionRange<4, uint8_t>(data); } -template ::type = true> +template ::type = true> LowPrecistionConstRange<4, int8_t> cast_to(const uint8_t* data) { return LowPrecistionConstRange<4, int8_t>(data); } -template ::type = true> +template ::type = true> LowPrecistionRange<4, int8_t> cast_to(uint8_t* data) { return LowPrecistionRange<4, int8_t>(data); } -template +template std::vector convertPrecision(const std::vector& buffer, const size_t elementsCount) { - using fromPrec = fundamental_type_for; - using toPrec = fundamental_type_for; + using fromPrec = ov::fundamental_type_for; + using toPrec = ov::fundamental_type_for; const size_t min_buffer_size = [&] { - element::Type from_type(FromType); + ov::element::Type from_type(FromType); if (from_type.bitwidth() >= 8) { return elementsCount * sizeof(fromPrec); } @@ -418,123 +418,123 @@ std::vector convertPrecision(const std::vector& buff return convertedData; } -template +template std::vector convertPrecisionFrom(const std::vector& output, - const element::Type_t& toPrecision, + const ov::element::Type_t& toPrecision, const size_t elementsCount) { switch (toPrecision) { - case element::Type_t::boolean: { - return convertPrecision(output, elementsCount); + case ov::element::Type_t::boolean: { + return convertPrecision(output, elementsCount); } - case element::Type_t::bf16: { - return convertPrecision(output, elementsCount); + case ov::element::Type_t::bf16: { + return convertPrecision(output, elementsCount); } - case element::Type_t::f16: { - return convertPrecision(output, elementsCount); + case ov::element::Type_t::f16: { + return convertPrecision(output, elementsCount); } - case element::Type_t::f32: { - return convertPrecision(output, elementsCount); + case ov::element::Type_t::f32: { + return convertPrecision(output, elementsCount); } - case element::Type_t::f64: { - return convertPrecision(output, elementsCount); + case ov::element::Type_t::f64: { + return convertPrecision(output, elementsCount); } - case element::Type_t::i4: { - return convertPrecision(output, elementsCount); + case ov::element::Type_t::i4: { + return convertPrecision(output, elementsCount); } - case element::Type_t::i8: { - return convertPrecision(output, elementsCount); + case ov::element::Type_t::i8: { + return convertPrecision(output, elementsCount); } - case element::Type_t::i16: { - return convertPrecision(output, elementsCount); + case ov::element::Type_t::i16: { + return convertPrecision(output, elementsCount); } - case element::Type_t::i32: { - return convertPrecision(output, elementsCount); + case ov::element::Type_t::i32: { + return convertPrecision(output, elementsCount); } - case element::Type_t::i64: { - return convertPrecision(output, elementsCount); + case ov::element::Type_t::i64: { + return convertPrecision(output, elementsCount); } - case element::Type_t::u1: { - return convertPrecision(output, elementsCount); + case ov::element::Type_t::u1: { + return convertPrecision(output, elementsCount); } - case element::Type_t::u4: { - return convertPrecision(output, elementsCount); + case ov::element::Type_t::u4: { + return convertPrecision(output, elementsCount); } - case element::Type_t::u8: { - return convertPrecision(output, elementsCount); + case ov::element::Type_t::u8: { + return convertPrecision(output, elementsCount); } - case element::Type_t::u16: { - return convertPrecision(output, elementsCount); + case ov::element::Type_t::u16: { + return convertPrecision(output, elementsCount); } - case element::Type_t::u32: { - return convertPrecision(output, elementsCount); + case ov::element::Type_t::u32: { + return convertPrecision(output, elementsCount); } - case element::Type_t::u64: { - return convertPrecision(output, elementsCount); + case ov::element::Type_t::u64: { + return convertPrecision(output, elementsCount); } default: throw std::runtime_error(std::string("convertOutputPrecision can't convert from: ") + - element::Type(FromType).get_type_name() + - " to: " + element::Type(toPrecision).get_type_name()); + ov::element::Type(FromType).get_type_name() + + " to: " + ov::element::Type(toPrecision).get_type_name()); } } } // namespace std::vector convertOutputPrecision(const std::vector& output, - const element::Type_t& fromPrecision, - const element::Type_t& toPrecision, + const ov::element::Type_t& fromPrecision, + const ov::element::Type_t& toPrecision, const size_t elementsCount) { switch (fromPrecision) { - case element::Type_t::boolean: { - return convertPrecisionFrom(output, toPrecision, elementsCount); + case ov::element::Type_t::boolean: { + return convertPrecisionFrom(output, toPrecision, elementsCount); } - case element::Type_t::bf16: { - return convertPrecisionFrom(output, toPrecision, elementsCount); + case ov::element::Type_t::bf16: { + return convertPrecisionFrom(output, toPrecision, elementsCount); } - case element::Type_t::f16: { - return convertPrecisionFrom(output, toPrecision, elementsCount); + case ov::element::Type_t::f16: { + return convertPrecisionFrom(output, toPrecision, elementsCount); } - case element::Type_t::f32: { - return convertPrecisionFrom(output, toPrecision, elementsCount); + case ov::element::Type_t::f32: { + return convertPrecisionFrom(output, toPrecision, elementsCount); } - case element::Type_t::f64: { - return convertPrecisionFrom(output, toPrecision, elementsCount); + case ov::element::Type_t::f64: { + return convertPrecisionFrom(output, toPrecision, elementsCount); } - case element::Type_t::i4: { - return convertPrecisionFrom(output, toPrecision, elementsCount); + case ov::element::Type_t::i4: { + return convertPrecisionFrom(output, toPrecision, elementsCount); } - case element::Type_t::i8: { - return convertPrecisionFrom(output, toPrecision, elementsCount); + case ov::element::Type_t::i8: { + return convertPrecisionFrom(output, toPrecision, elementsCount); } - case element::Type_t::i16: { - return convertPrecisionFrom(output, toPrecision, elementsCount); + case ov::element::Type_t::i16: { + return convertPrecisionFrom(output, toPrecision, elementsCount); } - case element::Type_t::i32: { - return convertPrecisionFrom(output, toPrecision, elementsCount); + case ov::element::Type_t::i32: { + return convertPrecisionFrom(output, toPrecision, elementsCount); } - case element::Type_t::i64: { - return convertPrecisionFrom(output, toPrecision, elementsCount); + case ov::element::Type_t::i64: { + return convertPrecisionFrom(output, toPrecision, elementsCount); } - case element::Type_t::u1: { - return convertPrecisionFrom(output, toPrecision, elementsCount); + case ov::element::Type_t::u1: { + return convertPrecisionFrom(output, toPrecision, elementsCount); } - case element::Type_t::u4: { - return convertPrecisionFrom(output, toPrecision, elementsCount); + case ov::element::Type_t::u4: { + return convertPrecisionFrom(output, toPrecision, elementsCount); } - case element::Type_t::u8: { - return convertPrecisionFrom(output, toPrecision, elementsCount); + case ov::element::Type_t::u8: { + return convertPrecisionFrom(output, toPrecision, elementsCount); } - case element::Type_t::u16: { - return convertPrecisionFrom(output, toPrecision, elementsCount); + case ov::element::Type_t::u16: { + return convertPrecisionFrom(output, toPrecision, elementsCount); } - case element::Type_t::u32: { - return convertPrecisionFrom(output, toPrecision, elementsCount); + case ov::element::Type_t::u32: { + return convertPrecisionFrom(output, toPrecision, elementsCount); } - case element::Type_t::u64: { - return convertPrecisionFrom(output, toPrecision, elementsCount); + case ov::element::Type_t::u64: { + return convertPrecisionFrom(output, toPrecision, elementsCount); } default: throw std::runtime_error(std::string("convertOutputPrecision can't convert from: ") + - element::Type(fromPrecision).get_type_name() + " precision"); + ov::element::Type(fromPrecision).get_type_name() + " precision"); } } diff --git a/src/tests/ov_helpers/ov_snippets_models/src/subgraph_matmul.cpp b/src/tests/ov_helpers/ov_snippets_models/src/subgraph_matmul.cpp index 6f11a8377c0..ba4e403365f 100644 --- a/src/tests/ov_helpers/ov_snippets_models/src/subgraph_matmul.cpp +++ b/src/tests/ov_helpers/ov_snippets_models/src/subgraph_matmul.cpp @@ -18,10 +18,10 @@ std::shared_ptr MatMulFunction::initOriginal() const { std::shared_ptr matmul; if (precisions[1] == ov::element::i8) { matmul = std::make_shared>( - std::vector{element::f32, element::f32}, - std::vector{ element::f32 }, - ov::op::TemporaryReplaceOutputType(data0, element::f32).get(), - ov::op::TemporaryReplaceOutputType(data1, element::f32).get()); + std::vector{ov::element::f32, element::f32}, + std::vector{element::f32}, + ov::op::TemporaryReplaceOutputType(data0, element::f32).get(), + ov::op::TemporaryReplaceOutputType(data1, element::f32).get()); } else { matmul = std::make_shared(data0, data1); } @@ -96,10 +96,10 @@ std::shared_ptr MatMulBiasQuantizedFunction::initOriginal() const { auto data1 = std::make_shared(precisions[1], input_shapes[1]); auto data2 = std::make_shared(precision, input_shapes[2]); auto matmul = std::make_shared>( - std::vector{element::f32, element::f32}, - std::vector{ element::f32 }, - ov::op::TemporaryReplaceOutputType(data0, element::f32).get(), - ov::op::TemporaryReplaceOutputType(data1, element::f32).get()); + std::vector{ov::element::f32, element::f32}, + std::vector{element::f32}, + ov::op::TemporaryReplaceOutputType(data0, element::f32).get(), + ov::op::TemporaryReplaceOutputType(data1, element::f32).get()); auto fq2 = ov::test::utils::make_fake_quantize(matmul, ov::element::f32, 256, {1}, {-35.0172004}, {34.7436294}, {-35.0172004}, {34.7436294}); auto bias = std::make_shared(fq2, data2); return std::make_shared(NodeVector{bias}, ParameterVector{data0, data1, data2}); @@ -109,21 +109,28 @@ std::shared_ptr MatMulsQuantizedFunction::initOriginal() const { auto data1 = std::make_shared(precisions[1], input_shapes[1]); auto data2 = std::make_shared(precision, input_shapes[2]); auto matmul0 = std::make_shared>( - std::vector{element::f32, element::f32}, - std::vector{ element::f32 }, - ov::op::TemporaryReplaceOutputType(data0, element::f32).get(), - ov::op::TemporaryReplaceOutputType(data1, element::f32).get()); + std::vector{ov::element::f32, element::f32}, + std::vector{element::f32}, + ov::op::TemporaryReplaceOutputType(data0, element::f32).get(), + ov::op::TemporaryReplaceOutputType(data1, element::f32).get()); auto fq0 = ov::test::utils::make_fake_quantize(matmul0, ov::element::f32, 256, {1}, {0}, {0.820726}, {0}, {0.820726}); auto fq2 = ov::test::utils::make_fake_quantize(data2, ov::element::f32, 256, {1}, {-35.0172004}, {34.7436294}, {-35.0172004}, {34.7436294}); auto new_shape = std::make_shared(ov::element::u64, ov::Shape{4}, std::vector{1, 1, input_shapes[2].get_shape()[0], input_shapes[2].get_shape()[1]}); auto reshape = std::make_shared(fq2, new_shape, false); auto matmul1 = std::make_shared>( - std::vector{element::f32, element::f32}, - std::vector{ element::f32 }, - ov::op::TemporaryReplaceOutputType(fq0, element::f32).get(), - ov::op::TemporaryReplaceOutputType(reshape, element::f32).get()); - auto fq3 = ov::test::utils::make_fake_quantize(matmul1, ov::element::f32, 256, {1}, {-35.0172004}, {34.7436294}, {-35.0172004}, {34.7436294}); + std::vector{ov::element::f32, element::f32}, + std::vector{element::f32}, + ov::op::TemporaryReplaceOutputType(fq0, element::f32).get(), + ov::op::TemporaryReplaceOutputType(reshape, element::f32).get()); + auto fq3 = ov::test::utils::make_fake_quantize(matmul1, + ov::element::f32, + 256, + {1}, + {-35.0172004}, + {34.7436294}, + {-35.0172004}, + {34.7436294}); return std::make_shared(NodeVector{fq3}, ParameterVector{data0, data1, data2}); } std::shared_ptr Transpose0213MatMulFunction::initOriginal() const { @@ -136,10 +143,10 @@ std::shared_ptr Transpose0213MatMulFunction::initOriginal() const { auto transpose = std::make_shared(data0, const_order); if (precisions[1] == ov::element::i8) { result = std::make_shared>( - std::vector{element::f32, element::f32}, - std::vector{ element::f32 }, - ov::op::TemporaryReplaceOutputType(transpose, element::f32).get(), - ov::op::TemporaryReplaceOutputType(data1, element::f32).get()); + std::vector{ov::element::f32, element::f32}, + std::vector{element::f32}, + ov::op::TemporaryReplaceOutputType(transpose, element::f32).get(), + ov::op::TemporaryReplaceOutputType(data1, element::f32).get()); } else { result = std::make_shared(transpose, data1); } @@ -148,10 +155,10 @@ std::shared_ptr Transpose0213MatMulFunction::initOriginal() const { auto transpose = std::make_shared(data1, const_order); if (precisions[1] == ov::element::i8) { result = std::make_shared>( - std::vector{element::f32, element::f32}, - std::vector{ element::f32 }, - ov::op::TemporaryReplaceOutputType(data0, element::f32).get(), - ov::op::TemporaryReplaceOutputType(transpose, element::f32).get()); + std::vector{ov::element::f32, element::f32}, + std::vector{element::f32}, + ov::op::TemporaryReplaceOutputType(data0, element::f32).get(), + ov::op::TemporaryReplaceOutputType(transpose, element::f32).get()); } else { result = std::make_shared(data0, transpose); } @@ -160,10 +167,10 @@ std::shared_ptr Transpose0213MatMulFunction::initOriginal() const { std::shared_ptr matmul; if (precisions[1] == ov::element::i8) { matmul = std::make_shared>( - std::vector{element::f32, element::f32}, - std::vector{ element::f32 }, - ov::op::TemporaryReplaceOutputType(data0, element::f32).get(), - ov::op::TemporaryReplaceOutputType(data1, element::f32).get()); + std::vector{ov::element::f32, element::f32}, + std::vector{element::f32}, + ov::op::TemporaryReplaceOutputType(data0, element::f32).get(), + ov::op::TemporaryReplaceOutputType(data1, element::f32).get()); } else { matmul = std::make_shared(data0, data1); } @@ -209,10 +216,10 @@ std::shared_ptr MatMulsQuantizedSoftmaxFunction::initOriginal() const auto data1 = std::make_shared(precisions[1], input_shapes[1]); auto data2 = std::make_shared(precision, input_shapes[2]); auto matmul0 = std::make_shared>( - std::vector{element::f32, element::f32}, - std::vector{ element::f32 }, - ov::op::TemporaryReplaceOutputType(data0, element::f32).get(), - ov::op::TemporaryReplaceOutputType(data1, element::f32).get()); + std::vector{ov::element::f32, element::f32}, + std::vector{element::f32}, + ov::op::TemporaryReplaceOutputType(data0, element::f32).get(), + ov::op::TemporaryReplaceOutputType(data1, element::f32).get()); auto softmax = std::make_shared(matmul0, -1); auto fq0 = ov::test::utils::make_fake_quantize(softmax, ov::element::f32, 256, {1}, {0}, {0.820726}, {0}, {0.820726}); auto fq2 = ov::test::utils::make_fake_quantize(data2, ov::element::f32, 256, {1}, {-35.0172004}, {34.7436294}, {-35.0172004}, {34.7436294}); @@ -220,11 +227,18 @@ std::shared_ptr MatMulsQuantizedSoftmaxFunction::initOriginal() const std::vector{1, 1, input_shapes[2].get_shape()[0], input_shapes[2].get_shape()[1]}); auto reshape = std::make_shared(fq2, new_shape, false); auto matmul1 = std::make_shared>( - std::vector{element::f32, element::f32}, - std::vector{ element::f32 }, - ov::op::TemporaryReplaceOutputType(fq0, element::f32).get(), - ov::op::TemporaryReplaceOutputType(reshape, element::f32).get()); - auto fq3 = ov::test::utils::make_fake_quantize(matmul1, ov::element::f32, 256, {1}, {-35.0172004}, {34.7436294}, {-35.0172004}, {34.7436294}); + std::vector{ov::element::f32, element::f32}, + std::vector{element::f32}, + ov::op::TemporaryReplaceOutputType(fq0, element::f32).get(), + ov::op::TemporaryReplaceOutputType(reshape, element::f32).get()); + auto fq3 = ov::test::utils::make_fake_quantize(matmul1, + ov::element::f32, + 256, + {1}, + {-35.0172004}, + {34.7436294}, + {-35.0172004}, + {34.7436294}); return std::make_shared(NodeVector{fq3}, ParameterVector{data0, data1, data2}); }