From ebb2b13e05bd9d7b569c2e3a297653992ebfa8e2 Mon Sep 17 00:00:00 2001 From: Vladislav Golubev Date: Wed, 8 Jan 2025 14:41:54 +0100 Subject: [PATCH] TransformationContext is removed --- .../low_precision/layer_transformation.hpp | 2 - .../include/low_precision/network_helper.hpp | 1 - .../low_precision/transformation_context.hpp | 39 ------------------- .../weightable_layer_transformation.hpp | 1 - .../src/layer_transformation.cpp | 11 +----- .../src/transformation_context.cpp | 18 --------- .../tests/layer_transformation.hpp | 1 - .../simple_low_precision_transformer.cpp | 1 - 8 files changed, 1 insertion(+), 73 deletions(-) delete mode 100644 src/common/low_precision_transformations/include/low_precision/transformation_context.hpp delete mode 100644 src/common/low_precision_transformations/src/transformation_context.cpp diff --git a/src/common/low_precision_transformations/include/low_precision/layer_transformation.hpp b/src/common/low_precision_transformations/include/low_precision/layer_transformation.hpp index 604f88294adeba..e8e955ba091c30 100644 --- a/src/common/low_precision_transformations/include/low_precision/layer_transformation.hpp +++ b/src/common/low_precision_transformations/include/low_precision/layer_transformation.hpp @@ -12,7 +12,6 @@ #include #include "openvino/pass/matcher_pass.hpp" -#include "transformation_context.hpp" #include "quantization_details.hpp" #include "low_precision/common/ie_lpt_exception.hpp" #include "common/fake_quantize_dequantization.hpp" @@ -346,7 +345,6 @@ class LP_TRANSFORMATIONS_API LayerTransformation : public ov::pass::MatcherPass bool scalingMode; static constexpr char originalLayerPostfix[] = "_original"; - TransformationContext* context; protected: std::shared_ptr moveDequantizationAfter( diff --git a/src/common/low_precision_transformations/include/low_precision/network_helper.hpp b/src/common/low_precision_transformations/include/low_precision/network_helper.hpp index 40f2973b0701df..d4a3ba6d429044 100644 --- a/src/common/low_precision_transformations/include/low_precision/network_helper.hpp +++ b/src/common/low_precision_transformations/include/low_precision/network_helper.hpp @@ -16,7 +16,6 @@ #include "rt_info/precisions_attribute.hpp" #include "rt_info/quantization_granularity_attribute.hpp" #include "rt_info/intervals_alignment_attribute.hpp" -#include "transformation_context.hpp" #include "quantization_details.hpp" #include "transformations/utils/utils.hpp" #include "common/fake_quantize_dequantization.hpp" diff --git a/src/common/low_precision_transformations/include/low_precision/transformation_context.hpp b/src/common/low_precision_transformations/include/low_precision/transformation_context.hpp deleted file mode 100644 index ec46224f8d88ae..00000000000000 --- a/src/common/low_precision_transformations/include/low_precision/transformation_context.hpp +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2018-2025 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include -#include -#include "low_precision/quantization_details.hpp" - -namespace ov { -namespace pass { -namespace low_precision { - -/** - * @ingroup ov_transformation_common_api - * @brief TransformationContext instance is used to pass model transformation context data between transformations. - */ -class LP_TRANSFORMATIONS_API TransformationContext { -public: - TransformationContext(); - explicit TransformationContext(std::shared_ptr model); - std::shared_ptr model; - - // Used to store handled FakeQuantize operations. - // ConcatTransformation and FakeQuantizeTransformation handle FakeQuantize operations. ConcatTransformation handles FakeQuantize operation first. - // If updatePrecision transformation option is set to False then there are no FakeQuantize operation attributes to identify that the operation - // have been handled by ConcatTransformation already: - // - output precision is original (FP32), - // - intervals are changed but not equal to precision boundaries, - // - quantization level can be or can be not changed. - // To avoid FakeQuantize operation double handling by FakeQuantizeTransformation after ConcatTransformation, FakeQuantizeTransformation - // has to use this member. - std::unordered_set quantizedFakeQuantizeNames; -}; - -} // namespace low_precision -} // namespace pass -} // namespace ov diff --git a/src/common/low_precision_transformations/include/low_precision/weightable_layer_transformation.hpp b/src/common/low_precision_transformations/include/low_precision/weightable_layer_transformation.hpp index 5f7b50716ca6cf..7b5c5b782d9a65 100644 --- a/src/common/low_precision_transformations/include/low_precision/weightable_layer_transformation.hpp +++ b/src/common/low_precision_transformations/include/low_precision/weightable_layer_transformation.hpp @@ -5,7 +5,6 @@ #pragma once #include -#include "transformation_context.hpp" #include "layer_transformation.hpp" #include "openvino/opsets/opset1.hpp" diff --git a/src/common/low_precision_transformations/src/layer_transformation.cpp b/src/common/low_precision_transformations/src/layer_transformation.cpp index fc852fe1d7b9f1..e7a1af82d95614 100644 --- a/src/common/low_precision_transformations/src/layer_transformation.cpp +++ b/src/common/low_precision_transformations/src/layer_transformation.cpp @@ -45,16 +45,7 @@ LayerTransformation::LayerTransformation(const Params& params) : deqPrecision(params.deqPrecision), defaultPrecisions(params.defaultPrecisions), reshapeIgnorePerTensorQuantizationCheck(params.reshapeIgnorePerTensorQuantizationCheck), - scalingMode(params.scalingMode), - context(nullptr) {} - -void LayerTransformation::setUpdatePrecisions(const bool updatePrecisions) { - this->updatePrecisions = updatePrecisions; -} - -void LayerTransformation::setDefaultPrecisions(const std::vector& defaultPrecisions) { - this->defaultPrecisions = defaultPrecisions; -} + scalingMode(params.scalingMode) {} bool LayerTransformation::canBeTransformed(const std::shared_ptr& layer) const { if (!isQuantized(layer, defaultPrecisions)) { diff --git a/src/common/low_precision_transformations/src/transformation_context.cpp b/src/common/low_precision_transformations/src/transformation_context.cpp deleted file mode 100644 index 7cef253f0e3f3f..00000000000000 --- a/src/common/low_precision_transformations/src/transformation_context.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2018-2025 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "low_precision/transformation_context.hpp" - -namespace ov { -namespace pass { -namespace low_precision { - -TransformationContext::TransformationContext() : model(nullptr) {} - -TransformationContext::TransformationContext(std::shared_ptr model) : model(model) { -} - -} // namespace low_precision -} // namespace pass -} // namespace ov diff --git a/src/common/low_precision_transformations/tests/layer_transformation.hpp b/src/common/low_precision_transformations/tests/layer_transformation.hpp index 6ce93863c42a67..83a9faa70e16d3 100644 --- a/src/common/low_precision_transformations/tests/layer_transformation.hpp +++ b/src/common/low_precision_transformations/tests/layer_transformation.hpp @@ -8,7 +8,6 @@ #include "low_precision/rt_info/intervals_alignment_attribute.hpp" #include "low_precision/rt_info/precisions_attribute.hpp" #include "low_precision/layer_transformation.hpp" -#include "low_precision/transformation_context.hpp" #include "low_precision/network_helper.hpp" #include "ov_lpt_models/common/dequantization_operations.hpp" diff --git a/src/common/low_precision_transformations/tests/simple_low_precision_transformer.cpp b/src/common/low_precision_transformations/tests/simple_low_precision_transformer.cpp index 9a80930160b298..ee1bb78ef4992a 100644 --- a/src/common/low_precision_transformations/tests/simple_low_precision_transformer.cpp +++ b/src/common/low_precision_transformations/tests/simple_low_precision_transformer.cpp @@ -10,7 +10,6 @@ #include "low_precision/markup_bias.hpp" #include "low_precision/markup_can_be_quantized.hpp" #include "low_precision/markup_quantization_granularity.hpp" -#include "low_precision/transformation_context.hpp" // cleanup transformations #include "low_precision/convert.hpp"