From ca44b35daefcc3b91448583a9c5e3a83b0973062 Mon Sep 17 00:00:00 2001 From: Evgeniia Nugmanova Date: Wed, 28 Feb 2024 13:32:51 +0400 Subject: [PATCH] Changes in corresponding components after making label tracking public --- .../dimension_tracking.hpp | 3 +- .../symbolic_optimizations.hpp | 2 +- .../symbolic_transformations/utils.hpp | 2 +- .../dimension_tracking.cpp | 44 ++++---- .../smart_reshape/lstm_states_broadcast.cpp | 10 +- .../chained_maximum.cpp | 2 +- .../dereshape_matmul.cpp | 2 +- .../label_optimization.cpp | 14 +-- .../nop_broadcast.cpp | 2 +- .../reshape_optimizations.cpp | 1 - .../symbolic_optimizations.cpp | 19 ++-- .../symbolic_transformations/utils.cpp | 12 +- .../dimension_tracking.cpp | 104 +++++++++--------- .../chained_maximum.cpp | 1 - .../dereshape_fullyconnected.cpp | 38 +++---- .../dereshape_matmul.cpp | 7 +- .../label_optimization.cpp | 1 - .../nop_broadcast.cpp | 34 ++---- .../reshape_optimizations.cpp | 50 ++++----- .../openvino/op/util/symbolic_info.hpp | 16 +-- .../include/fft_base_shape_inference.hpp | 4 +- .../include/reshape_shape_inference.hpp | 9 +- src/core/src/bound_evaluate.cpp | 2 +- src/core/src/op/concat.cpp | 2 +- src/core/src/op/reshape.cpp | 2 +- src/core/src/op/shape_of.cpp | 4 +- src/core/src/op/util/symbolic_info.cpp | 14 +-- src/core/src/partial_shape.cpp | 4 +- src/core/src/validation_util.cpp | 4 +- src/core/tests/dimension.cpp | 15 ++- src/core/tests/evaluate_bound/concat.cpp | 1 - src/core/tests/type_prop/arithmetic_ops.hpp | 37 +++---- .../tests/type_prop/binary_elementwise.cpp | 2 +- src/core/tests/type_prop/bitwise_ops.hpp | 37 +++---- src/core/tests/type_prop/broadcast.cpp | 6 +- src/core/tests/type_prop/concat.cpp | 10 +- src/core/tests/type_prop/convert.cpp | 8 +- .../tests/type_prop/ctc_greedy_decoder.cpp | 2 +- .../type_prop/ctc_greedy_decoder_seq_len.cpp | 2 +- src/core/tests/type_prop/detection_output.cpp | 2 +- src/core/tests/type_prop/einsum.cpp | 2 +- src/core/tests/type_prop/eye.cpp | 8 +- src/core/tests/type_prop/fft_base_complex.cpp | 4 +- src/core/tests/type_prop/gather.cpp | 18 +-- src/core/tests/type_prop/gather_elements.cpp | 2 +- src/core/tests/type_prop/gather_nd.cpp | 2 +- src/core/tests/type_prop/gather_tree.cpp | 2 +- src/core/tests/type_prop/grid_sample.cpp | 2 +- src/core/tests/type_prop/logical_ops.hpp | 2 +- src/core/tests/type_prop/matmul.cpp | 4 +- src/core/tests/type_prop/one_hot.cpp | 4 +- src/core/tests/type_prop/prior_box.cpp | 2 +- .../tests/type_prop/prior_box_clustered.cpp | 2 +- src/core/tests/type_prop/reshape.cpp | 30 ++--- src/core/tests/type_prop/rnn_cell_base.cpp | 12 +- src/core/tests/type_prop/rnn_seq_base.cpp | 32 +++--- src/core/tests/type_prop/scatter_update.cpp | 10 +- src/core/tests/type_prop/select.cpp | 2 +- src/core/tests/type_prop/shape_of.cpp | 10 +- src/core/tests/type_prop/slice.cpp | 6 +- src/core/tests/type_prop/squeeze.cpp | 2 +- src/core/tests/type_prop/strided_slice.cpp | 4 +- src/core/tests/type_prop/tile.cpp | 2 +- src/core/tests/type_prop/top_k.cpp | 4 +- src/core/tests/type_prop/transpose.cpp | 2 +- src/core/tests/type_prop/unsqueeze.cpp | 2 +- src/core/tests/type_prop/variadic_split.cpp | 2 +- src/inference/src/check_network_batchable.cpp | 6 +- src/plugins/auto_batch/src/plugin.cpp | 10 +- .../tests/unit/async_infer_request_test.cpp | 2 +- .../tests/unit/plugin_compile_model_test.cpp | 6 +- .../tests/unit/sync_infer_request_test.cpp | 2 +- .../cpu_opset/common/pass/ngram_fusion.cpp | 6 +- src/plugins/intel_gpu/src/plugin/plugin.cpp | 3 +- .../include/common_test_utils/type_prop.hpp | 2 +- .../common_test_utils/src/type_prop.cpp | 4 +- 76 files changed, 350 insertions(+), 396 deletions(-) diff --git a/src/common/transformations/include/transformations/common_optimizations/dimension_tracking.hpp b/src/common/transformations/include/transformations/common_optimizations/dimension_tracking.hpp index a4c655a9591ed8..f6a81234a122df 100644 --- a/src/common/transformations/include/transformations/common_optimizations/dimension_tracking.hpp +++ b/src/common/transformations/include/transformations/common_optimizations/dimension_tracking.hpp @@ -33,7 +33,6 @@ class ov::pass::FindBatch : public ov::pass::ModelPass { }; namespace ov { -class DimensionTracker; namespace batch_util { void mark_batch(const std::shared_ptr& parameter, @@ -43,7 +42,7 @@ void mark_no_batch(const std::shared_ptr& parameter, P2Bt void mark_layout_independent_batch(const std::shared_ptr& parameter, const std::shared_ptr& result, P2Btype& map); -void mark_with_unique_dimension_labels(const std::shared_ptr& m, const ov::DimensionTracker& dt); +void mark_with_unique_dimension_labels(const std::shared_ptr& m, const std::shared_ptr& dt); void restore_original_dimensions( const std::shared_ptr& model, const std::map, ov::PartialShape>& parameter_to_shape, diff --git a/src/common/transformations/include/transformations/symbolic_transformations/symbolic_optimizations.hpp b/src/common/transformations/include/transformations/symbolic_transformations/symbolic_optimizations.hpp index 4357b4b38bb9e1..fea0a61171d3ca 100644 --- a/src/common/transformations/include/transformations/symbolic_transformations/symbolic_optimizations.hpp +++ b/src/common/transformations/include/transformations/symbolic_transformations/symbolic_optimizations.hpp @@ -47,7 +47,7 @@ class ov::pass::SymbolicPropagation : public ov::pass::ModelPass { bool run_on_model(const std::shared_ptr& m) override; private: - std::shared_ptr m_te; + std::shared_ptr m_te; }; /** diff --git a/src/common/transformations/include/transformations/symbolic_transformations/utils.hpp b/src/common/transformations/include/transformations/symbolic_transformations/utils.hpp index 9d2ecdda82d582..cfc0804c6d850f 100644 --- a/src/common/transformations/include/transformations/symbolic_transformations/utils.hpp +++ b/src/common/transformations/include/transformations/symbolic_transformations/utils.hpp @@ -39,7 +39,7 @@ TRANSFORMATIONS_API bool get_labels(const ov::Output& output, ov::Tens TRANSFORMATIONS_API bool are_unique_and_equal_labels(const ov::TensorLabel& lhs, const ov::TensorLabel& rhs); /// \brief Compares dimensions: if dimensions are static compares values of dimensions, if dimensions are dynamic -/// compares their respective labels using TableOfEquivalence +/// compares their respective labels using LabelTable /// /// \param lhs Dimension object to compare /// \param rhs Dimension object to compare diff --git a/src/common/transformations/src/transformations/common_optimizations/dimension_tracking.cpp b/src/common/transformations/src/transformations/common_optimizations/dimension_tracking.cpp index 18f03bd99e13c6..cf0c677c28b360 100644 --- a/src/common/transformations/src/transformations/common_optimizations/dimension_tracking.cpp +++ b/src/common/transformations/src/transformations/common_optimizations/dimension_tracking.cpp @@ -8,7 +8,7 @@ #include #include "itt.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/core/rt_info.hpp" #include "openvino/op/convert.hpp" #include "openvino/op/convert_like.hpp" @@ -22,12 +22,11 @@ #include "openvino/op/shape_of.hpp" void ov::batch_util::mark_with_unique_dimension_labels(const std::shared_ptr& m, - const ov::DimensionTracker& dt) { - ov::label_t i = 1; + const std::shared_ptr& te) { for (auto& parameter : m->get_parameters()) { ov::PartialShape new_shape = ov::PartialShape::dynamic(parameter->get_partial_shape().rank()); for (auto& dim : new_shape) - dt.set_up_for_tracking(dim, i++); + te->set_up_for_tracking(dim); parameter->set_partial_shape(new_shape); } m->validate_nodes_and_infer_types(); @@ -41,11 +40,11 @@ void ov::batch_util::mark_batch(const std::shared_ptr& pa std::unordered_set intersection_in_all_three_sources_of_batch; auto mapped_batches = map[parameter]; for (auto& dim : shape) { - const auto& dim_label = ov::DimensionTracker::get_label(dim); + const auto& dim_label = dim.get_label(); if (batches.count(dim_label) && mapped_batches.count(dim_label)) { intersection_in_all_three_sources_of_batch.insert(dim_label); } else { - ov::DimensionTracker::reset_tracking_info(dim); + ov::LabelTable::reset_tracking_info(dim); } } } else { @@ -53,11 +52,11 @@ void ov::batch_util::mark_batch(const std::shared_ptr& pa // 1) It is our first time marking batch for this node // 2) This node was marked as 'no_batch' previously. 'no_batch' has higher priority, batch won't be set for (auto& dim : shape) { - const auto& dim_label = ov::DimensionTracker::get_label(dim); + const auto& dim_label = dim.get_label(); if (batches.count(dim_label)) { // this is one of the batches map[parameter].insert(dim_label); } else { - ov::DimensionTracker::reset_tracking_info(dim); + ov::LabelTable::reset_tracking_info(dim); } } } @@ -71,10 +70,10 @@ void ov::batch_util::mark_layout_independent_batch(const std::shared_ptrget_output_partial_shape(0)) - if (const auto& label = ov::DimensionTracker::get_label(dim)) + if (const auto& label = dim.get_label()) r_labels.push_back(label); for (const auto& dim : parameter->get_partial_shape()) { - if (const auto& label = ov::DimensionTracker::get_label(dim)) { + if (const auto& label = dim.get_label()) { if (std::find(r_labels.begin(), r_labels.end(), label) != r_labels.end()) { mark_batch(parameter, map, std::unordered_set{label}); return; @@ -90,7 +89,7 @@ void ov::batch_util::mark_no_batch(const std::shared_ptr& map.erase(parameter); auto& shape = parameter->get_partial_shape(); for (auto& dim : shape) - ov::DimensionTracker::reset_tracking_info(dim); + ov::LabelTable::reset_tracking_info(dim); parameter->set_partial_shape(shape); parameter->validate_and_infer_types(); } @@ -123,7 +122,7 @@ P2Btype ov::batch_util::find_batch(const std::shared_ptr& f) { if (type_input_port_batch_index.count(curr_node->get_type_info())) { auto batch_placement = type_input_port_batch_index[curr_node->get_type_info()]; const auto& shape = curr_node->input_value(batch_placement.first).get_partial_shape(); - const auto& batch_dim_label = ov::DimensionTracker::get_label(shape[batch_placement.second]); + const auto& batch_dim_label = shape[batch_placement.second].get_label(); if (batch_dim_label == 0) mark_no_batch(parameter, parameter_to_batch_labels); else @@ -135,7 +134,7 @@ P2Btype ov::batch_util::find_batch(const std::shared_ptr& f) { for (const auto& output : curr_node->outputs()) { const auto& output_shape = output.get_partial_shape(); bool name_stays = std::any_of(output_shape.cbegin(), output_shape.cend(), [](const Dimension& d) { - return ov::DimensionTracker::get_label(d) != 0; + return d.get_label() != 0; }); all_outputs_labeled &= name_stays; } @@ -180,11 +179,11 @@ void ov::batch_util::restore_original_dimensions( OPENVINO_ASSERT(batch_marked_shape.size() == original_shape.size()); for (size_t n = 0; n < batch_marked_shape.size(); ++n) { - if (const auto& label = ov::DimensionTracker::get_label(batch_marked_shape[n])) { + if (const auto& label = batch_marked_shape[n].get_label()) { if (leave_batch_dynamic) original_shape[n] = Dimension::dynamic(); if (!clear_labels) - ov::DimensionTracker::set_label(original_shape[n], label); + original_shape[n].set_label(label); } } item.first->set_partial_shape(original_shape); @@ -203,9 +202,9 @@ void ov::batch_util::restore_original_dimensions( auto labeled_rank = labeled_shape.rank(), current_rank = current_shape.rank(); if (labeled_rank.is_static() && current_rank.is_static() && labeled_rank == current_rank) { for (size_t i = 0; i < labeled_shape.size(); ++i) { - auto label = ov::DimensionTracker::get_label(labeled_shape[i]); + auto label = labeled_shape[i].get_label(); if (label != ov::no_label) - ov::DimensionTracker::set_label(current_shape[i], label); + current_shape[i].set_label(label); } item.first->set_output_type(0, item.first->get_element_type(), current_shape); } @@ -222,7 +221,7 @@ bool ov::batch_util::check_batch_tracks_through_all_the_nodes(const std::shared_ bool name_stays = false; bool others_are_static = true; for (const auto& dim : input_shape) - if (ov::DimensionTracker::get_label(dim) == 0) + if (dim.get_label() == 0) others_are_static = others_are_static && dim.is_static(); else name_stays = true; @@ -234,7 +233,7 @@ bool ov::batch_util::check_batch_tracks_through_all_the_nodes(const std::shared_ bool name_stays = false; bool others_are_static = true; for (const auto& dim : output_shape) - if (ov::DimensionTracker::get_label(dim) == 0) + if (dim.get_label() == 0) others_are_static = others_are_static && dim.is_static(); else name_stays = true; @@ -250,7 +249,7 @@ bool ov::batch_util::check_batch_tracks_through_all_the_nodes(const std::shared_ for (const auto& result : results) { const auto& input_shape = result->get_input_partial_shape(0); bool name_stays = std::any_of(input_shape.cbegin(), input_shape.cend(), [](const ov::Dimension& d) { - return ov::DimensionTracker::get_label(d); + return d.get_label(); }); failed_to_propagate_batch |= !name_stays; } @@ -297,8 +296,7 @@ std::map, ov::PartialShape> collect_origi bool ov::pass::FindBatch::run_on_model(const std::shared_ptr& m) { RUN_ON_MODEL_SCOPE(FindBatch); - auto te = std::make_shared(); - ov::DimensionTracker dt(te); + auto te = std::make_shared(); bool model_has_changed = false; if (detach_do) @@ -308,7 +306,7 @@ bool ov::pass::FindBatch::run_on_model(const std::shared_ptr& m) { if (parameter_to_shape.empty()) return model_has_changed; - ov::batch_util::mark_with_unique_dimension_labels(m, dt); + ov::batch_util::mark_with_unique_dimension_labels(m, te); ov::batch_util::find_batch(m); diff --git a/src/common/transformations/src/transformations/smart_reshape/lstm_states_broadcast.cpp b/src/common/transformations/src/transformations/smart_reshape/lstm_states_broadcast.cpp index 0a2340d4620356..ef4f8ab2c83595 100644 --- a/src/common/transformations/src/transformations/smart_reshape/lstm_states_broadcast.cpp +++ b/src/common/transformations/src/transformations/smart_reshape/lstm_states_broadcast.cpp @@ -7,7 +7,7 @@ #include #include "itt.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/dimension.hpp" #include "openvino/op/broadcast.hpp" #include "openvino/op/concat.hpp" #include "openvino/op/constant.hpp" @@ -52,7 +52,7 @@ shared_ptr deduce_outer_source_of_batch_for_inner_lstm_cell( continue; for (ov::Dimension& n : pshape) { n = ov::Dimension::dynamic(); - ov::DimensionTracker::set_label(n, label++); + n.set_label(label++); } parameter->set_partial_shape(pshape); } @@ -62,7 +62,7 @@ shared_ptr deduce_outer_source_of_batch_for_inner_lstm_cell( // if lstm first input has undefined rank or if tracked label is zero -- we failed to track batch dimension // returning body to initial state if (lstm_cell->get_input_partial_shape(0).rank().is_dynamic() || - ov::DimensionTracker::get_label(lstm_cell->get_input_partial_shape(0)[0]) == 0) { + lstm_cell->get_input_partial_shape(0)[0].get_label() == ov::no_label) { for (auto& item : original_shapes) item.first->set_partial_shape(item.second); body->validate_nodes_and_infer_types(); @@ -73,13 +73,13 @@ shared_ptr deduce_outer_source_of_batch_for_inner_lstm_cell( shared_ptr batch_delivering_parameter; size_t index_of_batch_dim = 0; - ov::label_t batch_label = ov::DimensionTracker::get_label(lstm_cell->get_input_partial_shape(0)[0]); + ov::label_t batch_label = lstm_cell->get_input_partial_shape(0)[0].get_label(); for (auto& parameter : body->get_parameters()) { auto pshape = parameter->get_partial_shape(); if (pshape.rank().is_dynamic()) continue; for (size_t i = 0; i < pshape.size(); ++i) { - if (ov::DimensionTracker::get_label(pshape[i]) == batch_label) { + if (pshape[i].get_label() == batch_label) { batch_delivering_parameter = parameter; index_of_batch_dim = i; break; diff --git a/src/common/transformations/src/transformations/symbolic_transformations/chained_maximum.cpp b/src/common/transformations/src/transformations/symbolic_transformations/chained_maximum.cpp index c6bb082990db83..b37b5b580f6d43 100644 --- a/src/common/transformations/src/transformations/symbolic_transformations/chained_maximum.cpp +++ b/src/common/transformations/src/transformations/symbolic_transformations/chained_maximum.cpp @@ -5,7 +5,7 @@ #include "transformations/symbolic_transformations/chained_maximum.hpp" #include "itt.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/dimension.hpp" #include "openvino/op/maximum.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" #include "transformations/symbolic_transformations/utils.hpp" diff --git a/src/common/transformations/src/transformations/symbolic_transformations/dereshape_matmul.cpp b/src/common/transformations/src/transformations/symbolic_transformations/dereshape_matmul.cpp index 99b498c9ad54ec..34faa2e2bca575 100644 --- a/src/common/transformations/src/transformations/symbolic_transformations/dereshape_matmul.cpp +++ b/src/common/transformations/src/transformations/symbolic_transformations/dereshape_matmul.cpp @@ -5,7 +5,7 @@ #include "transformations/symbolic_transformations/dereshape_matmul.hpp" #include "itt.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/dimension.hpp" #include "openvino/core/validation_util.hpp" #include "openvino/op/concat.hpp" #include "openvino/op/convert.hpp" diff --git a/src/common/transformations/src/transformations/symbolic_transformations/label_optimization.cpp b/src/common/transformations/src/transformations/symbolic_transformations/label_optimization.cpp index 06a046c3bfa5f2..a67378b74230d4 100644 --- a/src/common/transformations/src/transformations/symbolic_transformations/label_optimization.cpp +++ b/src/common/transformations/src/transformations/symbolic_transformations/label_optimization.cpp @@ -6,7 +6,7 @@ #include "itt.hpp" #include "openvino/core/bound_evaluation_util.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/core/rt_info.hpp" #include "openvino/op/add.hpp" #include "openvino/op/concat.hpp" @@ -41,10 +41,10 @@ void apply_table_of_equivalence_on_model(const std::shared_ptr& m, co for (auto& d : shape) { if (d.is_static()) continue; - auto label = ov::DimensionTracker::get_label(d); + auto label = d.get_label(); update_label(table, label); if (label != ov::no_label) - ov::DimensionTracker::set_label(d, label); + d.set_label(label); } op->set_output_type(output.get_index(), output.get_element_type(), shape); // value relabeling @@ -77,7 +77,7 @@ int64_t get_idx_of_label_in_source(const ov::Output& source, const ov: if (rank.is_dynamic()) return idx; for (int64_t i = 0; i < rank.get_length(); ++i) { - auto l = ov::DimensionTracker::get_label(pshape[i]); + auto l = pshape[i].get_label(); if (l == label) { idx = i; break; @@ -175,13 +175,13 @@ ov::Output alternative_source_from_concat_input_sources(const LTS_map& const auto& lhs_pshape = concat->get_input_partial_shape(0); const auto& rhs_pshape = concat->get_input_partial_shape(1); if (lhs_pshape.rank().is_static() && rhs_pshape.rank().is_static()) { - auto lhs_label = ov::DimensionTracker::get_label(lhs_pshape[idx]); + auto lhs_label = lhs_pshape[idx].get_label(); auto lhs_alternative = get_alternative_source_from_value_or_shape_source(label_shape_source, lhs_label, original_output, label_value_source); - auto rhs_label = ov::DimensionTracker::get_label(rhs_pshape[idx]); + auto rhs_label = rhs_pshape[idx].get_label(); auto rhs_alternative = get_alternative_source_from_value_or_shape_source(label_shape_source, rhs_label, original_output, @@ -228,7 +228,7 @@ void save_shape_sources(const ov::Output& output, LTS_map& label_shape for (const auto& d : output.get_partial_shape()) { if (d.is_static()) continue; - auto label = ov::DimensionTracker::get_label(d); + auto label = d.get_label(); if (label == ov::no_label || label_shape_source.count(label)) continue; label_shape_source[label] = output; diff --git a/src/common/transformations/src/transformations/symbolic_transformations/nop_broadcast.cpp b/src/common/transformations/src/transformations/symbolic_transformations/nop_broadcast.cpp index 6890446f455ee8..620d44d49c055d 100644 --- a/src/common/transformations/src/transformations/symbolic_transformations/nop_broadcast.cpp +++ b/src/common/transformations/src/transformations/symbolic_transformations/nop_broadcast.cpp @@ -6,7 +6,7 @@ #include "compare.hpp" #include "itt.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/dimension.hpp" #include "openvino/op/broadcast.hpp" #include "openvino/op/maximum.hpp" #include "openvino/op/shape_of.hpp" diff --git a/src/common/transformations/src/transformations/symbolic_transformations/reshape_optimizations.cpp b/src/common/transformations/src/transformations/symbolic_transformations/reshape_optimizations.cpp index c533a752eed731..709d2cd9452eb5 100644 --- a/src/common/transformations/src/transformations/symbolic_transformations/reshape_optimizations.cpp +++ b/src/common/transformations/src/transformations/symbolic_transformations/reshape_optimizations.cpp @@ -6,7 +6,6 @@ #include "compare.hpp" #include "itt.hpp" -#include "openvino/core/dimension_tracker.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" #include "transformations/symbolic_transformations/utils.hpp" #include "transformations/utils/utils.hpp" diff --git a/src/common/transformations/src/transformations/symbolic_transformations/symbolic_optimizations.cpp b/src/common/transformations/src/transformations/symbolic_transformations/symbolic_optimizations.cpp index 1676c7206fad95..2ae664da895f91 100644 --- a/src/common/transformations/src/transformations/symbolic_transformations/symbolic_optimizations.cpp +++ b/src/common/transformations/src/transformations/symbolic_transformations/symbolic_optimizations.cpp @@ -6,7 +6,7 @@ #include "itt.hpp" #include "openvino/core/descriptor_tensor.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/core/validation_util.hpp" #include "openvino/op/reshape.hpp" #include "openvino/op/util/symbolic_info.hpp" @@ -30,16 +30,16 @@ using namespace ov::pass; using namespace ov::symbol::util; namespace { -void symbolic_set_up_for_shape(ov::DimensionTracker& dt, ov::PartialShape& shape) { +void symbolic_set_up_for_shape(const std::shared_ptr& te, ov::PartialShape& shape) { if (shape.rank().is_dynamic()) return; for (auto& d : shape) { - bool is_static = d.is_static(), has_label = ov::DimensionTracker::has_label(d); + bool is_static = d.is_static(), has_label = d.has_label(); if (is_static && has_label) - dt.reset_tracking_info(d); // remove labels from static dims on shapes to reduce label clutter + te->reset_tracking_info(d); // remove labels from static dims on shapes to reduce label clutter if (is_static || has_label) continue; - dt.set_up_for_tracking(d); + te->set_up_for_tracking(d); } } @@ -81,15 +81,15 @@ void special_case_range_label_propagation(const std::shared_ptr& node) auto add_in1_label = add_in1_labels[0]; if (add_in0_label == start_label) - ov::DimensionTracker::set_label(output_shape[0], add_in1_label); + output_shape[0].set_label(add_in1_label); else if (add_in1_label == start_label) - ov::DimensionTracker::set_label(output_shape[0], add_in0_label); + output_shape[0].set_label(add_in0_label); node->set_output_type(0, node->get_output_element_type(0), output_shape); } } // namespace ov::pass::SymbolicPropagation::SymbolicPropagation() { - m_te = std::make_shared(); + m_te = std::make_shared(); } bool ov::pass::SymbolicPropagation::run_on_model(const std::shared_ptr& m) { @@ -97,7 +97,6 @@ bool ov::pass::SymbolicPropagation::run_on_model(const std::shared_ptrget_ordered_ops()) { // since we disable invalidation with the following two lines, we have to invalidate manually here @@ -117,7 +116,7 @@ bool ov::pass::SymbolicPropagation::run_on_model(const std::shared_ptroutputs()) { auto shape = output.get_partial_shape(); - symbolic_set_up_for_shape(dt, shape); + symbolic_set_up_for_shape(te, shape); ov::descriptor::set_tensor_type(output.get_tensor(), output.get_element_type(), shape); } } diff --git a/src/common/transformations/src/transformations/symbolic_transformations/utils.cpp b/src/common/transformations/src/transformations/symbolic_transformations/utils.cpp index abe1485bf5fdd3..ed1a93ebcf15c2 100644 --- a/src/common/transformations/src/transformations/symbolic_transformations/utils.cpp +++ b/src/common/transformations/src/transformations/symbolic_transformations/utils.cpp @@ -4,7 +4,7 @@ #include "transformations/symbolic_transformations/utils.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/core/node.hpp" #include "transformations/utils/utils.hpp" @@ -14,7 +14,7 @@ bool ov::symbol::util::get_labels(const ov::PartialShape& shape, ov::TensorLabel labels.clear(); labels.reserve(shape.size()); for (const auto& d : shape) - labels.push_back((d.is_dynamic() ? ov::DimensionTracker::get_label(d) : ov::no_label)); + labels.push_back((d.is_dynamic() ? d.get_label() : ov::no_label)); return true; } @@ -36,15 +36,15 @@ bool ov::symbol::util::are_unique_and_equal_labels(const ov::TensorLabel& lhs, c bool ov::symbol::util::dims_are_equal(const ov::Dimension& lhs, const ov::Dimension& rhs) { if (lhs.is_static() && lhs == rhs) return true; - auto lhs_label = ov::DimensionTracker::get_label(lhs); - auto rhs_label = ov::DimensionTracker::get_label(rhs); + auto lhs_label = lhs.get_label(); + auto rhs_label = rhs.get_label(); if (lhs_label == ov::no_label || rhs_label == ov::no_label) return false; if (lhs_label == rhs_label) return true; - if (auto table_l = ov::DimensionTracker::get_table_of_equivalence(lhs)) + if (auto table_l = lhs.get_label_table()) return table_l->are_equal(lhs, rhs); - if (auto table_r = ov::DimensionTracker::get_table_of_equivalence(rhs)) + if (auto table_r = rhs.get_label_table()) return table_r->are_equal(lhs, rhs); return false; } diff --git a/src/common/transformations/tests/common_optimizations/dimension_tracking.cpp b/src/common/transformations/tests/common_optimizations/dimension_tracking.cpp index 35440c2b62b788..358e2dfd738e97 100644 --- a/src/common/transformations/tests/common_optimizations/dimension_tracking.cpp +++ b/src/common/transformations/tests/common_optimizations/dimension_tracking.cpp @@ -12,7 +12,7 @@ #include "common_test_utils/ov_test_utils.hpp" #include "common_test_utils/subgraph_builders/detection_output.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/dimension.hpp" #include "openvino/core/model.hpp" #include "openvino/opsets/opset1.hpp" #include "openvino/pass/manager.hpp" @@ -25,7 +25,7 @@ using namespace testing; TEST(TransformationTests, AutoBatch_LabelPropagation_Transpose) { auto batch = ov::Dimension(5); - ov::DimensionTracker::set_label(batch, 7); + batch.set_label(7); auto p_shape = ov::PartialShape{batch, 4, 6, 8}; auto arg = std::make_shared(ov::element::f32, p_shape); @@ -35,12 +35,12 @@ TEST(TransformationTests, AutoBatch_LabelPropagation_Transpose) { EXPECT_EQ(r->get_output_element_type(0), ov::element::f32); EXPECT_EQ(r->get_output_partial_shape(0), ov::PartialShape({6, 4, batch, 8})); - EXPECT_EQ(ov::DimensionTracker::get_label(r->get_output_partial_shape(0)[2]), 7); + EXPECT_EQ(r->get_output_partial_shape(0)[2].get_label(), 7); } TEST(TransformationTests, AutoBatch_LabelPropagation_Convolution) { auto batch = ov::Dimension(5); - ov::DimensionTracker::set_label(batch, 7); + batch.set_label(7); auto p_shape = ov::PartialShape{batch, 4, 6, 8}; auto arg = std::make_shared(ov::element::f32, p_shape); @@ -55,7 +55,7 @@ TEST(TransformationTests, AutoBatch_LabelPropagation_Convolution) { EXPECT_EQ(conv->get_output_element_type(0), ov::element::f32); EXPECT_EQ(conv->get_output_partial_shape(0), ov::PartialShape({batch, 1, 4, 6})); - EXPECT_EQ(ov::DimensionTracker::get_label(conv->get_output_partial_shape(0)[0]), 7); + EXPECT_EQ(conv->get_output_partial_shape(0)[0].get_label(), 7); } TEST(TransformationTests, AutoBatch_FindBatch_Transpose_and_Convolution) { @@ -82,16 +82,16 @@ TEST(TransformationTests, AutoBatch_FindBatch_Transpose_and_Convolution) { ASSERT_NO_THROW(check_rt_info(f)); const auto& shape = data->get_partial_shape(); - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[0])) << shape; - ASSERT_TRUE(ov::DimensionTracker::get_label(shape[1])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[2])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[3])) << shape; + ASSERT_TRUE(!shape[0].get_label()) << shape; + ASSERT_TRUE(shape[1].get_label()) << shape; + ASSERT_TRUE(!shape[2].get_label()) << shape; + ASSERT_TRUE(!shape[3].get_label()) << shape; const auto& out_shape = f->get_results()[0]->get_output_partial_shape(0); - ASSERT_TRUE(ov::DimensionTracker::get_label(out_shape[0])) << out_shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(out_shape[1])) << out_shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(out_shape[2])) << out_shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(out_shape[3])) << out_shape; + ASSERT_TRUE(out_shape[0].get_label()) << out_shape; + ASSERT_TRUE(!out_shape[1].get_label()) << out_shape; + ASSERT_TRUE(!out_shape[2].get_label()) << out_shape; + ASSERT_TRUE(!out_shape[3].get_label()) << out_shape; } TEST(TransformationTests, AutoBatch_LabelPropagation_Convolution_Reshape) { @@ -117,15 +117,15 @@ TEST(TransformationTests, AutoBatch_LabelPropagation_Convolution_Reshape) { ASSERT_NO_THROW(check_rt_info(model)); const auto& shape = data->get_partial_shape(); - ASSERT_TRUE(ov::DimensionTracker::get_label(shape[0])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[1])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[2])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[3])) << shape; + ASSERT_TRUE(shape[0].get_label()) << shape; + ASSERT_TRUE(!shape[1].get_label()) << shape; + ASSERT_TRUE(!shape[2].get_label()) << shape; + ASSERT_TRUE(!shape[3].get_label()) << shape; const auto& out_shape = model->get_results()[0]->get_output_partial_shape(0); - ASSERT_TRUE(ov::DimensionTracker::get_label(out_shape[0])) << out_shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(out_shape[1])) << out_shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(out_shape[2])) << out_shape; + ASSERT_TRUE(out_shape[0].get_label()) << out_shape; + ASSERT_TRUE(!out_shape[1].get_label()) << out_shape; + ASSERT_TRUE(!out_shape[2].get_label()) << out_shape; } TEST(TransformationTests, AutoBatch_FindBatch_SingleMultiply) { @@ -143,10 +143,10 @@ TEST(TransformationTests, AutoBatch_FindBatch_SingleMultiply) { ASSERT_NO_THROW(check_rt_info(f)); const auto& shape = data->get_partial_shape(); - ASSERT_TRUE(ov::DimensionTracker::get_label(shape[0])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[1])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[2])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[3])) << shape; + ASSERT_TRUE(shape[0].get_label()) << shape; + ASSERT_TRUE(!shape[1].get_label()) << shape; + ASSERT_TRUE(!shape[2].get_label()) << shape; + ASSERT_TRUE(!shape[3].get_label()) << shape; } TEST(TransformationTests, AutoBatch_FindBatch_Two_Outputs) { @@ -173,10 +173,10 @@ TEST(TransformationTests, AutoBatch_FindBatch_Two_Outputs) { ASSERT_NO_THROW(check_rt_info(f)); const auto& shape = data->get_partial_shape(); - ASSERT_TRUE(ov::DimensionTracker::get_label(shape[0])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[1])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[2])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[3])) << shape; + ASSERT_TRUE(shape[0].get_label()) << shape; + ASSERT_TRUE(!shape[1].get_label()) << shape; + ASSERT_TRUE(!shape[2].get_label()) << shape; + ASSERT_TRUE(!shape[3].get_label()) << shape; } TEST(TransformationTests, AutoBatch_FindBatch_TwoOutputsReversed) { @@ -203,10 +203,10 @@ TEST(TransformationTests, AutoBatch_FindBatch_TwoOutputsReversed) { ASSERT_NO_THROW(check_rt_info(f)); const auto& shape = data->get_partial_shape(); - ASSERT_TRUE(ov::DimensionTracker::get_label(shape[0])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[1])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[2])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[3])) << shape; + ASSERT_TRUE(shape[0].get_label()) << shape; + ASSERT_TRUE(!shape[1].get_label()) << shape; + ASSERT_TRUE(!shape[2].get_label()) << shape; + ASSERT_TRUE(!shape[3].get_label()) << shape; } TEST(TransformationTests, AutoBatch_FindBatch_IndependentBranchesConcated) { @@ -237,10 +237,10 @@ TEST(TransformationTests, AutoBatch_FindBatch_IndependentBranchesConcated) { ASSERT_NO_THROW(check_rt_info(f)); const auto& shape = data->get_partial_shape(); - ASSERT_TRUE(ov::DimensionTracker::get_label(shape[0])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[1])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[2])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[3])) << shape; + ASSERT_TRUE(shape[0].get_label()) << shape; + ASSERT_TRUE(!shape[1].get_label()) << shape; + ASSERT_TRUE(!shape[2].get_label()) << shape; + ASSERT_TRUE(!shape[3].get_label()) << shape; } TEST(TransformationTests, AutoBatch_FindBatch_TwoConvNetwork) { @@ -270,10 +270,10 @@ TEST(TransformationTests, AutoBatch_FindBatch_TwoConvNetwork) { ASSERT_NO_THROW(check_rt_info(f)); const auto& shape = data->get_partial_shape(); - ASSERT_TRUE(ov::DimensionTracker::get_label(shape[0])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[1])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[2])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[3])) << shape; + ASSERT_TRUE(shape[0].get_label()) << shape; + ASSERT_TRUE(!shape[1].get_label()) << shape; + ASSERT_TRUE(!shape[2].get_label()) << shape; + ASSERT_TRUE(!shape[3].get_label()) << shape; } TEST(TransformationTests, AutoBatch_FindBatch_NegativeTracking) { @@ -298,13 +298,13 @@ TEST(TransformationTests, AutoBatch_FindBatch_NegativeTracking) { ASSERT_NO_THROW(check_rt_info(f)); const auto& shape = data->get_partial_shape(); - ASSERT_TRUE(ov::DimensionTracker::get_label(shape[0])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[1])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[2])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[3])) << shape; + ASSERT_TRUE(shape[0].get_label()) << shape; + ASSERT_TRUE(!shape[1].get_label()) << shape; + ASSERT_TRUE(!shape[2].get_label()) << shape; + ASSERT_TRUE(!shape[3].get_label()) << shape; const auto& out_shape = f->get_results()[0]->get_output_partial_shape(0); - ASSERT_TRUE(!ov::DimensionTracker::get_label(out_shape[0])) << out_shape; + ASSERT_TRUE(!out_shape[0].get_label()) << out_shape; } TEST(TransformationTests, AutoBatch_FindBatch_AutoBatch_LabelPropagation_DO_detachment) { @@ -318,21 +318,21 @@ TEST(TransformationTests, AutoBatch_FindBatch_AutoBatch_LabelPropagation_DO_deta ASSERT_NO_THROW(check_rt_info(f)); const auto& shape = data->get_partial_shape(); - ASSERT_TRUE(ov::DimensionTracker::get_label(shape[0])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[1])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[2])) << shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(shape[3])) << shape; + ASSERT_TRUE(shape[0].get_label()) << shape; + ASSERT_TRUE(!shape[1].get_label()) << shape; + ASSERT_TRUE(!shape[2].get_label()) << shape; + ASSERT_TRUE(!shape[3].get_label()) << shape; ASSERT_EQ(f->get_results().size(), 3); for (const auto& result : f->get_results()) { const auto& out_shape = result->get_output_partial_shape(0); - ASSERT_TRUE(ov::DimensionTracker::get_label(out_shape[0])) << out_shape; - ASSERT_TRUE(!ov::DimensionTracker::get_label(out_shape[1])) << out_shape; + ASSERT_TRUE(out_shape[0].get_label()) << out_shape; + ASSERT_TRUE(!out_shape[1].get_label()) << out_shape; } } TEST(partial_shape, cout_with_label) { ov::Dimension a = 5; - ov::DimensionTracker::set_label(a, 100500); + a.set_label(100500); ov::PartialShape shape{1, 2, 3, a}; std::stringstream stream; stream << shape; diff --git a/src/common/transformations/tests/symbolic_transformations/chained_maximum.cpp b/src/common/transformations/tests/symbolic_transformations/chained_maximum.cpp index 9b5506ac2c0fd0..848e506000e26c 100644 --- a/src/common/transformations/tests/symbolic_transformations/chained_maximum.cpp +++ b/src/common/transformations/tests/symbolic_transformations/chained_maximum.cpp @@ -7,7 +7,6 @@ #include #include "common_test_utils/ov_test_utils.hpp" -#include "openvino/core/dimension_tracker.hpp" #include "openvino/core/model.hpp" #include "openvino/op/broadcast.hpp" #include "openvino/op/maximum.hpp" diff --git a/src/common/transformations/tests/symbolic_transformations/dereshape_fullyconnected.cpp b/src/common/transformations/tests/symbolic_transformations/dereshape_fullyconnected.cpp index 8b2fc3075beb68..8cd95a59002511 100644 --- a/src/common/transformations/tests/symbolic_transformations/dereshape_fullyconnected.cpp +++ b/src/common/transformations/tests/symbolic_transformations/dereshape_fullyconnected.cpp @@ -5,7 +5,7 @@ #include #include "common_test_utils/ov_test_utils.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/core/model.hpp" #include "openvino/op/concat.hpp" #include "openvino/op/convert.hpp" @@ -19,19 +19,13 @@ using namespace ov; using namespace ov::op; using namespace std; -namespace { -void label_shape(ov::PartialShape& shape) { - auto table = std::make_shared(42); - auto tracker = ov::DimensionTracker(table); - tracker.set_up_for_tracking(shape); -} -} // namespace - TEST_F(TransformationTestsF, DeReshapeFC) { - { - auto shape = PartialShape{-1, -1, 40}; - label_shape(shape); // we label shape with consecutive labels: 42, 43, 44 + auto table = std::make_shared(42); + auto shape = PartialShape{-1, -1, 40}; + table->set_up_for_tracking(shape); // we label shape with consecutive labels: 42, 43, 44 + + { auto data = make_shared(element::f32, shape); auto in_reshape = make_shared(data, v0::Constant::create(element::i64, {2}, {-1, 40}), true); auto second_input = make_shared(element::f32, Shape{40, 80}); @@ -47,9 +41,6 @@ TEST_F(TransformationTestsF, DeReshapeFC) { manager.register_pass(); } { - auto shape = PartialShape{-1, -1, 40}; - label_shape(shape); // we label shape with consecutive labels: 42, 43, 44 - auto data = make_shared(element::f32, shape); auto second_input = make_shared(element::f32, Shape{40, 80}); auto matmul = make_shared(data, second_input); @@ -59,10 +50,11 @@ TEST_F(TransformationTestsF, DeReshapeFC) { } TEST_F(TransformationTestsF, DeReshapeFCWithConvert) { - { - auto shape = PartialShape{-1, -1, 40}; - label_shape(shape); // we label shape with consecutive labels: 42, 43, 44 + auto table = std::make_shared(42); + auto shape = PartialShape{-1, -1, 40}; + table->set_up_for_tracking(shape); // we label shape with consecutive labels: 42, 43, 44 + { auto data = make_shared(element::f16, shape); auto in_reshape = make_shared(data, v0::Constant::create(element::i64, {2}, {-1, 40}), true); auto convert = make_shared(in_reshape, element::f32); @@ -79,9 +71,6 @@ TEST_F(TransformationTestsF, DeReshapeFCWithConvert) { manager.register_pass(); } { - auto shape = PartialShape{-1, -1, 40}; - label_shape(shape); // we label shape with consecutive labels: 42, 43, 44 - auto data = make_shared(element::f16, shape); auto convert = make_shared(data, element::f32); auto second_input = make_shared(element::f32, Shape{40, 80}); @@ -92,10 +81,11 @@ TEST_F(TransformationTestsF, DeReshapeFCWithConvert) { } TEST_F(TransformationTestsF, DeReshapeFCNegative) { - { - auto shape = PartialShape{-1, -1, 40}; - label_shape(shape); // we label shape with consecutive labels: 42, 43, 44 + auto table = std::make_shared(42); + auto shape = PartialShape{-1, -1, 40}; + table->set_up_for_tracking(shape); // we label shape with consecutive labels: 42, 43, 44 + { auto data = make_shared(element::f16, shape); auto in_reshape = make_shared(data, v0::Constant::create(element::i64, {2}, {-1, 40}), true); auto convert = make_shared(in_reshape, element::f32); diff --git a/src/common/transformations/tests/symbolic_transformations/dereshape_matmul.cpp b/src/common/transformations/tests/symbolic_transformations/dereshape_matmul.cpp index 013540af3bd6c0..b11e98708415cf 100644 --- a/src/common/transformations/tests/symbolic_transformations/dereshape_matmul.cpp +++ b/src/common/transformations/tests/symbolic_transformations/dereshape_matmul.cpp @@ -7,7 +7,7 @@ #include #include "common_test_utils/ov_test_utils.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/core/model.hpp" #include "openvino/core/validation_util.hpp" #include "openvino/op/matmul.hpp" @@ -35,10 +35,9 @@ class DimensionTestHelper { }; explicit DimensionTestHelper(const size_t& num_dims) { - auto te = make_shared(); - auto dt = ov::DimensionTracker(te); + auto te = make_shared(); auto dimensions = PartialShape::dynamic(Rank(num_dims)); - dt.set_up_for_tracking(dimensions); + te->set_up_for_tracking(dimensions); parameter = make_shared(element::f32, dimensions); for (size_t i = 0; i < num_dims; ++i) m_map[i] = {dimensions[i], op::util::node_to_get_shape_value_of_indices_from_shape_source(parameter, {i})}; diff --git a/src/common/transformations/tests/symbolic_transformations/label_optimization.cpp b/src/common/transformations/tests/symbolic_transformations/label_optimization.cpp index 798fd3aa5a1f88..802b4f05478cc5 100644 --- a/src/common/transformations/tests/symbolic_transformations/label_optimization.cpp +++ b/src/common/transformations/tests/symbolic_transformations/label_optimization.cpp @@ -7,7 +7,6 @@ #include #include "common_test_utils/ov_test_utils.hpp" -#include "openvino/core/dimension_tracker.hpp" #include "openvino/op/add.hpp" #include "openvino/op/concat.hpp" #include "openvino/op/gather.hpp" diff --git a/src/common/transformations/tests/symbolic_transformations/nop_broadcast.cpp b/src/common/transformations/tests/symbolic_transformations/nop_broadcast.cpp index b3b6b27f011d3c..e0557c453c9971 100644 --- a/src/common/transformations/tests/symbolic_transformations/nop_broadcast.cpp +++ b/src/common/transformations/tests/symbolic_transformations/nop_broadcast.cpp @@ -7,7 +7,7 @@ #include #include "common_test_utils/ov_test_utils.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/core/model.hpp" #include "openvino/op/broadcast.hpp" #include "openvino/op/maximum.hpp" @@ -19,19 +19,13 @@ using namespace ov; using namespace ov::op; using namespace std; -namespace { -void label_shape(ov::PartialShape& shape) { - auto table = std::make_shared(42); - auto tracker = ov::DimensionTracker(table); - tracker.set_up_for_tracking(shape); -} -} // namespace - TEST_F(TransformationTestsF, NopBroadcastOpset1) { - { - auto shape = PartialShape::dynamic(4); - label_shape(shape); // we label shape with consecutive labels: 42, 43, 44, 45 + auto shape = PartialShape::dynamic(4); + auto table = std::make_shared(42); + table->set_up_for_tracking(shape); // we label shape with consecutive labels: 42, 43, 44, 45 + + { auto data = make_shared(element::f32, shape); auto labeled_input = make_shared(element::f32, shape); @@ -46,9 +40,6 @@ TEST_F(TransformationTestsF, NopBroadcastOpset1) { manager.register_pass(); } { - auto shape = PartialShape::dynamic(4); - label_shape(shape); // we label shape with consecutive labels: 42, 43, 44, 45 - auto data = make_shared(element::f32, shape); auto relu = make_shared(data); @@ -59,10 +50,12 @@ TEST_F(TransformationTestsF, NopBroadcastOpset1) { } TEST_F(TransformationTestsF, NopBroadcastOpset3) { - { - auto shape = PartialShape::dynamic(4); - label_shape(shape); // we label shape with consecutive labels: 42, 43, 44, 45 + auto shape = PartialShape::dynamic(4); + + auto table = std::make_shared(42); + table->set_up_for_tracking(shape); // we label shape with consecutive labels: 42, 43, 44, 45 + { auto data = make_shared(element::f32, shape); auto labeled_input = make_shared(element::f32, shape); @@ -77,9 +70,6 @@ TEST_F(TransformationTestsF, NopBroadcastOpset3) { manager.register_pass(); } { - auto shape = PartialShape::dynamic(4); - label_shape(shape); // we label shape with consecutive labels: 42, 43, 44, 45 - auto data = make_shared(element::f32, shape); auto relu = make_shared(data); @@ -92,7 +82,7 @@ TEST_F(TransformationTestsF, NopBroadcastOpset3) { TEST_F(TransformationTestsF, NopBroadcastNegative) { { auto shape = PartialShape::dynamic(1); - label_shape(shape); // we label shape with consecutive labels: 42 + shape[0].set_label(42); auto data = make_shared(element::f32, shape); diff --git a/src/common/transformations/tests/symbolic_transformations/reshape_optimizations.cpp b/src/common/transformations/tests/symbolic_transformations/reshape_optimizations.cpp index 07af3a6a4eedd1..283e2ca0c7c904 100644 --- a/src/common/transformations/tests/symbolic_transformations/reshape_optimizations.cpp +++ b/src/common/transformations/tests/symbolic_transformations/reshape_optimizations.cpp @@ -7,7 +7,7 @@ #include #include "common_test_utils/ov_test_utils.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/core/model.hpp" #include "openvino/op/concat.hpp" #include "openvino/op/divide.hpp" @@ -21,20 +21,14 @@ using namespace ov; using namespace ov::op; using namespace std; -namespace { -void label_shape(ov::PartialShape& shape) { - auto table = std::make_shared(42); - auto tracker = ov::DimensionTracker(table); - tracker.set_up_for_tracking(shape); -} -} // namespace - TEST_F(TransformationTestsF, FlattenOptimization) { // [A, B, C, D] -> [A, B, C*D] - { - auto shape = PartialShape::dynamic(4); - label_shape(shape); // we label shape with consecutive labels: 42, 43, 44, 45 + auto shape = PartialShape::dynamic(4); + + auto table = std::make_shared(42); + table->set_up_for_tracking(shape); // we label shape with consecutive labels: 42, 43, 44, 45 + { auto data = make_shared(element::f32, shape); auto shape_of = make_shared(data); @@ -55,9 +49,6 @@ TEST_F(TransformationTestsF, FlattenOptimization) { manager.register_pass(); } { - auto shape = PartialShape::dynamic(4); - label_shape(shape); // we label shape with consecutive labels: 42, 43, 44, 45 - auto data = make_shared(element::f32, shape); auto pattern = ov::op::v0::Constant::create(element::i64, {3}, {0, 0, -1}); @@ -69,10 +60,12 @@ TEST_F(TransformationTestsF, FlattenOptimization) { TEST_F(TransformationTestsF, LastDimSplitStaticLast) { // [A, B, C, D] -> [A, B, C, D/8, 8] - { - auto shape = PartialShape::dynamic(4); - label_shape(shape); // we label shape with consecutive labels: 42, 43, 44, 45 + auto shape = PartialShape::dynamic(4); + + auto table = std::make_shared(42); + table->set_up_for_tracking(shape); // we label shape with consecutive labels: 42, 43, 44, 45 + { auto data = make_shared(element::f32, shape); auto shape_of = make_shared(data); @@ -90,9 +83,6 @@ TEST_F(TransformationTestsF, LastDimSplitStaticLast) { manager.register_pass(); } { - auto shape = PartialShape::dynamic(4); - label_shape(shape); // we label shape with consecutive labels: 42, 43, 44, 45 - auto data = make_shared(element::f32, shape); auto pattern = ov::op::v0::Constant::create(element::i64, {5}, {0, 0, 0, -1, 8}); @@ -104,10 +94,12 @@ TEST_F(TransformationTestsF, LastDimSplitStaticLast) { TEST_F(TransformationTestsF, LastDimSplitDymanicLast) { // [A, B, C, D] -> [A, B, C, 8, D/8] - { - auto shape = PartialShape::dynamic(4); - label_shape(shape); // we label shape with consecutive labels: 42, 43, 44, 45 + auto shape = PartialShape::dynamic(4); + + auto table = std::make_shared(42); + table->set_up_for_tracking(shape); // we label shape with consecutive labels: 42, 43, 44, 45 + { auto data = make_shared(element::f32, shape); auto shape_of = make_shared(data); @@ -125,9 +117,6 @@ TEST_F(TransformationTestsF, LastDimSplitDymanicLast) { manager.register_pass(); } { - auto shape = PartialShape::dynamic(4); - label_shape(shape); // we label shape with consecutive labels: 42, 43, 44, 45 - auto data = make_shared(element::f32, shape); auto pattern = ov::op::v0::Constant::create(element::i64, {5}, {0, 0, 0, 8, -1}); @@ -139,10 +128,11 @@ TEST_F(TransformationTestsF, LastDimSplitDymanicLast) { TEST_F(TransformationTestsF, NegativeTest) { // [A, B, C, D] -> [A, B, C, D/2, D/3, 6] - { - auto shape = PartialShape::dynamic(4); - label_shape(shape); // we label shape with consecutive labels: 42, 43, 44, 45 + auto shape = PartialShape::dynamic(4); + auto table = std::make_shared(42); + table->set_up_for_tracking(shape); // we label shape with consecutive labels: 42, 43, 44, 45 + { auto data = make_shared(element::f32, shape); auto shape_of = make_shared(data); diff --git a/src/core/include/openvino/op/util/symbolic_info.hpp b/src/core/include/openvino/op/util/symbolic_info.hpp index 39875d187bcee3..d430bb9f883fc6 100644 --- a/src/core/include/openvino/op/util/symbolic_info.hpp +++ b/src/core/include/openvino/op/util/symbolic_info.hpp @@ -13,27 +13,27 @@ namespace ov { OPENVINO_API void set_up_symbolic_info(const std::shared_ptr& model, - const std::shared_ptr& table); + const std::shared_ptr& table); OPENVINO_API void set_up_symbolic_info(const ov::Output& output, - const std::shared_ptr& table); + const std::shared_ptr& table); OPENVINO_API void populate_tensor_with_missing_labels(ov::descriptor::Tensor& tensor); OPENVINO_API bool skip_invalidation(const ov::descriptor::Tensor& tensor); -OPENVINO_API std::shared_ptr table_of_equivalence(const std::shared_ptr& model); -OPENVINO_API std::shared_ptr table_of_equivalence(const ov::descriptor::Tensor& tensor); +OPENVINO_API std::shared_ptr table_of_equivalence(const std::shared_ptr& model); +OPENVINO_API std::shared_ptr table_of_equivalence(const ov::descriptor::Tensor& tensor); OPENVINO_API void remove_symbolic_info(const std::shared_ptr& model, bool outermost_model = true); /** * @ingroup ov_runtime_attr_api * @brief SymbolicInfo class represents runtime info attribute that instructs ov::Output objects to skip invalidation of - * partial values and labels during partial value propagation and keeps shared_ptr to TableOfEquivalence. + * partial values and labels during partial value propagation and keeps shared_ptr to LabelTable. */ class OPENVINO_API SymbolicInfo : public RuntimeAttribute { public: OPENVINO_RTTI("SymbolicInfo", "0"); - explicit SymbolicInfo(bool skip_invalidation, const std::shared_ptr& table) + explicit SymbolicInfo(bool skip_invalidation, const std::shared_ptr& table) : m_skip_invalidation{skip_invalidation}, m_table{table} {}; bool is_copyable() const override { @@ -42,13 +42,13 @@ class OPENVINO_API SymbolicInfo : public RuntimeAttribute { bool get_skip_invalidation() const { return m_skip_invalidation; } - std::shared_ptr get_table() const { + std::shared_ptr get_table() const { return m_table; } private: bool m_skip_invalidation; - std::shared_ptr m_table; + std::shared_ptr m_table; }; } // namespace ov diff --git a/src/core/shape_inference/include/fft_base_shape_inference.hpp b/src/core/shape_inference/include/fft_base_shape_inference.hpp index 7ed8d9bd9ceae9..e57b488c9d2a43 100644 --- a/src/core/shape_inference/include/fft_base_shape_inference.hpp +++ b/src/core/shape_inference/include/fft_base_shape_inference.hpp @@ -6,7 +6,7 @@ #include "dimension_util.hpp" #include "fft_common_validation.hpp" #include "openvino/core/axis_vector.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/dimension.hpp" #include "openvino/op/util/fft_base.hpp" #include "utils.hpp" @@ -33,7 +33,7 @@ void apply_dims_from_sizes(const util::FFTBase* op, auto& out_dim = output_shape[(axes)[i]]; out_dim = DimType((*output_bounds)[i].first, (*output_bounds)[i].second); if (propagate_labels && labels[i] != ov::no_label) { - DimensionTracker::set_label(out_dim, labels[i]); + out_dim.set_label(labels[i]); } } } diff --git a/src/core/shape_inference/include/reshape_shape_inference.hpp b/src/core/shape_inference/include/reshape_shape_inference.hpp index e076e80fcac88f..7e54c42f2ab363 100644 --- a/src/core/shape_inference/include/reshape_shape_inference.hpp +++ b/src/core/shape_inference/include/reshape_shape_inference.hpp @@ -5,7 +5,7 @@ #include "compare.hpp" #include "dimension_util.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/reshape.hpp" #include "utils.hpp" @@ -83,8 +83,7 @@ struct Product::value>::ty void calculate() { // dimensions compare to remove same from product calculation auto dim_full_eq = [](const T& lhs, const T& rhs) -> bool { - return (lhs == rhs) && DimensionTracker::get_label(lhs) == DimensionTracker::get_label(rhs) && - (lhs.is_static() || DimensionTracker::has_label(lhs)); + return (lhs == rhs) && lhs.get_label() == rhs.get_label() && (lhs.is_static() || lhs.has_label()); }; auto outs = outputs; @@ -154,7 +153,7 @@ TDim resolve_minus_one_dim(const Product& product) { } if (product_out.get_min_length() != 1 || product_out.get_max_length() != 1) { - DimensionTracker::reset_tracking_info(minus_one_dim); + LabelTable::reset_tracking_info(minus_one_dim); } } return minus_one_dim; @@ -229,7 +228,7 @@ void set_pattern_labels(const Node* const op, TShape& shape) { auto label_iter = labels.begin(); for (auto& d : shape) { if (*label_iter != no_label) { - DimensionTracker::set_label(d, *label_iter); + d.set_label(*label_iter); } ++label_iter; } diff --git a/src/core/src/bound_evaluate.cpp b/src/core/src/bound_evaluate.cpp index 881762cce8f794..313c019c117cfd 100644 --- a/src/core/src/bound_evaluate.cpp +++ b/src/core/src/bound_evaluate.cpp @@ -4,7 +4,7 @@ #include "bound_evaluate.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/dimension.hpp" #include "openvino/core/rt_info.hpp" #include "openvino/core/shape_util.hpp" #include "openvino/core/validation_util.hpp" diff --git a/src/core/src/op/concat.cpp b/src/core/src/op/concat.cpp index 4ec7743d64167e..9da4557abbc8d9 100644 --- a/src/core/src/op/concat.cpp +++ b/src/core/src/op/concat.cpp @@ -7,7 +7,7 @@ #include "bound_evaluate.hpp" #include "concat_shape_inference.hpp" #include "itt.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/dimension.hpp" #include "openvino/core/validation_util.hpp" #include "openvino/reference/concat.hpp" diff --git a/src/core/src/op/reshape.cpp b/src/core/src/op/reshape.cpp index 9cb2a379899fb3..0fe77bab075553 100644 --- a/src/core/src/op/reshape.cpp +++ b/src/core/src/op/reshape.cpp @@ -8,7 +8,7 @@ #include "bound_evaluate.hpp" #include "itt.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/dimension.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/util/precision_sensitive_attribute.hpp" #include "openvino/reference/reshape.hpp" diff --git a/src/core/src/op/shape_of.cpp b/src/core/src/op/shape_of.cpp index a970c0df6b3fdc..5ea024df2ed54d 100644 --- a/src/core/src/op/shape_of.cpp +++ b/src/core/src/op/shape_of.cpp @@ -8,7 +8,7 @@ #include #include "itt.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/dimension.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/select.hpp" #include "openvino/reference/shape_of.hpp" @@ -100,7 +100,7 @@ bool evaluate_label(const Node* shape_of_node, TensorLabelVector& output_labels) labels.reserve(shape.size()); for (const auto& d : shape) { - const auto label = ov::DimensionTracker::get_label(d); + const auto label = d.get_label(); labels.emplace_back(label); common_label |= label; } diff --git a/src/core/src/op/util/symbolic_info.cpp b/src/core/src/op/util/symbolic_info.cpp index 5dd2858a4ee507..793feb68f0fa76 100644 --- a/src/core/src/op/util/symbolic_info.cpp +++ b/src/core/src/op/util/symbolic_info.cpp @@ -6,11 +6,11 @@ #include -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/util/multi_subgraph_base.hpp" namespace { -std::shared_ptr get_table(const ov::RTMap& rt_info) { +std::shared_ptr get_table(const ov::RTMap& rt_info) { const auto& type = ov::SymbolicInfo::get_type_info_static(); if (!rt_info.count(type)) return nullptr; @@ -18,14 +18,12 @@ std::shared_ptr get_table(const ov::RTMap& rt_info) { } } // namespace -void ov::set_up_symbolic_info(const std::shared_ptr& model, - const std::shared_ptr& table) { +void ov::set_up_symbolic_info(const std::shared_ptr& model, const std::shared_ptr& table) { auto& rt_info = model->get_rt_info(); rt_info[ov::SymbolicInfo::get_type_info_static()] = ov::SymbolicInfo(true, table); } -void ov::set_up_symbolic_info(const ov::Output& output, - const std::shared_ptr& table) { +void ov::set_up_symbolic_info(const ov::Output& output, const std::shared_ptr& table) { auto& rt_info = output.get_tensor().get_rt_info(); rt_info[ov::SymbolicInfo::get_type_info_static()] = ov::SymbolicInfo(true, table); } @@ -36,12 +34,12 @@ bool ov::skip_invalidation(const ov::descriptor::Tensor& tensor) { return rt_info.count(type) && rt_info.at(type).as().get_skip_invalidation(); } -std::shared_ptr ov::table_of_equivalence(const ov::descriptor::Tensor& tensor) { +std::shared_ptr ov::table_of_equivalence(const ov::descriptor::Tensor& tensor) { const auto& rt_info = tensor.get_rt_info(); return get_table(rt_info); } -std::shared_ptr ov::table_of_equivalence(const std::shared_ptr& model) { +std::shared_ptr ov::table_of_equivalence(const std::shared_ptr& model) { const auto& rt_info = model->get_rt_info(); return get_table(rt_info); } diff --git a/src/core/src/partial_shape.cpp b/src/core/src/partial_shape.cpp index efc4c65e2aaed5..52c7d72c6c9342 100644 --- a/src/core/src/partial_shape.cpp +++ b/src/core/src/partial_shape.cpp @@ -8,7 +8,7 @@ #include #include -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/dimension.hpp" #include "openvino/core/shape_util.hpp" #include "openvino/core/validation_util.hpp" #include "openvino/util/common_util.hpp" @@ -158,7 +158,7 @@ std::ostream& ov::operator<<(std::ostream& str, const PartialShape& shape) { if (!first) { str << ","; } - if (const auto& l = ov::DimensionTracker::get_label(d)) + if (const auto& l = d.get_label()) str << "<" << l << ">"; str << d; first = false; diff --git a/src/core/src/validation_util.cpp b/src/core/src/validation_util.cpp index be6006448db8c4..e940c80a162e66 100644 --- a/src/core/src/validation_util.cpp +++ b/src/core/src/validation_util.cpp @@ -9,7 +9,7 @@ #include "bound_evaluate.hpp" #include "compare.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/dimension.hpp" #include "openvino/op/concat.hpp" #include "openvino/op/gather.hpp" #include "openvino/op/negative.hpp" @@ -230,7 +230,7 @@ bool evaluate_as_partial_shape(const ov::Output& output, ov::PartialSh } resulting_pshape[i] = {low, up}; if (!labels.empty() && labels[i]) - DimensionTracker::set_label(resulting_pshape[i], labels[i]); + resulting_pshape[i].set_label(labels[i]); } pshape = ov::PartialShape(resulting_pshape); shape_defined = true; diff --git a/src/core/tests/dimension.cpp b/src/core/tests/dimension.cpp index 262d7c75ea4561..7d536ee2965ba4 100644 --- a/src/core/tests/dimension.cpp +++ b/src/core/tests/dimension.cpp @@ -5,7 +5,7 @@ #include "openvino/core/dimension.hpp" #include "gtest/gtest.h" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" using namespace std; using namespace ov; @@ -123,23 +123,22 @@ TEST(dimension, division_of_static_dims) { } TEST(dimension, dimension_equality) { - auto te = make_shared(); - DimensionTracker dt(te); + auto te = make_shared(); // labeling dimensions PartialShape dimensions = PartialShape::dynamic(5); // A, B, C, D, E for (auto& dimension : dimensions) - dt.set_up_for_tracking(dimension); + te->set_up_for_tracking(dimension); // checking labels are unique for (const auto& dimension : dimensions) - EXPECT_NE(DimensionTracker::get_label(dimension), no_label); + EXPECT_NE(dimension.get_label(), no_label); for (const auto& lhs : dimensions) { for (const auto& rhs : dimensions) { if (&lhs == &rhs) continue; - EXPECT_NE(DimensionTracker::get_label(lhs), DimensionTracker::get_label(rhs)); + EXPECT_NE(lhs.get_label(), rhs.get_label()); EXPECT_FALSE(te->are_equal(lhs, rhs)); } } @@ -156,9 +155,9 @@ TEST(dimension, dimension_equality) { // clear up all the tracking info for (auto& dimension : dimensions) - DimensionTracker::reset_tracking_info(dimension); + LabelTable::reset_tracking_info(dimension); // checking labels are unique for (const auto& dimension : dimensions) - EXPECT_EQ(DimensionTracker::get_label(dimension), no_label); + EXPECT_EQ(dimension.get_label(), no_label); } diff --git a/src/core/tests/evaluate_bound/concat.cpp b/src/core/tests/evaluate_bound/concat.cpp index 81143031b14893..e1e2325eac5ff3 100644 --- a/src/core/tests/evaluate_bound/concat.cpp +++ b/src/core/tests/evaluate_bound/concat.cpp @@ -4,7 +4,6 @@ #include "gmock/gmock.h" #include "openvino/core/dimension.hpp" -#include "openvino/core/dimension_tracker.hpp" #include "openvino/core/node.hpp" #include "openvino/core/partial_shape.hpp" #include "openvino/opsets/opset9.hpp" diff --git a/src/core/tests/type_prop/arithmetic_ops.hpp b/src/core/tests/type_prop/arithmetic_ops.hpp index 1485e7579b7bcb..83db262a201164 100644 --- a/src/core/tests/type_prop/arithmetic_ops.hpp +++ b/src/core/tests/type_prop/arithmetic_ops.hpp @@ -7,7 +7,7 @@ #include #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/util/attr_types.hpp" using namespace ov; @@ -570,8 +570,8 @@ TYPED_TEST_P(ArithmeticOperator, labels_different_interval_b_and_fully_dyn_a_bro ov::Dimension dim_0_A = ov::Dimension(-1); ov::Dimension dim_0_B = ov::Dimension(2, 4); - ov::DimensionTracker::set_label(dim_0_A, 10); - ov::DimensionTracker::set_label(dim_0_B, 20); + dim_0_A.set_label(10); + dim_0_B.set_label(20); ov::PartialShape pshape_A = {dim_0_A, 3, 224, 1}, pshape_B = {dim_0_B, 3, 1, 224}; ov::PartialShape expected_shape = {ov::Dimension(2, 4), 3, 224, 224}; @@ -593,8 +593,8 @@ TYPED_TEST_P(ArithmeticOperator, labels_different_interval_a_and_fully_dyn_b_bro ov::Dimension dim_0_A = ov::Dimension(2, 4); ov::Dimension dim_0_B = ov::Dimension(-1); - ov::DimensionTracker::set_label(dim_0_A, 10); - ov::DimensionTracker::set_label(dim_0_B, 20); + dim_0_A.set_label(10); + dim_0_B.set_label(20); ov::PartialShape pshape_A = {dim_0_A, 3, 224, 1}, pshape_B = {dim_0_B, 3, 1, 224}; ov::PartialShape expected_shape = {ov::Dimension(2, 4), 3, 224, 224}; @@ -657,14 +657,13 @@ TYPED_TEST_P(ArithmeticOperator, labels_different_interval_dims_without_one_broa TYPED_TEST_P(ArithmeticOperator, labels_different_interval_batch_without_one_equivalence_table_broadcast_numpy) { // Both params have dynamic interval dimension different labels, use table of equivalence - auto table_of_equivalence = std::make_shared(); - ov::DimensionTracker dim_tracker(table_of_equivalence); + auto table_of_equivalence = std::make_shared(); ov::Dimension dim_0_A = ov::Dimension(2, 4); ov::Dimension dim_0_B = ov::Dimension(2, 4); - dim_tracker.set_up_for_tracking(dim_0_A, 10); - dim_tracker.set_up_for_tracking(dim_0_B, 20); + table_of_equivalence->set_up_for_tracking(dim_0_A, 10); + table_of_equivalence->set_up_for_tracking(dim_0_B, 20); ov::PartialShape pshape_A = {dim_0_A, 3, 224, 1}, pshape_B = {dim_0_B, 3, 1, 224}; @@ -679,8 +678,8 @@ TYPED_TEST_P(ArithmeticOperator, labels_different_interval_batch_without_one_equ ov::TensorLabel expected_labels{20, 0, 0, 0}; auto eq_table = table_of_equivalence->get_equivalence_table(); - EXPECT_EQ(*eq_table[ov::DimensionTracker::get_label(dim_0_A)], std::set({10, 20})); - EXPECT_EQ(*eq_table[ov::DimensionTracker::get_label(dim_0_B)], std::set({10, 20})); + EXPECT_EQ(*eq_table[dim_0_A.get_label()], std::set({10, 20})); + EXPECT_EQ(*eq_table[dim_0_B.get_label()], std::set({10, 20})); EXPECT_EQ(out_shape, expected_shape); EXPECT_EQ(get_shape_labels(out_shape), expected_labels); @@ -691,8 +690,8 @@ TYPED_TEST_P(ArithmeticOperator, labels_different_fully_dynamic_batch_broadcast_ ov::Dimension dim_0_A = ov::Dimension(-1); ov::Dimension dim_0_B = ov::Dimension(-1); - ov::DimensionTracker::set_label(dim_0_A, 10); - ov::DimensionTracker::set_label(dim_0_B, 20); + dim_0_A.set_label(10); + dim_0_B.set_label(20); ov::PartialShape pshape_A = {dim_0_A, 3, 224, 1}, pshape_B = {dim_0_B, 3, 1, 224}; ov::PartialShape expected_shape = {-1, 3, 224, 224}; @@ -714,8 +713,8 @@ TYPED_TEST_P(ArithmeticOperator, labels_equal_fully_dynamic_batch_broadcast_nump ov::Dimension dim_0_A = ov::Dimension(-1); ov::Dimension dim_0_B = ov::Dimension(-1); - ov::DimensionTracker::set_label(dim_0_A, 10); - ov::DimensionTracker::set_label(dim_0_B, 10); + dim_0_A.set_label(10); + dim_0_B.set_label(10); ov::PartialShape pshape_A = {dim_0_A, 3, 224, 1}, pshape_B = {dim_0_B, 3, 1, 224}; ov::PartialShape expected_shape = {-1, 3, 224, 224}; @@ -734,7 +733,7 @@ TYPED_TEST_P(ArithmeticOperator, labels_equal_fully_dynamic_batch_broadcast_nump TYPED_TEST_P(ArithmeticOperator, labels_dyn_batch_a_broadcast_numpy) { ov::Dimension b = -1; - ov::DimensionTracker::set_label(b, 10); + b.set_label(10); ov::PartialShape A = {b, 3, 224, 224}, B = {1, 3, 1, 1}; ov::PartialShape expected_shape{b, 3, 224, 224}; @@ -753,7 +752,7 @@ TYPED_TEST_P(ArithmeticOperator, labels_dyn_batch_a_broadcast_numpy) { TYPED_TEST_P(ArithmeticOperator, labels_dyn_batch_b_broadcast_numpy) { ov::Dimension b = -1; - ov::DimensionTracker::set_label(b, 10); + b.set_label(10); ov::PartialShape B = {b, 3, 224, 224}, A = {1, 3, 1, 1}; ov::PartialShape expected_shape{b, 3, 224, 224}; @@ -772,7 +771,7 @@ TYPED_TEST_P(ArithmeticOperator, labels_dyn_batch_b_broadcast_numpy) { TYPED_TEST_P(ArithmeticOperator, labels_dyn_batch_and_higher_rank_a_broadcast_numpy) { ov::Dimension b = -1; - ov::DimensionTracker::set_label(b, 10); + b.set_label(10); ov::PartialShape pshape_A{b, -1, -1, -1}; ov::PartialShape pshape_B{3, 1, 1}; @@ -793,7 +792,7 @@ TYPED_TEST_P(ArithmeticOperator, labels_dyn_batch_and_higher_rank_a_broadcast_nu TYPED_TEST_P(ArithmeticOperator, labels_dyn_batch_and_higher_rank_b_broadcast_numpy) { ov::Dimension b = -1; - ov::DimensionTracker::set_label(b, 10); + b.set_label(10); ov::PartialShape pshape_A{3, 1, 1}; ov::PartialShape pshape_B{b, -1, -1, -1}; diff --git a/src/core/tests/type_prop/binary_elementwise.cpp b/src/core/tests/type_prop/binary_elementwise.cpp index 3816f430843583..fc00af695f3677 100644 --- a/src/core/tests/type_prop/binary_elementwise.cpp +++ b/src/core/tests/type_prop/binary_elementwise.cpp @@ -6,7 +6,7 @@ #include "common_test_utils/test_assertions.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/add.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/convert.hpp" diff --git a/src/core/tests/type_prop/bitwise_ops.hpp b/src/core/tests/type_prop/bitwise_ops.hpp index 3a8dc24df1b3ec..deb31826e5a845 100644 --- a/src/core/tests/type_prop/bitwise_ops.hpp +++ b/src/core/tests/type_prop/bitwise_ops.hpp @@ -8,7 +8,7 @@ #include "common_test_utils/test_assertions.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/util/attr_types.hpp" using namespace ov; @@ -509,8 +509,8 @@ TYPED_TEST_P(BitwiseOperator, labels_different_interval_b_and_fully_dyn_a_broadc Dimension dim_0_lhs = {-1}; Dimension dim_0_rhs = {2, 4}; - DimensionTracker::set_label(dim_0_lhs, 10); - DimensionTracker::set_label(dim_0_rhs, 20); + dim_0_lhs.set_label(10); + dim_0_rhs.set_label(20); PartialShape pshape_lhs = {dim_0_lhs, 3, 224, 1}, pshape_rhs = {dim_0_rhs, 3, 1, 224}; PartialShape expected_shape = {{2, 4}, 3, 224, 224}; @@ -532,8 +532,8 @@ TYPED_TEST_P(BitwiseOperator, labels_different_interval_a_and_fully_dyn_b_broadc Dimension dim_0_lhs = {2, 4}; Dimension dim_0_rhs = {-1}; - DimensionTracker::set_label(dim_0_lhs, 10); - DimensionTracker::set_label(dim_0_rhs, 20); + dim_0_lhs.set_label(10); + dim_0_rhs.set_label(20); PartialShape pshape_lhs = {dim_0_lhs, 3, 224, 1}, pshape_rhs = {dim_0_rhs, 3, 1, 224}; PartialShape expected_shape = {{2, 4}, 3, 224, 224}; @@ -596,14 +596,13 @@ TYPED_TEST_P(BitwiseOperator, labels_different_interval_dims_without_one_broadca TYPED_TEST_P(BitwiseOperator, labels_different_interval_batch_without_one_equivalence_table_broadcast_numpy) { // Both params have dynamic interval dimension different labels, use table of equivalence - auto table_of_equivalence = std::make_shared(); - DimensionTracker dim_tracker(table_of_equivalence); + auto table_of_equivalence = std::make_shared(); Dimension dim_0_lhs = {2, 4}; Dimension dim_0_rhs = {2, 4}; - dim_tracker.set_up_for_tracking(dim_0_lhs, 10); - dim_tracker.set_up_for_tracking(dim_0_rhs, 20); + table_of_equivalence->set_up_for_tracking(dim_0_lhs, 10); + table_of_equivalence->set_up_for_tracking(dim_0_rhs, 20); PartialShape pshape_lhs = {dim_0_lhs, 3, 224, 1}, pshape_rhs = {dim_0_rhs, 3, 1, 224}; @@ -618,8 +617,8 @@ TYPED_TEST_P(BitwiseOperator, labels_different_interval_batch_without_one_equiva TensorLabel expected_labels{20, 0, 0, 0}; auto eq_table = table_of_equivalence->get_equivalence_table(); - EXPECT_EQ(*eq_table[DimensionTracker::get_label(dim_0_lhs)], std::set({10, 20})); - EXPECT_EQ(*eq_table[DimensionTracker::get_label(dim_0_rhs)], std::set({10, 20})); + EXPECT_EQ(*eq_table[dim_0_lhs.get_label()], std::set({10, 20})); + EXPECT_EQ(*eq_table[dim_0_rhs.get_label()], std::set({10, 20})); EXPECT_EQ(out_shape, expected_shape); EXPECT_EQ(get_shape_labels(out_shape), expected_labels); @@ -630,8 +629,8 @@ TYPED_TEST_P(BitwiseOperator, labels_different_fully_dynamic_batch_broadcast_num Dimension dim_0_lhs = {-1}; Dimension dim_0_rhs = {-1}; - DimensionTracker::set_label(dim_0_lhs, 10); - DimensionTracker::set_label(dim_0_rhs, 20); + dim_0_lhs.set_label(10); + dim_0_rhs.set_label(20); PartialShape pshape_lhs = {dim_0_lhs, 3, 224, 1}, pshape_rhs = {dim_0_rhs, 3, 1, 224}; PartialShape expected_shape = {-1, 3, 224, 224}; @@ -653,8 +652,8 @@ TYPED_TEST_P(BitwiseOperator, labels_equal_fully_dynamic_batch_broadcast_numpy) Dimension dim_0_lhs = {-1}; Dimension dim_0_rhs = {-1}; - DimensionTracker::set_label(dim_0_lhs, 10); - DimensionTracker::set_label(dim_0_rhs, 10); + dim_0_lhs.set_label(10); + dim_0_rhs.set_label(10); PartialShape pshape_lhs = {dim_0_lhs, 3, 224, 1}, pshape_rhs = {dim_0_rhs, 3, 1, 224}; PartialShape expected_shape = {-1, 3, 224, 224}; @@ -673,7 +672,7 @@ TYPED_TEST_P(BitwiseOperator, labels_equal_fully_dynamic_batch_broadcast_numpy) TYPED_TEST_P(BitwiseOperator, labels_dyn_batch_a_broadcast_numpy) { Dimension dim_0_lhs = -1; - DimensionTracker::set_label(dim_0_lhs, 10); + dim_0_lhs.set_label(10); PartialShape pshape_lhs = {dim_0_lhs, 3, 224, 224}, pshape_rhs = {1, 3, 1, 1}; PartialShape expected_shape{dim_0_lhs, 3, 224, 224}; @@ -692,7 +691,7 @@ TYPED_TEST_P(BitwiseOperator, labels_dyn_batch_a_broadcast_numpy) { TYPED_TEST_P(BitwiseOperator, labels_dyn_batch_b_broadcast_numpy) { Dimension dim_0_rhs = -1; - DimensionTracker::set_label(dim_0_rhs, 10); + dim_0_rhs.set_label(10); PartialShape pshape_rhs = {dim_0_rhs, 3, 224, 224}, pshape_lhs = {1, 3, 1, 1}; PartialShape expected_shape{dim_0_rhs, 3, 224, 224}; @@ -711,7 +710,7 @@ TYPED_TEST_P(BitwiseOperator, labels_dyn_batch_b_broadcast_numpy) { TYPED_TEST_P(BitwiseOperator, labels_dyn_batch_and_higher_rank_a_broadcast_numpy) { Dimension dim_0_lhs = -1; - DimensionTracker::set_label(dim_0_lhs, 10); + dim_0_lhs.set_label(10); PartialShape pshape_lhs{dim_0_lhs, -1, -1, -1}; PartialShape pshape_rhs{3, 1, 1}; @@ -732,7 +731,7 @@ TYPED_TEST_P(BitwiseOperator, labels_dyn_batch_and_higher_rank_a_broadcast_numpy TYPED_TEST_P(BitwiseOperator, labels_dyn_batch_and_higher_rank_b_broadcast_numpy) { Dimension dim_0_rhs = -1; - DimensionTracker::set_label(dim_0_rhs, 10); + dim_0_rhs.set_label(10); PartialShape pshape_lhs{3, 1, 1}; PartialShape pshape_rhs{dim_0_rhs, -1, -1, -1}; diff --git a/src/core/tests/type_prop/broadcast.cpp b/src/core/tests/type_prop/broadcast.cpp index 33d4cf2d5ce030..c95ba871ade94e 100644 --- a/src/core/tests/type_prop/broadcast.cpp +++ b/src/core/tests/type_prop/broadcast.cpp @@ -8,7 +8,7 @@ #include "common_test_utils/test_assertions.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/core/validation_util.hpp" #include "openvino/op/concat.hpp" #include "openvino/op/constant.hpp" @@ -29,7 +29,7 @@ TYPED_TEST_SUITE_P(BroadcastTests); TYPED_TEST_P(BroadcastTests, broadcast_dynamic_value_propagation) { ov::Dimension marked = ov::Dimension(3); - ov::DimensionTracker::set_label(marked, 10); + marked.set_label(10); ov::PartialShape target = ov::PartialShape{1, 2, marked, 4}; auto param = make_shared(ov::element::f32, ov::Shape{1, 1}); @@ -47,7 +47,7 @@ TYPED_TEST_P(BroadcastTests, broadcast_dynamic_value_propagation) { auto bc = make_shared(param, target_shape); ASSERT_EQ(bc->get_element_type(), ov::element::f32); ASSERT_EQ(bc->get_shape(), (ov::Shape{3, 5})); - ASSERT_EQ(ov::DimensionTracker::get_label(bc->get_output_partial_shape(0)[0]), 10); + ASSERT_EQ(bc->get_output_partial_shape(0)[0].get_label(), 10); } TYPED_TEST_P(BroadcastTests, broadcast_numpy) { diff --git a/src/core/tests/type_prop/concat.cpp b/src/core/tests/type_prop/concat.cpp index 0114f8192be62f..0f649533e05502 100644 --- a/src/core/tests/type_prop/concat.cpp +++ b/src/core/tests/type_prop/concat.cpp @@ -8,7 +8,7 @@ #include "common_test_utils/test_assertions.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/broadcast.hpp" #include "openvino/op/convert.hpp" #include "openvino/op/shape_of.hpp" @@ -263,11 +263,11 @@ TEST(type_prop, concat_partial_negative_axis_incorrect) { /** \brief Test uses evaluate lower/upper and label of concat op. */ TEST(type_prop, concat_dynamic_value_and_label_propagation) { ov::Dimension marked_0 = ov::Dimension(3); - ov::DimensionTracker::set_label(marked_0, 10); + marked_0.set_label(10); ov::PartialShape target_0 = ov::PartialShape{marked_0, 4}; ov::Dimension marked_1 = ov::Dimension(5); - ov::DimensionTracker::set_label(marked_1, 15); + marked_1.set_label(15); ov::PartialShape target_1 = ov::PartialShape{4, marked_1, 9}; auto param = make_shared(ov::element::f32, ov::Shape{1}); @@ -291,11 +291,11 @@ TEST(type_prop, concat_dynamic_value_and_label_propagation) { /** \brief Test uses evaluate lower/upper and label of concat op. */ TEST(type_prop, concat_dynamic_value_and_label_propagation_1) { ov::Dimension marked_0 = ov::Dimension(3); - ov::DimensionTracker::set_label(marked_0, 1000); + marked_0.set_label(1000); ov::PartialShape target_0 = ov::PartialShape{marked_0, 4}; ov::Dimension marked_1 = ov::Dimension(5); - ov::DimensionTracker::set_label(marked_1, 1500); + marked_1.set_label(1500); ov::PartialShape target_1 = ov::PartialShape{4, marked_1, 9}; auto param = make_shared(ov::element::f32, ov::Shape{1}); diff --git a/src/core/tests/type_prop/convert.cpp b/src/core/tests/type_prop/convert.cpp index e48257b84cc111..046da0ad98a7a5 100644 --- a/src/core/tests/type_prop/convert.cpp +++ b/src/core/tests/type_prop/convert.cpp @@ -7,7 +7,7 @@ #include #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/broadcast.hpp" #include "openvino/op/shape_of.hpp" @@ -23,7 +23,7 @@ TEST(type_prop, convert_deduce) { TEST(type_prop, convert_dynamic_value_and_label_propagation) { ov::Dimension marked_0 = ov::Dimension(3); - ov::DimensionTracker::set_label(marked_0, 500); + marked_0.set_label(500); ov::PartialShape target_0 = ov::PartialShape{marked_0, 4}; auto param = make_shared(ov::element::f32, ov::Shape{1}); @@ -37,6 +37,6 @@ TEST(type_prop, convert_dynamic_value_and_label_propagation) { ASSERT_EQ(bc->get_shape(), (ov::Shape{3, 4})); const auto& output_shape = bc->get_output_partial_shape(0); - ASSERT_EQ(ov::DimensionTracker::get_label(output_shape[0]), 500); - ASSERT_EQ(ov::DimensionTracker::get_label(output_shape[1]), 0); + ASSERT_EQ(output_shape[0].get_label(), 500); + ASSERT_EQ(output_shape[1].get_label(), 0); } diff --git a/src/core/tests/type_prop/ctc_greedy_decoder.cpp b/src/core/tests/type_prop/ctc_greedy_decoder.cpp index 84df9ab1d718c1..d6c5ef8f1130a9 100644 --- a/src/core/tests/type_prop/ctc_greedy_decoder.cpp +++ b/src/core/tests/type_prop/ctc_greedy_decoder.cpp @@ -7,7 +7,7 @@ #include #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" using namespace std; using namespace ov; diff --git a/src/core/tests/type_prop/ctc_greedy_decoder_seq_len.cpp b/src/core/tests/type_prop/ctc_greedy_decoder_seq_len.cpp index 827f6888b419f8..c30f491301a861 100644 --- a/src/core/tests/type_prop/ctc_greedy_decoder_seq_len.cpp +++ b/src/core/tests/type_prop/ctc_greedy_decoder_seq_len.cpp @@ -5,7 +5,7 @@ #include #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/ops.hpp" using namespace std; diff --git a/src/core/tests/type_prop/detection_output.cpp b/src/core/tests/type_prop/detection_output.cpp index 786747b56c2f78..d521de8f675584 100644 --- a/src/core/tests/type_prop/detection_output.cpp +++ b/src/core/tests/type_prop/detection_output.cpp @@ -10,7 +10,7 @@ #include "common_test_utils/test_assertions.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/util/common_util.hpp" using namespace std; diff --git a/src/core/tests/type_prop/einsum.cpp b/src/core/tests/type_prop/einsum.cpp index 70c75487f9cdf7..0a58a2ccae6746 100644 --- a/src/core/tests/type_prop/einsum.cpp +++ b/src/core/tests/type_prop/einsum.cpp @@ -8,7 +8,7 @@ #include "common_test_utils/test_assertions.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/pass/graph_rewrite.hpp" using namespace std; diff --git a/src/core/tests/type_prop/eye.cpp b/src/core/tests/type_prop/eye.cpp index b82dddda653317..ba075b2d815425 100644 --- a/src/core/tests/type_prop/eye.cpp +++ b/src/core/tests/type_prop/eye.cpp @@ -7,7 +7,7 @@ #include "common_test_utils/test_assertions.hpp" #include "common_test_utils/type_prop.hpp" #include "eye_shape_inference.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/opsets/opset10.hpp" using namespace std; @@ -42,7 +42,7 @@ TEST(type_prop, eye_batch_shape_constant) { TEST(type_prop, eye_rows_param) { constexpr label_t row_label = 2; auto rows_dim = Dimension{0, 1}; - DimensionTracker::set_label(rows_dim, row_label); + rows_dim.set_label(row_label); auto num_rows = make_shared(element::i64, PartialShape{rows_dim}); auto num_columns = op::v0::Constant::create(element::i64, Shape{}, {10}); @@ -58,7 +58,7 @@ TEST(type_prop, eye_rows_param) { TEST(type_prop, eye_rows_const) { constexpr label_t columns_label = 2; auto columns_dim = Dimension{0, 1}; - DimensionTracker::set_label(columns_dim, columns_label); + columns_dim.set_label(columns_label); auto num_rows = op::v0::Constant::create(element::i64, Shape{}, {10}); auto num_columns = make_shared(element::i64, PartialShape{columns_dim}); @@ -74,7 +74,7 @@ TEST(type_prop, eye_rows_const) { TEST(type_prop, eye_batch_shape_const) { constexpr label_t batch_label = 2; auto batch_dim = Dimension{2}; - DimensionTracker::set_label(batch_dim, batch_label); + batch_dim.set_label(batch_label); auto num_rows = make_shared(element::i64, PartialShape{1}); auto num_columns = num_rows; diff --git a/src/core/tests/type_prop/fft_base_complex.cpp b/src/core/tests/type_prop/fft_base_complex.cpp index d3d5cd9abb7403..85eceab232169d 100644 --- a/src/core/tests/type_prop/fft_base_complex.cpp +++ b/src/core/tests/type_prop/fft_base_complex.cpp @@ -567,12 +567,12 @@ TYPED_TEST_P(FFTConstantAxesAndShapeOfSignalSizeTest, constant_axes_and_shape_of {2, 0, -1}, {{6, 8}, -1, 4}, {ov::no_label, 11, 22, ov::no_label, ov::no_label}}; - ov::DimensionTracker::set_label(params.input_shape[1], 11); + params.input_shape[1].set_label(11); auto data = std::make_shared(element::f32, params.input_shape); auto axes_input = op::v0::Constant::create(element::i64, Shape{params.axes.size()}, params.axes); - ov::DimensionTracker::set_label(params.signal_size[0], 22); + params.signal_size[0].set_label(22); auto param_of_shape = std::make_shared(element::f32, params.signal_size); auto signal_size_input = std::make_shared(param_of_shape, element::i64); diff --git a/src/core/tests/type_prop/gather.cpp b/src/core/tests/type_prop/gather.cpp index 9a8aa5654a95e0..512d9d3028c9b0 100644 --- a/src/core/tests/type_prop/gather.cpp +++ b/src/core/tests/type_prop/gather.cpp @@ -6,7 +6,7 @@ #include "common_test_utils/test_assertions.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/add.hpp" #include "openvino/op/broadcast.hpp" #include "openvino/op/constant.hpp" @@ -108,7 +108,7 @@ TEST(type_prop, gather_v1_negative_axis) { TEST(type_prop, gather_1_dynamic_value_and_label_propagation) { Dimension marked_0 = Dimension(3); - ov::DimensionTracker::set_label(marked_0, 10); + marked_0.set_label(10); PartialShape target_0 = PartialShape{marked_0, 4}; auto param = std::make_shared(element::f32, Shape{1}); @@ -125,7 +125,7 @@ TEST(type_prop, gather_1_dynamic_value_and_label_propagation) { EXPECT_EQ(bc->get_shape(), (Shape{3})); const auto& output_shape = bc->get_output_partial_shape(0); - EXPECT_EQ(ov::DimensionTracker::get_label(output_shape[0]), 10); + EXPECT_EQ(output_shape[0].get_label(), 10); } TEST(type_prop, dynamic_value_propagation) { @@ -342,7 +342,7 @@ TEST(type_prop, gather_7_axis_not_set_positive_batch_dims) { TEST(type_prop, gather_7_dynamic_value_and_label_propagation) { Dimension marked_0 = Dimension(3); - ov::DimensionTracker::set_label(marked_0, 10); + marked_0.set_label(10); PartialShape target_0 = PartialShape{marked_0, 4}; auto param = std::make_shared(element::f32, Shape{1}); @@ -359,7 +359,7 @@ TEST(type_prop, gather_7_dynamic_value_and_label_propagation) { EXPECT_EQ(bc->get_shape(), (Shape{3})); const auto& output_shape = bc->get_output_partial_shape(0); - EXPECT_EQ(ov::DimensionTracker::get_label(output_shape[0]), 10); + EXPECT_EQ(output_shape[0].get_label(), 10); } // --------------------- V7 Negative tests ------------------------------ @@ -670,7 +670,7 @@ TEST(type_prop, gather_v8_axis_not_set_positive_batch_dims) { /** \brief Check usage of evaluate lower and label on shape inference. */ TEST(type_prop, gather_v8_dynamic_value_and_label_propagation) { Dimension marked_0 = Dimension(3); - ov::DimensionTracker::set_label(marked_0, 10); + marked_0.set_label(10); PartialShape target_0 = PartialShape{marked_0, 4}; auto param = std::make_shared(element::f32, Shape{1}); @@ -687,13 +687,13 @@ TEST(type_prop, gather_v8_dynamic_value_and_label_propagation) { EXPECT_EQ(bc->get_shape(), (Shape{3})); const auto& output_shape = bc->get_output_partial_shape(0); - EXPECT_EQ(ov::DimensionTracker::get_label(output_shape[0]), 10); + EXPECT_EQ(output_shape[0].get_label(), 10); } /** \brief Check usage of evaluate lower/upper and label on shape inference. */ TEST(type_prop, gather_v8_dynamic_value_and_label_propagation_interval_dim) { Dimension marked_0 = Dimension(2, 4); - ov::DimensionTracker::set_label(marked_0, 10); + marked_0.set_label(10); PartialShape target_0 = PartialShape{marked_0, 4}; auto param = std::make_shared(element::f32, Shape{1}); @@ -710,7 +710,7 @@ TEST(type_prop, gather_v8_dynamic_value_and_label_propagation_interval_dim) { EXPECT_EQ(bc->get_output_partial_shape(0), PartialShape({marked_0})); const auto& output_shape = bc->get_output_partial_shape(0); - EXPECT_EQ(ov::DimensionTracker::get_label(output_shape[0]), 10); + EXPECT_EQ(output_shape[0].get_label(), 10); } TEST(type_prop, gather_v8_use_default_ctor) { diff --git a/src/core/tests/type_prop/gather_elements.cpp b/src/core/tests/type_prop/gather_elements.cpp index fcd72878db6adb..19c604473a686d 100644 --- a/src/core/tests/type_prop/gather_elements.cpp +++ b/src/core/tests/type_prop/gather_elements.cpp @@ -5,7 +5,7 @@ #include #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/ops.hpp" using namespace std; diff --git a/src/core/tests/type_prop/gather_nd.cpp b/src/core/tests/type_prop/gather_nd.cpp index 250aba9121e302..872bbf7542aa4a 100644 --- a/src/core/tests/type_prop/gather_nd.cpp +++ b/src/core/tests/type_prop/gather_nd.cpp @@ -5,7 +5,7 @@ #include #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/ops.hpp" using namespace std; diff --git a/src/core/tests/type_prop/gather_tree.cpp b/src/core/tests/type_prop/gather_tree.cpp index 9cc618da9d9648..7152066be7707f 100644 --- a/src/core/tests/type_prop/gather_tree.cpp +++ b/src/core/tests/type_prop/gather_tree.cpp @@ -8,7 +8,7 @@ #include #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/ops.hpp" using namespace std; diff --git a/src/core/tests/type_prop/grid_sample.cpp b/src/core/tests/type_prop/grid_sample.cpp index 2afbf061ccf7f4..44280cc26b7c54 100644 --- a/src/core/tests/type_prop/grid_sample.cpp +++ b/src/core/tests/type_prop/grid_sample.cpp @@ -5,7 +5,7 @@ #include #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/util/attr_types.hpp" #include "openvino/opsets/opset9.hpp" diff --git a/src/core/tests/type_prop/logical_ops.hpp b/src/core/tests/type_prop/logical_ops.hpp index b3e226e5ecb890..476a2813943197 100644 --- a/src/core/tests/type_prop/logical_ops.hpp +++ b/src/core/tests/type_prop/logical_ops.hpp @@ -6,7 +6,7 @@ #include "common_test_utils/test_assertions.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" template class LogicalOperatorType { diff --git a/src/core/tests/type_prop/matmul.cpp b/src/core/tests/type_prop/matmul.cpp index 41d3789601d086..7cc62299a4b0b4 100644 --- a/src/core/tests/type_prop/matmul.cpp +++ b/src/core/tests/type_prop/matmul.cpp @@ -5,7 +5,7 @@ #include "openvino/op/matmul.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/concat.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/gather.hpp" @@ -535,7 +535,7 @@ TEST(type_prop, matmul_propagate_labels_on_interval_dims) { TEST(type_prop, matmul_propagate_label_on_b_input_after_reshape) { constexpr ov::label_t my_label = 2; auto marked_dim = Dimension(2, 3); - ov::DimensionTracker::set_label(marked_dim, my_label); + marked_dim.set_label(my_label); const auto a_shape = PartialShape{Dimension::dynamic(), 5, 3}; const auto b_shape = PartialShape{3, marked_dim, 2}; diff --git a/src/core/tests/type_prop/one_hot.cpp b/src/core/tests/type_prop/one_hot.cpp index 9b222843ac3eef..8942713f21cc7d 100644 --- a/src/core/tests/type_prop/one_hot.cpp +++ b/src/core/tests/type_prop/one_hot.cpp @@ -6,7 +6,7 @@ #include "common_test_utils/test_assertions.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/shape_of.hpp" #include "openvino/op/squeeze.hpp" @@ -101,7 +101,7 @@ TEST(type_prop, one_hot_v1_depth_value_label) { auto labeled_dim = Dimension(4, 6); ov::label_t depth_label = 2345664; - ov::DimensionTracker::set_label(labeled_dim, depth_label); + labeled_dim.set_label(depth_label); PartialShape shape_for_depth = PartialShape{labeled_dim}; auto data = make_shared(element::i8, shape_for_depth); diff --git a/src/core/tests/type_prop/prior_box.cpp b/src/core/tests/type_prop/prior_box.cpp index 2a88b443cb797b..a3347704c7b963 100644 --- a/src/core/tests/type_prop/prior_box.cpp +++ b/src/core/tests/type_prop/prior_box.cpp @@ -181,7 +181,7 @@ TYPED_TEST_P(PriorBoxTest, inputs_are_interval_shapes) { TYPED_TEST_P(PriorBoxTest, preseve_values_and_labels_on_inputs) { auto out_size_shape = PartialShape{6, 8}; - DimensionTracker::set_label(out_size_shape[0], 10); + out_size_shape[0].set_label(10); const auto output_size = std::make_shared(element::i16, out_size_shape); const auto image_size = Constant::create(element::i16, Shape{2}, {300, 300}); diff --git a/src/core/tests/type_prop/prior_box_clustered.cpp b/src/core/tests/type_prop/prior_box_clustered.cpp index 69531cebc01f5f..c88a3d2a3c16db 100644 --- a/src/core/tests/type_prop/prior_box_clustered.cpp +++ b/src/core/tests/type_prop/prior_box_clustered.cpp @@ -155,7 +155,7 @@ TYPED_TEST_P(PriorBoxClusteredTest, inputs_are_interval_shapes) { TYPED_TEST_P(PriorBoxClusteredTest, preseve_values_and_labels_on_inputs) { auto out_size_shape = PartialShape{6, 8}; - DimensionTracker::set_label(out_size_shape[0], 10); + out_size_shape[0].set_label(10); const auto output_size = std::make_shared(element::i16, out_size_shape); const auto image_size = Constant::create(element::i16, Shape{2}, {300, 300}); diff --git a/src/core/tests/type_prop/reshape.cpp b/src/core/tests/type_prop/reshape.cpp index 2446f3070ed756..797c830978d934 100644 --- a/src/core/tests/type_prop/reshape.cpp +++ b/src/core/tests/type_prop/reshape.cpp @@ -6,7 +6,7 @@ #include "common_test_utils/test_assertions.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/broadcast.hpp" #include "openvino/op/concat.hpp" #include "openvino/op/constant.hpp" @@ -39,14 +39,14 @@ TEST(type_prop, static_value_propagation) { TEST(type_prop, reshape_static_dimension_stops_label_propagation_for_auto_batch_case) { auto shape = ov::PartialShape({1, 1280, 1, 1}); - ov::DimensionTracker::set_label(shape[0], 1); + shape[0].set_label(1); auto param = make_shared(element::f32, shape); auto pattern = op::v0::Constant::create(element::i64, {2}, {-1, 1280}); auto r = make_shared(param, pattern, false); ASSERT_EQ(r->get_element_type(), element::f32); ASSERT_EQ(r->get_shape(), (Shape{1, 1280})); - ASSERT_EQ(ov::no_label, ov::DimensionTracker::get_label(r->get_output_partial_shape(0)[0])); + ASSERT_EQ(ov::no_label, r->get_output_partial_shape(0)[0].get_label()); } TEST(type_prop, interval_value_propagation) { @@ -682,7 +682,7 @@ TEST(type_prop, reshape_dynamic_shape_propagation_with_i32_precision) { TEST(type_prop, reshape_dynamic_value_and_label_propagation) { Dimension marked_0 = Dimension(3); - ov::DimensionTracker::set_label(marked_0, 10); + marked_0.set_label(10); PartialShape target_0 = PartialShape{marked_0, 4}; auto param = std::make_shared(element::f32, Shape{1}); @@ -967,7 +967,7 @@ TEST(type_prop, reshape_label_propagation_minus_one_no_special_zero_case_5) { TEST(type_prop, reshape_label_propagation_minus_one_no_special_zero_case_6) { PartialShape data_shape = PartialShape{2, 3, 2, 1, 4}; - DimensionTracker::set_label(data_shape[1], 11); + data_shape[1].set_label(11); auto input = make_shared(element::f32, data_shape); auto output_pattern = make_shared(element::i64, Shape{5}, std::vector{4, 1, -1, 1, 4}); @@ -997,7 +997,7 @@ TEST(type_prop, reshape_label_propagation_minus_one_no_special_zero_case_7) { TEST(type_prop, reshape_label_propagation_minus_one_no_special_zero_case_8) { PartialShape data_shape = PartialShape{{1, 2}, 4, 2, 3}; - DimensionTracker::set_label(data_shape[0], 121); + data_shape[0].set_label(121); auto input = make_shared(element::f32, data_shape); auto output_pattern = make_shared(element::i64, Shape{4}, std::vector{4, 2, 3, -1}); @@ -1135,8 +1135,8 @@ TEST(type_prop, reshape_label_propagation_minus_one_special_zero_case_6) { TEST(type_prop, reshape_label_propagation_minus_one_special_zero_case_7) { auto data_shape = PartialShape{{2, 4}, 12, -1, 1, 2}; - DimensionTracker::set_label(data_shape[2], 121); - DimensionTracker::set_label(data_shape[0], 10); + data_shape[2].set_label(121); + data_shape[0].set_label(10); auto input = make_shared(element::f32, data_shape); auto output_pattern = make_shared(element::i64, Shape{5}, std::vector{0, -1, 3, 4, 3}); @@ -1151,8 +1151,8 @@ TEST(type_prop, reshape_label_propagation_minus_one_special_zero_case_7) { TEST(type_prop, reshape_label_propagation_minus_one_special_zero_case_8) { auto data_shape = PartialShape{{2, 4}, 4, -1, 1, 3, 3}; - DimensionTracker::set_label(data_shape[2], 121); - DimensionTracker::set_label(data_shape[0], 10); + data_shape[2].set_label(121); + data_shape[0].set_label(10); auto input = make_shared(element::f32, data_shape); auto output_pattern = make_shared(element::i64, Shape{5}, std::vector{0, -1, 3, 4, 3}); @@ -1182,7 +1182,7 @@ TEST(type_prop, reshape_label_propagation_minus_one_special_zero_case_9) { TEST(type_prop, reshape_tricky_label_propagation_for_auto_batch_case_1) { auto shape = PartialShape({1, 1280, 1, 1}); - DimensionTracker::set_label(shape[0], 1); + shape[0].set_label(1); auto param = make_shared(element::f32, shape); auto pattern = op::v0::Constant::create(element::i64, {2}, {-1, 1280}); auto r = make_shared(param, pattern, false); @@ -1194,7 +1194,7 @@ TEST(type_prop, reshape_tricky_label_propagation_for_auto_batch_case_1) { TEST(type_prop, reshape_tricky_label_propagation_for_auto_batch_case_2) { auto shape = ov::PartialShape({1, 1280, 1, 1}); - DimensionTracker::set_label(shape[2], 2); + shape[2].set_label(2); auto param = make_shared(element::f32, shape); auto pattern = op::v0::Constant::create(element::i64, {2}, {-1, 1280}); auto r = make_shared(param, pattern, false); @@ -1206,8 +1206,8 @@ TEST(type_prop, reshape_tricky_label_propagation_for_auto_batch_case_2) { TEST(type_prop, reshape_tricky_label_propagation_for_auto_batch_case_3) { auto shape = PartialShape({1, 1280, 1, 1}); - DimensionTracker::set_label(shape[0], 1); - DimensionTracker::set_label(shape[2], 2); + shape[0].set_label(1); + shape[2].set_label(2); auto param = make_shared(element::f32, shape); auto pattern = op::v0::Constant::create(element::i64, {2}, {-1, 1280}); auto r = make_shared(param, pattern, false); @@ -1219,7 +1219,7 @@ TEST(type_prop, reshape_tricky_label_propagation_for_auto_batch_case_3) { TEST(type_prop, reshape_tricky_label_propagation_for_auto_batch_case_4) { auto shape = PartialShape({1, 1280}); - DimensionTracker::set_label(shape[0], 1); + shape[0].set_label(1); auto param = make_shared(element::f32, shape); auto pattern = op::v0::Constant::create(element::i64, {2}, {-1, 1280}); auto r = make_shared(param, pattern, false); diff --git a/src/core/tests/type_prop/rnn_cell_base.cpp b/src/core/tests/type_prop/rnn_cell_base.cpp index 1387379976b7a9..a228749d604b9e 100644 --- a/src/core/tests/type_prop/rnn_cell_base.cpp +++ b/src/core/tests/type_prop/rnn_cell_base.cpp @@ -123,11 +123,11 @@ TYPED_TEST_P(RNNCellTest, default_ctor) { TYPED_TEST_P(RNNCellTest, static_labels_dims_shape_infer) { RNNCellParams params; params.batch_size = Dimension(8); - ov::DimensionTracker::set_label(params.batch_size, 10); + params.batch_size.set_label(10); params.input_size = Dimension(64); - ov::DimensionTracker::set_label(params.input_size, 11); + params.input_size.set_label(11); params.hidden_size = Dimension(128); - ov::DimensionTracker::set_label(params.hidden_size, 12); + params.hidden_size.set_label(12); auto op = this->make_rnn_cell_based_op(params); EXPECT_EQ(op->get_output_size(), params.outputs_size); @@ -141,11 +141,11 @@ TYPED_TEST_P(RNNCellTest, static_labels_dims_shape_infer) { TYPED_TEST_P(RNNCellTest, interval_labels_dims_shape_infer) { RNNCellParams params; params.batch_size = Dimension(8, 16); - ov::DimensionTracker::set_label(params.batch_size, 10); + params.batch_size.set_label(10); params.input_size = Dimension(64, 128); - ov::DimensionTracker::set_label(params.input_size, 11); + params.input_size.set_label(11); params.hidden_size = Dimension(128, 256); - ov::DimensionTracker::set_label(params.hidden_size, 12); + params.hidden_size.set_label(12); auto op = this->make_rnn_cell_based_op(params); EXPECT_EQ(op->get_output_size(), params.outputs_size); diff --git a/src/core/tests/type_prop/rnn_seq_base.cpp b/src/core/tests/type_prop/rnn_seq_base.cpp index 25ec557989cc4d..3f04eccd372411 100644 --- a/src/core/tests/type_prop/rnn_seq_base.cpp +++ b/src/core/tests/type_prop/rnn_seq_base.cpp @@ -172,13 +172,13 @@ TYPED_TEST_P(RNNSeqBaseTest, default_ctor_BIDIRECTIONAL) { TYPED_TEST_P(RNNSeqBaseTest, static_labels_dims_shape_infer) { RNNSeqParams params; params.batch_size = Dimension(8); - ov::DimensionTracker::set_label(params.batch_size, 10); + params.batch_size.set_label(10); params.input_size = Dimension(64); - ov::DimensionTracker::set_label(params.seq_length, 11); + params.seq_length.set_label(11); params.hidden_size = Dimension(128); - ov::DimensionTracker::set_label(params.hidden_size, 12); + params.hidden_size.set_label(12); params.num_directions = Dimension(1); - ov::DimensionTracker::set_label(params.num_directions, 13); + params.num_directions.set_label(13); auto op = this->make_rnn_seq_based_op(params); EXPECT_EQ(op->get_output_size(), params.outputs_size); @@ -196,13 +196,13 @@ TYPED_TEST_P(RNNSeqBaseTest, static_labels_dims_shape_infer) { TYPED_TEST_P(RNNSeqBaseTest, interval_labels_dims_shape_infer_FORWARD) { RNNSeqParams params; params.batch_size = Dimension(8, 16); - ov::DimensionTracker::set_label(params.batch_size, 10); + params.batch_size.set_label(10); params.input_size = Dimension(64, 128); - ov::DimensionTracker::set_label(params.seq_length, 11); + params.seq_length.set_label(11); params.hidden_size = Dimension(128, 256); - ov::DimensionTracker::set_label(params.hidden_size, 12); + params.hidden_size.set_label(12); params.num_directions = Dimension(1, 2); - ov::DimensionTracker::set_label(params.num_directions, 13); + params.num_directions.set_label(13); auto op = this->make_rnn_seq_based_op(params); EXPECT_EQ(op->get_output_size(), params.outputs_size); @@ -220,13 +220,13 @@ TYPED_TEST_P(RNNSeqBaseTest, interval_labels_dims_shape_infer_FORWARD) { TYPED_TEST_P(RNNSeqBaseTest, interval_labels_dims_shape_infer_REVERSE) { RNNSeqParams params; params.batch_size = Dimension(8, 16); - ov::DimensionTracker::set_label(params.batch_size, 10); + params.batch_size.set_label(10); params.input_size = Dimension(64, 128); - ov::DimensionTracker::set_label(params.seq_length, 11); + params.seq_length.set_label(11); params.hidden_size = Dimension(128, 256); - ov::DimensionTracker::set_label(params.hidden_size, 12); + params.hidden_size.set_label(12); params.num_directions = Dimension(1, 2); - ov::DimensionTracker::set_label(params.num_directions, 13); + params.num_directions.set_label(13); params.direction = op::RecurrentSequenceDirection::REVERSE; @@ -246,13 +246,13 @@ TYPED_TEST_P(RNNSeqBaseTest, interval_labels_dims_shape_infer_REVERSE) { TYPED_TEST_P(RNNSeqBaseTest, interval_labels_dims_shape_infer_BIDIRECTIONAL) { RNNSeqParams params; params.batch_size = Dimension(8, 16); - ov::DimensionTracker::set_label(params.batch_size, 10); + params.batch_size.set_label(10); params.input_size = Dimension(64, 128); - ov::DimensionTracker::set_label(params.seq_length, 11); + params.seq_length.set_label(11); params.hidden_size = Dimension(128, 256); - ov::DimensionTracker::set_label(params.hidden_size, 12); + params.hidden_size.set_label(12); params.num_directions = Dimension(1, 2); - ov::DimensionTracker::set_label(params.num_directions, 13); + params.num_directions.set_label(13); params.direction = op::RecurrentSequenceDirection::BIDIRECTIONAL; diff --git a/src/core/tests/type_prop/scatter_update.cpp b/src/core/tests/type_prop/scatter_update.cpp index 0d3a62cdeb058d..48215d7b4e641b 100644 --- a/src/core/tests/type_prop/scatter_update.cpp +++ b/src/core/tests/type_prop/scatter_update.cpp @@ -5,7 +5,7 @@ #include "openvino/op/scatter_update.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/broadcast.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/parameter.hpp" @@ -219,7 +219,7 @@ TEST(type_prop, scatter_update_v3_dynamic_data_shape) { TEST(type_prop, scatter_update_v3_interval_label_data_shape) { auto labeled_dim = Dimension(1, 9); ov::label_t label = 222; - ov::DimensionTracker::set_label(labeled_dim, label); + labeled_dim.set_label(label); PartialShape data_shape = PartialShape{-1, {2, 8}, labeled_dim, 4}; Shape indices_shape{2, 1}; Shape updates_shape{3, 2, 1, 2, 4}; @@ -240,7 +240,7 @@ TEST(type_prop, scatter_update_v3_interval_label_data_shape) { TEST(type_prop, scatter_update_v3_value_label_propagation) { auto labeled_dim = Dimension(5, 7); ov::label_t label = 2345664; - ov::DimensionTracker::set_label(labeled_dim, label); + labeled_dim.set_label(label); PartialShape data_shape = PartialShape{labeled_dim}; auto data = make_shared(element::i8, data_shape); @@ -255,8 +255,8 @@ TEST(type_prop, scatter_update_v3_value_label_propagation) { const auto& output_shape = broadcast->get_output_partial_shape(0); EXPECT_EQ(output_shape, PartialShape({1, {5, 7}})); - EXPECT_EQ(ov::DimensionTracker::get_label(output_shape[0]), ov::no_label); - EXPECT_EQ(ov::DimensionTracker::get_label(output_shape[1]), label); + EXPECT_EQ(output_shape[0].get_label(), ov::no_label); + EXPECT_EQ(output_shape[1].get_label(), label); } TEST(type_prop, scatter_update_v3_partial_value_propagation) { diff --git a/src/core/tests/type_prop/select.cpp b/src/core/tests/type_prop/select.cpp index c2e3ec86639f48..83e6cd72e17b0a 100644 --- a/src/core/tests/type_prop/select.cpp +++ b/src/core/tests/type_prop/select.cpp @@ -5,7 +5,7 @@ #include "openvino/op/select.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" using namespace std; using namespace ov; diff --git a/src/core/tests/type_prop/shape_of.cpp b/src/core/tests/type_prop/shape_of.cpp index d431ddbff65592..1eaa642c4b92c7 100644 --- a/src/core/tests/type_prop/shape_of.cpp +++ b/src/core/tests/type_prop/shape_of.cpp @@ -5,7 +5,7 @@ #include "openvino/op/shape_of.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/broadcast.hpp" using namespace std; @@ -108,7 +108,7 @@ TEST(type_prop, shape_of_output_type_v3) { TEST(type_prop, shape_of_1_dynamic_value_and_label_propagation) { Dimension marked_0 = Dimension(3); - ov::DimensionTracker::set_label(marked_0, 10); + marked_0.set_label(10); PartialShape target_0 = PartialShape{marked_0, 4}; auto param = std::make_shared(element::f32, Shape{1}); @@ -119,12 +119,12 @@ TEST(type_prop, shape_of_1_dynamic_value_and_label_propagation) { ASSERT_EQ(bc->get_shape(), (Shape{3, 4})); const auto& output_shape = bc->get_output_partial_shape(0); - ASSERT_EQ(ov::DimensionTracker::get_label(output_shape[0]), 10); + ASSERT_EQ(output_shape[0].get_label(), 10); } TEST(type_prop, shape_of_3_dynamic_value_and_label_propagation) { Dimension marked_0 = Dimension(3); - ov::DimensionTracker::set_label(marked_0, 10); + marked_0.set_label(10); PartialShape target_0 = PartialShape{marked_0, 4}; auto param = std::make_shared(element::f32, Shape{1}); @@ -135,7 +135,7 @@ TEST(type_prop, shape_of_3_dynamic_value_and_label_propagation) { ASSERT_EQ(bc->get_shape(), (Shape{3, 4})); const auto& output_shape = bc->get_output_partial_shape(0); - ASSERT_EQ(ov::DimensionTracker::get_label(output_shape[0]), 10); + ASSERT_EQ(output_shape[0].get_label(), 10); } TEST(type_prop, shape_of_3_dynamic_value_propagation_out_i32) { diff --git a/src/core/tests/type_prop/slice.cpp b/src/core/tests/type_prop/slice.cpp index d62ce5001f928c..e0dc214d73f5d3 100644 --- a/src/core/tests/type_prop/slice.cpp +++ b/src/core/tests/type_prop/slice.cpp @@ -6,7 +6,7 @@ #include "common_test_utils/test_assertions.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/opsets/opset9.hpp" #include "sequnce_generator.hpp" @@ -1063,7 +1063,7 @@ TEST(type_prop, slice_v8_dynamic_rank_inputs) { TEST(type_prop, slice_v8_dynamic_value_and_label_propagation) { Dimension marked_0 = Dimension(3, 7); - ov::DimensionTracker::set_label(marked_0, 10); + marked_0.set_label(10); PartialShape target_0 = PartialShape{marked_0, 4}; auto param = std::make_shared(element::f32, Shape{1}); @@ -1081,7 +1081,7 @@ TEST(type_prop, slice_v8_dynamic_value_and_label_propagation) { const auto& output_shape = bc->get_output_partial_shape(0); EXPECT_EQ(output_shape, (PartialShape{{3, 7}})); - EXPECT_EQ(ov::DimensionTracker::get_label(output_shape[0]), 10); + EXPECT_EQ(output_shape[0].get_label(), 10); } TEST(type_prop, slice_v8_dynamic_dimension_but_slice_min_is_lt_input_min_size) { diff --git a/src/core/tests/type_prop/squeeze.cpp b/src/core/tests/type_prop/squeeze.cpp index 7561a65c798d54..a5b106e4a8dc43 100644 --- a/src/core/tests/type_prop/squeeze.cpp +++ b/src/core/tests/type_prop/squeeze.cpp @@ -6,7 +6,7 @@ #include "common_test_utils/test_assertions.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/broadcast.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/gather.hpp" diff --git a/src/core/tests/type_prop/strided_slice.cpp b/src/core/tests/type_prop/strided_slice.cpp index c0c6c31c963a49..bf93b7eaa1d13e 100644 --- a/src/core/tests/type_prop/strided_slice.cpp +++ b/src/core/tests/type_prop/strided_slice.cpp @@ -6,8 +6,8 @@ #include "common_test_utils/test_assertions.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" #include "openvino/core/except.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/shape_of.hpp" #include "openvino/opsets/opset9.hpp" @@ -386,7 +386,7 @@ TEST(type_prop, strided_slice_reverse_end_is_int64_min) { TEST(type_prop, strided_slice_dynamic_value_and_label_propagation) { // Use evaluate upper,lower and labels auto marked_0 = Dimension(3, 5); - ov::DimensionTracker::set_label(marked_0, 10); + marked_0.set_label(10); PartialShape target_0 = PartialShape{marked_0, 4}; auto param = std::make_shared(element::f32, Shape{1}); diff --git a/src/core/tests/type_prop/tile.cpp b/src/core/tests/type_prop/tile.cpp index 0419b8254873fb..8200e781d74240 100644 --- a/src/core/tests/type_prop/tile.cpp +++ b/src/core/tests/type_prop/tile.cpp @@ -6,7 +6,7 @@ #include "common_test_utils/test_assertions.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/broadcast.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/shape_of.hpp" diff --git a/src/core/tests/type_prop/top_k.cpp b/src/core/tests/type_prop/top_k.cpp index 90523d20f562d9..d7131c05ab689f 100644 --- a/src/core/tests/type_prop/top_k.cpp +++ b/src/core/tests/type_prop/top_k.cpp @@ -4,7 +4,7 @@ #include "common_test_utils/test_assertions.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/opsets/opset11.hpp" #include "topk_shape_inference.hpp" @@ -248,7 +248,7 @@ TYPED_TEST_P(topk_type_prop_with_evaluate, propagate_label_and_not_interval_valu TYPED_TEST_P(topk_type_prop, preserve_partial_values_and_labels_k_is_interval) { auto k_dim = Dimension{10, 20}; auto shape = PartialShape{k_dim}; - ov::DimensionTracker::set_label(k_dim, 20); + k_dim.set_label(20); const auto p_k = std::make_shared(element::i64, shape); const auto shape_of_k = std::make_shared(p_k); diff --git a/src/core/tests/type_prop/transpose.cpp b/src/core/tests/type_prop/transpose.cpp index e8ac81925a4a7e..4e611f5bf04894 100644 --- a/src/core/tests/type_prop/transpose.cpp +++ b/src/core/tests/type_prop/transpose.cpp @@ -5,7 +5,7 @@ #include "openvino/op/transpose.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/convert.hpp" #include "openvino/op/divide.hpp" diff --git a/src/core/tests/type_prop/unsqueeze.cpp b/src/core/tests/type_prop/unsqueeze.cpp index ac5b826ab6792b..6a0df65b8fbf4f 100644 --- a/src/core/tests/type_prop/unsqueeze.cpp +++ b/src/core/tests/type_prop/unsqueeze.cpp @@ -6,7 +6,7 @@ #include "common_test_utils/type_prop.hpp" #include "gmock/gmock.h" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/op/broadcast.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/gather.hpp" diff --git a/src/core/tests/type_prop/variadic_split.cpp b/src/core/tests/type_prop/variadic_split.cpp index caf6466aeddd49..633d8828a8053b 100644 --- a/src/core/tests/type_prop/variadic_split.cpp +++ b/src/core/tests/type_prop/variadic_split.cpp @@ -6,7 +6,7 @@ #include "common_test_utils/test_assertions.hpp" #include "common_test_utils/type_prop.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/label_table.hpp" #include "openvino/core/validation_util.hpp" #include "openvino/op/broadcast.hpp" #include "openvino/op/shape_of.hpp" diff --git a/src/inference/src/check_network_batchable.cpp b/src/inference/src/check_network_batchable.cpp index b456fec87912b2..0d17fb590d3ca1 100644 --- a/src/inference/src/check_network_batchable.cpp +++ b/src/inference/src/check_network_batchable.cpp @@ -1,6 +1,6 @@ #include "check_network_batchable.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/dimension.hpp" #include "openvino/op/detection_output.hpp" #include "openvino/op/ops.hpp" #include "openvino/pass/manager.hpp" @@ -48,7 +48,7 @@ NetworkBatchAbility is_model_batchable(const std::shared_ptr& m if (shape.is_dynamic()) return NetworkBatchAbility::NO; // check the batch dim: either 0th (and the original batch size of 1) or none - if (shape.size() && ov::DimensionTracker::get_label(shape[0])) { + if (shape.size() && shape[0].has_label()) { const auto& static_shape = input->get_shape(); if (static_shape[0] != 1) return NetworkBatchAbility::NO; @@ -57,7 +57,7 @@ NetworkBatchAbility is_model_batchable(const std::shared_ptr& m } else { // if the 0-th dim is not for the batch, then we support only the case when NONE dimension is batch for (size_t s = 1; s < shape.size(); s++) - if (ov::DimensionTracker::get_label(shape[s])) + if (shape[s].has_label()) return NetworkBatchAbility::NO; } } diff --git a/src/plugins/auto_batch/src/plugin.cpp b/src/plugins/auto_batch/src/plugin.cpp index 4024051f45c602..cc547f4e209a40 100644 --- a/src/plugins/auto_batch/src/plugin.cpp +++ b/src/plugins/auto_batch/src/plugin.cpp @@ -7,7 +7,7 @@ #include "plugin.hpp" #include "compiled_model.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/dimension.hpp" #include "openvino/pass/manager.hpp" #include "openvino/runtime/intel_gpu/properties.hpp" #include "openvino/runtime/internal_properties.hpp" @@ -168,7 +168,7 @@ std::shared_ptr Plugin::compile_model(const std::shared_ptr< if (shape.is_dynamic()) OPENVINO_THROW("Auto-batching does not support dynamic networks!"); // check the batch dim: either 0th (and the original batch size of 1) or none - if (shape.size() && ov::DimensionTracker::get_label(shape[0])) { + if (shape.size() && shape[0].has_label()) { const auto& static_shape = input->get_shape(); if (static_shape[0] != 1) OPENVINO_THROW("Auto-batching does not reshape/re-batch originally batched networks!"); @@ -177,7 +177,7 @@ std::shared_ptr Plugin::compile_model(const std::shared_ptr< } else { // if the 0-th dim is not for the batch, then we support only the case when NONE dimension is batch for (size_t s = 1; s < shape.size(); s++) - if (ov::DimensionTracker::get_label(shape[s])) + if (shape[s].has_label()) OPENVINO_THROW( "Auto-batching operates only networks with inputs/outputs batched by 0th dimension"); } @@ -187,7 +187,7 @@ std::shared_ptr Plugin::compile_model(const std::shared_ptr< if (shape.is_dynamic()) OPENVINO_THROW("Auto-batching does not support dynamic networks!"); // check the batch dim: either 0th (and the original batch size of 1) or none - if (shape.size() && ov::DimensionTracker::get_label(shape[0])) { + if (shape.size() && shape[0].has_label()) { if (shape[0] != 1) OPENVINO_THROW("Auto-batching does not reshape/re-batch originally batched networks!"); const auto& node = output->input_value(0); @@ -196,7 +196,7 @@ std::shared_ptr Plugin::compile_model(const std::shared_ptr< } else { // if the 0-th dim is not for the batch, then we support only the case when NONE dimension is batch for (size_t s = 1; s < shape.size(); s++) - if (ov::DimensionTracker::get_label(shape[s])) + if (shape[s].get_label()) OPENVINO_THROW("Auto-batching operates only networks with outputs batched by 0th dimension"); } } diff --git a/src/plugins/auto_batch/tests/unit/async_infer_request_test.cpp b/src/plugins/auto_batch/tests/unit/async_infer_request_test.cpp index a78d71f79b4c58..01c43c9ae60ddb 100644 --- a/src/plugins/auto_batch/tests/unit/async_infer_request_test.cpp +++ b/src/plugins/auto_batch/tests/unit/async_infer_request_test.cpp @@ -6,7 +6,7 @@ #include "common_test_utils/subgraph_builders/multi_single_conv.hpp" #include "mock_common.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/dimension.hpp" #include "openvino/core/type/element_type.hpp" #include "openvino/runtime/threading/immediate_executor.hpp" #include "transformations/utils/utils.hpp" diff --git a/src/plugins/auto_batch/tests/unit/plugin_compile_model_test.cpp b/src/plugins/auto_batch/tests/unit/plugin_compile_model_test.cpp index 9235bd62f73114..129270567cb377 100644 --- a/src/plugins/auto_batch/tests/unit/plugin_compile_model_test.cpp +++ b/src/plugins/auto_batch/tests/unit/plugin_compile_model_test.cpp @@ -5,7 +5,7 @@ #include "common_test_utils/subgraph_builders/conv_pool_relu_non_zero.hpp" #include "common_test_utils/subgraph_builders/multi_single_conv.hpp" #include "mock_common.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/dimension.hpp" #include "openvino/runtime/intel_gpu/properties.hpp" #include "unit_test_utils/mocks/openvino/runtime/mock_icore.hpp" @@ -114,7 +114,7 @@ TEST_P(PluginCompileModelTest, PluginCompileModelWithRemoteContextTestCase) { TEST_P(PluginCompileModelTest, PluginCompileModelBatchedModelTestCase) { m_model = ov::test::utils::make_conv_pool_relu_non_zero({1, 1, 32, 32}); auto batch = ov::Dimension(5); - ov::DimensionTracker::set_label(batch, 11); + batch.set_label(11); auto p_shape = ov::PartialShape{batch, 1, 32, 32}; m_model->reshape(p_shape); ASSERT_NO_THROW(m_plugin->compile_model(m_model, m_plugin_properities)); @@ -123,7 +123,7 @@ TEST_P(PluginCompileModelTest, PluginCompileModelBatchedModelTestCase) { TEST_P(PluginCompileModelTest, PluginCompileModelBatchedModelWithRemoteContextTestCase) { m_model = ov::test::utils::make_conv_pool_relu_non_zero({1, 1, 32, 32}); auto batch = ov::Dimension(5); - ov::DimensionTracker::set_label(batch, 11); + batch.set_label(11); auto p_shape = ov::PartialShape{batch, 1, 32, 32}; m_model->reshape(p_shape); ASSERT_NO_THROW(m_plugin->compile_model(m_model, m_plugin_properities, m_remote_context)); diff --git a/src/plugins/auto_batch/tests/unit/sync_infer_request_test.cpp b/src/plugins/auto_batch/tests/unit/sync_infer_request_test.cpp index 5b836efd97b0a8..bfce0d3d28ca01 100644 --- a/src/plugins/auto_batch/tests/unit/sync_infer_request_test.cpp +++ b/src/plugins/auto_batch/tests/unit/sync_infer_request_test.cpp @@ -6,7 +6,7 @@ #include "common_test_utils/subgraph_builders/multi_single_conv.hpp" #include "mock_common.hpp" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/dimension.hpp" #include "openvino/core/type/element_type.hpp" #include "openvino/runtime/threading/immediate_executor.hpp" #include "transformations/utils/utils.hpp" diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/ngram_fusion.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/ngram_fusion.cpp index 8b5ec63af3a312..7b106dce469c9f 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/ngram_fusion.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/ngram_fusion.cpp @@ -7,7 +7,7 @@ #include "openvino/opsets/opset1.hpp" #include #include -#include +#include #include #include #include @@ -99,7 +99,7 @@ ov::intel_cpu::NgramFusion::NgramFusion() { } // save label of cropped_shape and check it against first dimension of tokens shape cropped_shape_label = pattern_map.at(cropped_shape_m).get_tensor().get_value_label()[0]; - if (ov::DimensionTracker::get_label(tokens_shape[0]) != cropped_shape_label) + if (tokens_shape[0].get_label() != cropped_shape_label) return false; } @@ -109,7 +109,7 @@ ov::intel_cpu::NgramFusion::NgramFusion() { }; auto tokens_label_match = [tokens_match, cropped_shape_label](ov::Output output) -> bool { - return tokens_match(output) && ov::DimensionTracker::get_label(output.get_partial_shape()[0]) == cropped_shape_label; + return tokens_match(output) && output.get_partial_shape()[0].get_label() == cropped_shape_label; }; ov::Output indices; diff --git a/src/plugins/intel_gpu/src/plugin/plugin.cpp b/src/plugins/intel_gpu/src/plugin/plugin.cpp index e931746d6d92f9..787ac02c77ed27 100644 --- a/src/plugins/intel_gpu/src/plugin/plugin.cpp +++ b/src/plugins/intel_gpu/src/plugin/plugin.cpp @@ -26,7 +26,6 @@ #include "intel_gpu/runtime/execution_config.hpp" #include "intel_gpu/runtime/itt.hpp" #include "openvino/core/deprecated.hpp" -#include "openvino/core/dimension_tracker.hpp" #include "openvino/pass/manager.hpp" #include "openvino/pass/visualize_tree.hpp" #include "openvino/runtime/device_id_parser.hpp" @@ -674,7 +673,7 @@ uint32_t Plugin::get_max_batch_size(const ov::AnyMap& options) const { if (shape.size()) { for (size_t s = 0; s < shape.size(); s++) { - if (ov::DimensionTracker::get_label(shape[s])) { + if (shape[s].get_label() != ov::no_label) { // batched dim for the input auto batched_input_id = ov::op::util::get_ie_output_name(params[input_id]->output(0)); GPU_DEBUG_LOG << "[MAX_BATCH_SIZE] detected batched input " << batched_input_id diff --git a/src/tests/test_utils/common_test_utils/include/common_test_utils/type_prop.hpp b/src/tests/test_utils/common_test_utils/include/common_test_utils/type_prop.hpp index 3ba1064c820a38..58bed2bae22e2c 100644 --- a/src/tests/test_utils/common_test_utils/include/common_test_utils/type_prop.hpp +++ b/src/tests/test_utils/common_test_utils/include/common_test_utils/type_prop.hpp @@ -5,7 +5,7 @@ #pragma once #include "gmock/gmock.h" -#include "openvino/core/dimension_tracker.hpp" +#include "openvino/core/dimension.hpp" #include "openvino/core/partial_shape.hpp" #include "openvino/op/parameter.hpp" diff --git a/src/tests/test_utils/common_test_utils/src/type_prop.cpp b/src/tests/test_utils/common_test_utils/src/type_prop.cpp index 19384d778d243b..9708b939c21253 100644 --- a/src/tests/test_utils/common_test_utils/src/type_prop.cpp +++ b/src/tests/test_utils/common_test_utils/src/type_prop.cpp @@ -10,7 +10,7 @@ ov::TensorLabel get_shape_labels(const ov::PartialShape& p_shape) { ov::TensorLabel labels; transform(p_shape.cbegin(), p_shape.cend(), back_inserter(labels), [](const ov::Dimension& dim) { - return ov::DimensionTracker::get_label(dim); + return dim.get_label(); }); return labels; } @@ -27,7 +27,7 @@ void set_shape_labels(ov::PartialShape& p_shape, const ov::TensorLabel& labels) std::for_each(p_shape.begin(), p_shape.end(), [&label_it](ov::Dimension& dim) { if (*label_it > 0) { - ov::DimensionTracker::set_label(dim, *label_it); + dim.set_label(*label_it); } ++label_it; });