From 9a62376473475cb07e087cab36f8f344ee0140aa Mon Sep 17 00:00:00 2001 From: Edward Shogulin Date: Wed, 30 Mar 2022 16:50:46 +0300 Subject: [PATCH] part #2 --- docs/snippets/lpt_intel_cpu_plugin.cpp | 38 +++++----- .../operation_quantization_restriction.hpp | 69 ------------------- ..._quantization_granularity_restriction.hpp} | 9 ++- ...riction.hpp => precisions_restriction.hpp} | 12 ++-- .../quantization_granularity_restriction.hpp | 69 +++++++++++++++++++ .../include/low_precision/low_precision.hpp | 19 ++--- .../low_precision/markup_precisions.hpp | 4 +- ...pp => markup_quantization_granularity.hpp} | 14 ++-- .../multiply_to_group_convolution.hpp | 6 +- .../include/low_precision/network_helper.hpp | 2 +- ...=> quantization_granularity_attribute.hpp} | 4 +- .../src/align_quantization_parameters.cpp | 6 +- .../src/low_precision.cpp | 14 ++-- .../src/markup_precisions.cpp | 3 +- ...pp => markup_quantization_granularity.cpp} | 20 +++--- .../src/multiply_to_group_convolution.cpp | 2 +- .../src/rt_info/quantization_attribute.cpp | 10 --- .../quantization_granularity_attribute.cpp | 10 +++ src/plugins/intel_cpu/src/plugin.cpp | 23 ++++--- .../src/plugin/transformations_pipeline.cpp | 14 ++-- ...quantization_parameters_transformation.cpp | 8 +-- ...ction_with_intermediate_transformation.cpp | 4 +- .../concat_transformation.cpp | 14 ++-- ...t_with_different_precision_on_children.cpp | 8 +-- ...ate_precision_selection_transformation.cpp | 10 +-- ...oncat_with_intermediate_transformation.cpp | 6 +- ...ermediate_with_constant_transformation.cpp | 6 +- .../concat_with_neighbors_transformation.cpp | 10 +-- ...ghbors_transformation_with_convolution.cpp | 10 +-- ...th_not_quantized_parent_transformation.cpp | 14 ++-- .../concat_with_split_transformation.cpp | 14 ++-- ...ncat_with_strided_slice_transformation.cpp | 10 +-- ...ize_precision_selection_transformation.cpp | 4 +- .../fake_quantize_transformation.cpp | 6 +- ...ize_with_dq_not_optimal_transformation.cpp | 8 +-- ...kup_avg_pool_precisions_transformation.cpp | 4 +- .../move_fake_quantize_transformation.cpp | 10 +-- ...ly_to_group_convolution_transformation.cpp | 4 +- ...tization_granularity_restriction_test.cpp} | 10 +-- .../simple_low_precision_transformer.cpp | 8 +-- .../simple_low_precision_transformer.hpp | 8 +-- 41 files changed, 263 insertions(+), 261 deletions(-) delete mode 100644 src/common/low_precision_transformations/include/low_precision/common/operation_quantization_restriction.hpp rename src/common/low_precision_transformations/include/low_precision/{port_quantization_restriction.hpp => common/port_quantization_granularity_restriction.hpp} (57%) rename src/common/low_precision_transformations/include/low_precision/common/{operation_precision_restriction.hpp => precisions_restriction.hpp} (81%) create mode 100644 src/common/low_precision_transformations/include/low_precision/common/quantization_granularity_restriction.hpp rename src/common/low_precision_transformations/include/low_precision/{markup_per_tensor_quantization.hpp => markup_quantization_granularity.hpp} (72%) rename src/common/low_precision_transformations/include/low_precision/rt_info/{quantization_attribute.hpp => quantization_granularity_attribute.hpp} (86%) rename src/common/low_precision_transformations/src/{markup_per_tensor_quantization.cpp => markup_quantization_granularity.cpp} (73%) delete mode 100644 src/common/low_precision_transformations/src/rt_info/quantization_attribute.cpp create mode 100644 src/common/low_precision_transformations/src/rt_info/quantization_granularity_attribute.cpp rename src/tests/functional/inference_engine/lp_transformations/{operation_quantization_restriction_test.cpp => quantization_granularity_restriction_test.cpp} (89%) diff --git a/docs/snippets/lpt_intel_cpu_plugin.cpp b/docs/snippets/lpt_intel_cpu_plugin.cpp index 932526fe7b2f98..4a3e5212c87276 100644 --- a/docs/snippets/lpt_intel_cpu_plugin.cpp +++ b/docs/snippets/lpt_intel_cpu_plugin.cpp @@ -2,7 +2,7 @@ #include -#include +#include #include #include #include @@ -45,7 +45,7 @@ if (useLpt) { // nGraph common transformations happen here if (useLpt) { - // convert subtract constant to INT8 to prevent unnecessary FP16 to FP32 conversion + // convert subtract constant to INT8 to prevent unnecessary FP16 to FP32 conversion manager.register_pass(defaultPrecisions); } @@ -70,29 +70,29 @@ manager.run_passes(nGraphFunc); using namespace ngraph::pass::low_precision; if (useLpt) { // Low precision transformations plugin specific configuration: restrictions definition - auto supportedPrecisions = std::vector({ - OperationPrecisionRestriction::create({ + auto supportedPrecisions = std::vector({ + PrecisionsRestriction::create({ {0, {ngraph::element::u8}}, {1, {ngraph::element::i8}}, }), - OperationPrecisionRestriction::create({ + PrecisionsRestriction::create({ {0, {ngraph::element::u8, ngraph::element::i8}}, {1, {ngraph::element::i8}} }), - OperationPrecisionRestriction::create({ + PrecisionsRestriction::create({ {0, {ngraph::element::u8}}, {1, {ngraph::element::i8}} }), - OperationPrecisionRestriction::create({ + PrecisionsRestriction::create({ {0, {ngraph::element::u8}}, {1, {ngraph::element::i8}}, }), }); // Low precision transformations plugin specific configuration: per-tensor quantization operations definition - auto perTensorQuantization = std::vector({ - OperationQuantizationRestriction::create({0}), - OperationQuantizationRestriction::create({0}) + auto perTensorQuantization = std::vector({ + QuantizationGranularityRestriction::create({0}), + QuantizationGranularityRestriction::create({0}) }); // Low precision transformations instantiation and registration in pass manager @@ -133,8 +133,8 @@ ngraph::pass::Manager manager; using namespace ngraph::pass::low_precision; //! [lpt_supported_precisions] -auto supportedPrecisions = std::vector({ - OperationPrecisionRestriction::create({ +auto supportedPrecisions = std::vector({ + PrecisionsRestriction::create({ {0, {ngraph::element::u8}}, {1, {ngraph::element::i8}}, }), @@ -157,10 +157,10 @@ std::shared_ptr nGraphFunc; //! [per_tensor_quantization] using namespace ngraph::pass::low_precision; -const std::vector emptyRestrictions; +const std::vector emptyRestrictions; -auto perTensorQuantization = std::vector({ - OperationQuantizationRestriction::create({0}) +auto perTensorQuantization = std::vector({ + QuantizationGranularityRestriction::create({0}) }); ngraph::pass::Manager lptManager; @@ -197,15 +197,15 @@ ngraph::pass::Manager manager; using namespace ngraph::pass::low_precision; //! [lpt_markup_pipeline] -auto supportedPrecisions = std::vector({ - OperationPrecisionRestriction::create({ +auto supportedPrecisions = std::vector({ + PrecisionsRestriction::create({ {0, {ngraph::element::u8}}, {1, {ngraph::element::i8}}, }), }); -auto perTensorQuantization = std::vector({ - OperationQuantizationRestriction::create({0}) +auto perTensorQuantization = std::vector({ + QuantizationGranularityRestriction::create({0}) }); ngraph::pass::Manager lptManager; diff --git a/src/common/low_precision_transformations/include/low_precision/common/operation_quantization_restriction.hpp b/src/common/low_precision_transformations/include/low_precision/common/operation_quantization_restriction.hpp deleted file mode 100644 index 57daf057ef4dc6..00000000000000 --- a/src/common/low_precision_transformations/include/low_precision/common/operation_quantization_restriction.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (C) 2018-2022 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include - -#include -#include - -#include -#include -#include -#include - - -namespace ngraph { -namespace pass { -namespace low_precision { - -class OperationQuantizationRestriction { -public: - ngraph::Node::type_info_t operationType; - bool specifyVersion; - std::vector restrictedPorts; - - OperationQuantizationRestriction() = default; - OperationQuantizationRestriction( - const ngraph::Node::type_info_t operationType, - const bool specifyVersion, - const std::vector& restrictedPorts) : - operationType(operationType), - specifyVersion(specifyVersion), - restrictedPorts(restrictedPorts) {} - - template - static OperationQuantizationRestriction create( - const std::vector& restrictedPorts, - const bool specifyVersion = false) { - return OperationQuantizationRestriction(T::get_type_info_static(), specifyVersion, restrictedPorts); - } - - template - static OperationQuantizationRestriction create( - const std::vector& restrictedPorts = {}, - const bool specifyVersion = false) { - std::vector restrictions; - restrictions.reserve(restrictedPorts.size()); - for (auto i = 0ul; i < restrictedPorts.size(); ++i) { - restrictions[i] = PortQuantizationRestriction(restrictedPorts[i], ngraph::QuantizationAttribute::Type::PerTensor); - } - return OperationQuantizationRestriction(T::get_type_info_static(), specifyVersion, restrictions); - } - - template - static std::vector getPrecisionsByOperationType(std::vector& restrictions) { - for (const auto& restriction : restrictions) { - if (restriction.operationType == T::get_type_info_static()) { - return restriction.restrictedPorts; - } - } - return {}; - } -}; - -} // namespace low_precision -} // namespace pass -} // namespace ngraph diff --git a/src/common/low_precision_transformations/include/low_precision/port_quantization_restriction.hpp b/src/common/low_precision_transformations/include/low_precision/common/port_quantization_granularity_restriction.hpp similarity index 57% rename from src/common/low_precision_transformations/include/low_precision/port_quantization_restriction.hpp rename to src/common/low_precision_transformations/include/low_precision/common/port_quantization_granularity_restriction.hpp index 7314d303f52516..19a6c6b35991fc 100644 --- a/src/common/low_precision_transformations/include/low_precision/port_quantization_restriction.hpp +++ b/src/common/low_precision_transformations/include/low_precision/common/port_quantization_granularity_restriction.hpp @@ -9,19 +9,18 @@ #include #include -#include "common/operation_quantization_restriction.hpp" #include "low_precision/lpt_visibility.hpp" -#include "rt_info/quantization_attribute.hpp" +#include "low_precision/rt_info/quantization_granularity_attribute.hpp" namespace ngraph { namespace pass { namespace low_precision { -class PortQuantizationRestriction { +class PortQuantizationGranularityRestriction { public: - PortQuantizationRestriction(const size_t port, QuantizationAttribute::Type type) : port(port), type(type) {} + PortQuantizationGranularityRestriction(const size_t port, QuantizationGranularityAttribute::Type type) : port(port), type(type) {} size_t port; - QuantizationAttribute::Type type; + QuantizationGranularityAttribute::Type type; }; diff --git a/src/common/low_precision_transformations/include/low_precision/common/operation_precision_restriction.hpp b/src/common/low_precision_transformations/include/low_precision/common/precisions_restriction.hpp similarity index 81% rename from src/common/low_precision_transformations/include/low_precision/common/operation_precision_restriction.hpp rename to src/common/low_precision_transformations/include/low_precision/common/precisions_restriction.hpp index 8ea8528d7c01eb..de126736d09c13 100644 --- a/src/common/low_precision_transformations/include/low_precision/common/operation_precision_restriction.hpp +++ b/src/common/low_precision_transformations/include/low_precision/common/precisions_restriction.hpp @@ -19,7 +19,7 @@ namespace ngraph { namespace pass { namespace low_precision { -class OperationPrecisionRestriction { +class PrecisionsRestriction { public: using PrecisionsByPort = std::vector>>; @@ -27,8 +27,8 @@ class OperationPrecisionRestriction { bool specifyVersion; std::vector>> precisionsByPort; - OperationPrecisionRestriction() = default; - OperationPrecisionRestriction( + PrecisionsRestriction() = default; + PrecisionsRestriction( const ngraph::Node::type_info_t operationType, const bool specifyVersion, const PrecisionsByPort& precisionsByPort) : @@ -37,14 +37,14 @@ class OperationPrecisionRestriction { precisionsByPort(precisionsByPort) {} template - static OperationPrecisionRestriction create( + static PrecisionsRestriction create( const PrecisionsByPort& precisionsByPort, const bool specifyVersion = false) { - return OperationPrecisionRestriction(T::get_type_info_static(), specifyVersion, precisionsByPort); + return PrecisionsRestriction(T::get_type_info_static(), specifyVersion, precisionsByPort); } template - static PrecisionsByPort getPrecisionsByOperationType(std::vector& restrictions) { + static PrecisionsByPort getPrecisionsByOperationType(std::vector& restrictions) { for (const auto& restriction : restrictions) { if (restriction.operationType == T::get_type_info_static()) { return restriction.precisionsByPort; diff --git a/src/common/low_precision_transformations/include/low_precision/common/quantization_granularity_restriction.hpp b/src/common/low_precision_transformations/include/low_precision/common/quantization_granularity_restriction.hpp new file mode 100644 index 00000000000000..c4ee03f3fe954e --- /dev/null +++ b/src/common/low_precision_transformations/include/low_precision/common/quantization_granularity_restriction.hpp @@ -0,0 +1,69 @@ +// Copyright (C) 2018-2022 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include +#include + +#include +#include +#include +#include + + +namespace ngraph { +namespace pass { +namespace low_precision { + +class QuantizationGranularityRestriction { +public: + ngraph::Node::type_info_t operationType; + bool specifyVersion; + std::vector restrictedPorts; + + QuantizationGranularityRestriction() = default; + QuantizationGranularityRestriction( + const ngraph::Node::type_info_t operationType, + const bool specifyVersion, + const std::vector& restrictedPorts) : + operationType(operationType), + specifyVersion(specifyVersion), + restrictedPorts(restrictedPorts) {} + + template + static QuantizationGranularityRestriction create( + const std::vector& restrictedPorts, + const bool specifyVersion) { + return QuantizationGranularityRestriction(T::get_type_info_static(), specifyVersion, restrictedPorts); + } + + template + static QuantizationGranularityRestriction create( + const std::vector& restrictedPorts = {}, + const bool specifyVersion = false) { + std::vector restrictions; + restrictions.reserve(restrictedPorts.size()); + for (auto i = 0ul; i < restrictedPorts.size(); ++i) { + restrictions[i] = PortQuantizationGranularityRestriction(restrictedPorts[i], ngraph::QuantizationGranularityAttribute::Type::PerTensor); + } + return QuantizationGranularityRestriction(T::get_type_info_static(), specifyVersion, restrictions); + } + + template + static std::vector getPrecisionsByOperationType(std::vector& restrictions) { + for (const auto& restriction : restrictions) { + if (restriction.operationType == T::get_type_info_static()) { + return restriction.restrictedPorts; + } + } + return {}; + } +}; + +} // namespace low_precision +} // namespace pass +} // namespace ngraph diff --git a/src/common/low_precision_transformations/include/low_precision/low_precision.hpp b/src/common/low_precision_transformations/include/low_precision/low_precision.hpp index 1c9633ec1a9b57..ec50585a1ec3cb 100644 --- a/src/common/low_precision_transformations/include/low_precision/low_precision.hpp +++ b/src/common/low_precision_transformations/include/low_precision/low_precision.hpp @@ -21,7 +21,8 @@ #include #include -#include +#include +#include #include "low_precision/layer_transformation.hpp" #include "low_precision/markup_precisions.hpp" @@ -41,13 +42,13 @@ class ngraph::pass::low_precision::MarkupOptimizations : public ngraph::pass::Fu public: OPENVINO_RTTI("MarkupOptimizations", "0"); MarkupOptimizations( - const std::vector& precisionRestrictions, - const std::vector& quantizationRestrictions, + const std::vector& precisionRestrictions, + const std::vector& quantizationRestrictions, const AttributeParameters& params); bool run_on_model(const std::shared_ptr& m) override; private: - const std::vector& precisionRestrictions; - const std::vector& quantizationRestrictions; + const std::vector& precisionRestrictions; + const std::vector& quantizationRestrictions; const AttributeParameters& params; }; @@ -61,8 +62,8 @@ class ngraph::pass::low_precision::LowPrecision : public ngraph::pass::FunctionP public: OPENVINO_RTTI("LowPrecision", "0"); LowPrecision( - const std::vector& precisionRestrictions = {}, - const std::vector& quantizationRestrictions = {}, + const std::vector& precisionRestrictions = {}, + const std::vector& quantizationRestrictions = {}, const LayerTransformation::Params = LayerTransformation::Params()); bool run_on_model(const std::shared_ptr& m) override; @@ -70,8 +71,8 @@ class ngraph::pass::low_precision::LowPrecision : public ngraph::pass::FunctionP static bool isFQLevelsPresent(const std::shared_ptr& function, const std::set& levels); protected: - std::vector precisionRestrictions; - std::vector quantizationRestrictions; + std::vector precisionRestrictions; + std::vector quantizationRestrictions; // remove LayerTransformation::Params params; }; diff --git a/src/common/low_precision_transformations/include/low_precision/markup_precisions.hpp b/src/common/low_precision_transformations/include/low_precision/markup_precisions.hpp index d08742e18a519d..b0c080b9315383 100644 --- a/src/common/low_precision_transformations/include/low_precision/markup_precisions.hpp +++ b/src/common/low_precision_transformations/include/low_precision/markup_precisions.hpp @@ -10,7 +10,7 @@ #include #include "low_precision/lpt_visibility.hpp" -#include "low_precision/common/operation_precision_restriction.hpp" +#include "low_precision/common/precisions_restriction.hpp" namespace ngraph { namespace pass { @@ -48,7 +48,7 @@ class ngraph::pass::low_precision::MarkupPrecisions : public ngraph::pass::Funct }; OPENVINO_RTTI("MarkupPrecisions", "0"); - explicit MarkupPrecisions(const std::vector& restrictions = {}, + explicit MarkupPrecisions(const std::vector& restrictions = {}, const std::vector& defaultPrecisions = { ngraph::element::u8, ngraph::element::i8 }); bool run_on_model(const std::shared_ptr& m) override; diff --git a/src/common/low_precision_transformations/include/low_precision/markup_per_tensor_quantization.hpp b/src/common/low_precision_transformations/include/low_precision/markup_quantization_granularity.hpp similarity index 72% rename from src/common/low_precision_transformations/include/low_precision/markup_per_tensor_quantization.hpp rename to src/common/low_precision_transformations/include/low_precision/markup_quantization_granularity.hpp index bf8f9829b75bad..38ad7213656a6c 100644 --- a/src/common/low_precision_transformations/include/low_precision/markup_per_tensor_quantization.hpp +++ b/src/common/low_precision_transformations/include/low_precision/markup_quantization_granularity.hpp @@ -9,15 +9,15 @@ #include #include -#include "common/operation_quantization_restriction.hpp" +#include "low_precision/common/port_quantization_granularity_restriction.hpp" +#include "low_precision/common/quantization_granularity_restriction.hpp" #include "low_precision/lpt_visibility.hpp" -#include "low_precision/port_quantization_restriction.hpp" namespace ngraph { namespace pass { namespace low_precision { -class LP_TRANSFORMATIONS_API MarkupPerTensorQuantization; +class LP_TRANSFORMATIONS_API MarkupQuantizationGranularity; } // namespace low_precision } // namespace pass @@ -32,21 +32,21 @@ class LP_TRANSFORMATIONS_API MarkupPerTensorQuantization; * [MarkupPerTensorQuantization](@ref openvino_docs_IE_DG_lpt_MarkupPerTensorQuantization) page * in the Inference Engine Developer Guide. */ -class ngraph::pass::low_precision::MarkupPerTensorQuantization : public ngraph::pass::FunctionPass { +class ngraph::pass::low_precision::MarkupQuantizationGranularity : public ngraph::pass::FunctionPass { public: class PerTensorQuantization { public: explicit PerTensorQuantization(const bool versionIsRequired) : versionIsRequired(versionIsRequired) {} - void add(const uint64_t version, const std::vector& ports) { + void add(const uint64_t version, const std::vector& ports) { portsByVersion.emplace(version, ports); } bool versionIsRequired; - std::unordered_map> portsByVersion; + std::unordered_map> portsByVersion; }; OPENVINO_RTTI("MarkupPerTensorQuantization", "0"); - explicit MarkupPerTensorQuantization(const std::vector& restrictions = {}); + explicit MarkupQuantizationGranularity(const std::vector& restrictions = {}); bool run_on_model(const std::shared_ptr& m) override; private: diff --git a/src/common/low_precision_transformations/include/low_precision/multiply_to_group_convolution.hpp b/src/common/low_precision_transformations/include/low_precision/multiply_to_group_convolution.hpp index a653510d90ed72..ba59d06170165d 100644 --- a/src/common/low_precision_transformations/include/low_precision/multiply_to_group_convolution.hpp +++ b/src/common/low_precision_transformations/include/low_precision/multiply_to_group_convolution.hpp @@ -7,7 +7,7 @@ #include #include #include "low_precision/layer_transformation.hpp" -#include "common/operation_precision_restriction.hpp" +#include "common/precisions_restriction.hpp" namespace ngraph { namespace pass { @@ -26,7 +26,7 @@ class LP_TRANSFORMATIONS_API MultiplyToGroupConvolutionTransformation : public L OPENVINO_RTTI("MultiplyToGroupConvolutionTransformation", "0"); MultiplyToGroupConvolutionTransformation( const Params& params = Params(), - const OperationPrecisionRestriction::PrecisionsByPort& restrictions = {}); + const PrecisionsRestriction::PrecisionsByPort& restrictions = {}); ~MultiplyToGroupConvolutionTransformation() override {} bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; @@ -39,7 +39,7 @@ class LP_TRANSFORMATIONS_API MultiplyToGroupConvolutionTransformation : public L void setGroupSize(const size_t groupSize); size_t getGroupSize() const; private: - OperationPrecisionRestriction::PrecisionsByPort restrictions; + PrecisionsRestriction::PrecisionsByPort restrictions; size_t groupSize; }; 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 e4813b81606957..08cfc518d69d5c 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 @@ -18,7 +18,7 @@ #include "rt_info/shared_value_attribute.hpp" #include "rt_info/precisions_attribute.hpp" -#include "rt_info/quantization_attribute.hpp" +#include "rt_info/quantization_granularity_attribute.hpp" #include "rt_info/intervals_alignment_attribute.hpp" #include "transformation_context.hpp" #include "quantization_details.hpp" diff --git a/src/common/low_precision_transformations/include/low_precision/rt_info/quantization_attribute.hpp b/src/common/low_precision_transformations/include/low_precision/rt_info/quantization_granularity_attribute.hpp similarity index 86% rename from src/common/low_precision_transformations/include/low_precision/rt_info/quantization_attribute.hpp rename to src/common/low_precision_transformations/include/low_precision/rt_info/quantization_granularity_attribute.hpp index 1fce33535e459b..999ae21a671ba6 100644 --- a/src/common/low_precision_transformations/include/low_precision/rt_info/quantization_attribute.hpp +++ b/src/common/low_precision_transformations/include/low_precision/rt_info/quantization_granularity_attribute.hpp @@ -21,12 +21,12 @@ namespace ngraph { * For more details about the attribute, refer to * [QuantizationAttribute](@ref openvino_docs_IE_DG_lpt_Quantization) page in the Inference Engine Developer Guide. */ -class LP_TRANSFORMATIONS_API QuantizationAttribute : public ov::RuntimeAttribute { +class LP_TRANSFORMATIONS_API QuantizationGranularityAttribute : public ov::RuntimeAttribute { public: enum class Type { PerTensor }; OPENVINO_RTTI("LowPrecision::Quantization", "", ov::RuntimeAttribute, 0); - ~QuantizationAttribute(); + ~QuantizationGranularityAttribute(); }; } // namespace ngraph diff --git a/src/common/low_precision_transformations/src/align_quantization_parameters.cpp b/src/common/low_precision_transformations/src/align_quantization_parameters.cpp index 54a866bb302452..3450dc58e11b2a 100644 --- a/src/common/low_precision_transformations/src/align_quantization_parameters.cpp +++ b/src/common/low_precision_transformations/src/align_quantization_parameters.cpp @@ -6,10 +6,10 @@ #include #include "low_precision/create_attribute.hpp" #include "low_precision/propagate_through_precision_preserved.hpp" +#include "low_precision/rt_info/attribute_parameters.hpp" #include "low_precision/rt_info/quantization_alignment_attribute.hpp" -#include "low_precision/rt_info/quantization_attribute.hpp" +#include "low_precision/rt_info/quantization_granularity_attribute.hpp" #include "low_precision/update_shared_precision_preserved.hpp" -#include "low_precision/rt_info/attribute_parameters.hpp" using namespace ngraph; using namespace ngraph::pass::low_precision; @@ -23,7 +23,7 @@ bool ngraph::pass::low_precision::AlignQuantizationParameters::run_on_model(cons std::shared_ptr propagation = manager.register_pass(); propagation->add_matcher>(); propagation->add_matcher>(); - propagation->add_matcher>(); + propagation->add_matcher>(); manager.run_passes(f); return false; } diff --git a/src/common/low_precision_transformations/src/low_precision.cpp b/src/common/low_precision_transformations/src/low_precision.cpp index dc4dcaaf2c520d..c2f491fc24aa17 100644 --- a/src/common/low_precision_transformations/src/low_precision.cpp +++ b/src/common/low_precision_transformations/src/low_precision.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include "low_precision/align_quantization_intervals.hpp" @@ -22,6 +21,7 @@ #include "low_precision/markup_precisions.hpp" #include "low_precision/markup_can_be_quantized.hpp" #include "low_precision/markup_avg_pool_precision_preserved.hpp" +#include #include "low_precision/propagate_precisions.hpp" #include "low_precision/align_quantization_parameters.hpp" @@ -79,8 +79,8 @@ #include "low_precision/multiply_to_group_convolution.hpp" ngraph::pass::low_precision::LowPrecision::LowPrecision( - const std::vector& precisionRestrictions, - const std::vector& quantizationRestrictions, + const std::vector& precisionRestrictions, + const std::vector& quantizationRestrictions, const LayerTransformation::Params params) : precisionRestrictions(precisionRestrictions), quantizationRestrictions(quantizationRestrictions), @@ -155,8 +155,8 @@ ngraph::pass::low_precision::TypeRelaxedReplacer::TypeRelaxedReplacer() { } MarkupOptimizations::MarkupOptimizations( - const std::vector& precisionRestrictions, - const std::vector& quantizationRestrictions, + const std::vector& precisionRestrictions, + const std::vector& quantizationRestrictions, const AttributeParameters& params) : precisionRestrictions(precisionRestrictions), quantizationRestrictions(quantizationRestrictions), @@ -170,7 +170,7 @@ bool ngraph::pass::low_precision::MarkupOptimizations::run_on_model(const std::s markup.register_pass(precisionRestrictions, params.defaultPrecisions); } if (!quantizationRestrictions.empty()) { - markup.register_pass(quantizationRestrictions); + markup.register_pass(quantizationRestrictions); } if (ngraph::op::util::has_op_with_type(f)) { markup.register_pass(params.defaultPrecisions); @@ -244,7 +244,7 @@ bool ngraph::pass::low_precision::LowPrecision::run_on_model(const std::shared_p // WA: precision restrictions for groupConv must be propagated to MultiplyToGroupConvolution transformation cleanup->add_matcher( params, - OperationPrecisionRestriction::getPrecisionsByOperationType(precisionRestrictions)); + PrecisionsRestriction::getPrecisionsByOperationType(precisionRestrictions)); manager.register_pass(params); manager.register_pass(); diff --git a/src/common/low_precision_transformations/src/markup_precisions.cpp b/src/common/low_precision_transformations/src/markup_precisions.cpp index 9643864290f887..85d940f2fe0b52 100644 --- a/src/common/low_precision_transformations/src/markup_precisions.cpp +++ b/src/common/low_precision_transformations/src/markup_precisions.cpp @@ -19,7 +19,8 @@ using namespace ngraph; -ngraph::pass::low_precision::MarkupPrecisions::MarkupPrecisions(const std::vector& restrictions, +ngraph::pass::low_precision::MarkupPrecisions::MarkupPrecisions( + const std::vector& restrictions, const std::vector& defaultPrecisions) : defaultPrecisions(defaultPrecisions) { for (const auto& restriction : restrictions) { const auto it = restrictionsByOperation.find(restriction.operationType.name); diff --git a/src/common/low_precision_transformations/src/markup_per_tensor_quantization.cpp b/src/common/low_precision_transformations/src/markup_quantization_granularity.cpp similarity index 73% rename from src/common/low_precision_transformations/src/markup_per_tensor_quantization.cpp rename to src/common/low_precision_transformations/src/markup_quantization_granularity.cpp index d0f35b29e1eb4e..19f5a25dc1524d 100644 --- a/src/common/low_precision_transformations/src/markup_per_tensor_quantization.cpp +++ b/src/common/low_precision_transformations/src/markup_quantization_granularity.cpp @@ -2,19 +2,19 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "low_precision/markup_per_tensor_quantization.hpp" +#include "low_precision/markup_quantization_granularity.hpp" #include #include #include #include -#include "low_precision/rt_info/quantization_attribute.hpp" +#include "low_precision/rt_info/quantization_granularity_attribute.hpp" using namespace ngraph; -ngraph::pass::low_precision::MarkupPerTensorQuantization::MarkupPerTensorQuantization( - const std::vector& restrictions) { - for (const OperationQuantizationRestriction& restriction : restrictions) { +ngraph::pass::low_precision::MarkupQuantizationGranularity::MarkupQuantizationGranularity( + const std::vector& restrictions) { + for (const auto& restriction : restrictions) { const auto it = restrictionsByOperation.find(restriction.operationType.name); OPENVINO_SUPPRESS_DEPRECATED_START if (it == restrictionsByOperation.end()) { @@ -28,11 +28,11 @@ ngraph::pass::low_precision::MarkupPerTensorQuantization::MarkupPerTensorQuantiz } } -bool ngraph::pass::low_precision::MarkupPerTensorQuantization::run_on_model(const std::shared_ptr& f) { - auto setRestriction = [](const std::shared_ptr& node, const std::vector& restrictedPorts) { +bool ngraph::pass::low_precision::MarkupQuantizationGranularity::run_on_model(const std::shared_ptr& f) { + auto setRestriction = [](const std::shared_ptr& node, const std::vector& restrictedPorts) { auto createAttribute = [](Input& input){ auto &rt = input.get_rt_info(); - rt.emplace(QuantizationAttribute::get_type_info_static(), QuantizationAttribute()); + rt.emplace(QuantizationGranularityAttribute::get_type_info_static(), QuantizationGranularityAttribute()); }; if (restrictedPorts.empty()) { @@ -73,11 +73,11 @@ bool ngraph::pass::low_precision::MarkupPerTensorQuantization::run_on_model(cons continue; } - const std::vector& restrictedPorts = it2->second; + const std::vector& restrictedPorts = it2->second; setRestriction(node, restrictedPorts); } else { assert(restriction.portsByVersion.size() == 1ul); - const std::vector& restrictedPorts = restriction.portsByVersion.begin()->second; + const std::vector& restrictedPorts = restriction.portsByVersion.begin()->second; setRestriction(node, restrictedPorts); } } diff --git a/src/common/low_precision_transformations/src/multiply_to_group_convolution.cpp b/src/common/low_precision_transformations/src/multiply_to_group_convolution.cpp index 7407c68c53a321..c39b165ba3b322 100644 --- a/src/common/low_precision_transformations/src/multiply_to_group_convolution.cpp +++ b/src/common/low_precision_transformations/src/multiply_to_group_convolution.cpp @@ -14,7 +14,7 @@ namespace low_precision { MultiplyToGroupConvolutionTransformation::MultiplyToGroupConvolutionTransformation( const Params& params, - const OperationPrecisionRestriction::PrecisionsByPort& restrictions) : LayerTransformation(params), restrictions(restrictions), groupSize(1ul) { + const PrecisionsRestriction::PrecisionsByPort& restrictions) : LayerTransformation(params), restrictions(restrictions), groupSize(1ul) { auto matcher = pattern::wrap_type(); ngraph::graph_rewrite_callback callback = [this](pattern::Matcher& m) { diff --git a/src/common/low_precision_transformations/src/rt_info/quantization_attribute.cpp b/src/common/low_precision_transformations/src/rt_info/quantization_attribute.cpp deleted file mode 100644 index b609ef917c10ae..00000000000000 --- a/src/common/low_precision_transformations/src/rt_info/quantization_attribute.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (C) 2018-2022 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "low_precision/rt_info/quantization_attribute.hpp" - -using namespace ngraph; -using namespace ov; - -QuantizationAttribute::~QuantizationAttribute() = default; diff --git a/src/common/low_precision_transformations/src/rt_info/quantization_granularity_attribute.cpp b/src/common/low_precision_transformations/src/rt_info/quantization_granularity_attribute.cpp new file mode 100644 index 00000000000000..1f23605f08a68d --- /dev/null +++ b/src/common/low_precision_transformations/src/rt_info/quantization_granularity_attribute.cpp @@ -0,0 +1,10 @@ +// Copyright (C) 2018-2022 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "low_precision/rt_info/quantization_granularity_attribute.hpp" + +using namespace ngraph; +using namespace ov; + +QuantizationGranularityAttribute::~QuantizationGranularityAttribute() = default; diff --git a/src/plugins/intel_cpu/src/plugin.cpp b/src/plugins/intel_cpu/src/plugin.cpp index 8f82236c7cb3a8..225dc88e21170f 100644 --- a/src/plugins/intel_cpu/src/plugin.cpp +++ b/src/plugins/intel_cpu/src/plugin.cpp @@ -96,7 +96,8 @@ #include #include -#include +#include +#include #include #include #include @@ -434,39 +435,39 @@ static void TransformationUpToCPUSpecificOpSet(std::shared_ptr if (useLpt) { OV_ITT_SCOPE(FIRST_INFERENCE, itt::domains::intel_cpu_LT, "LowPrecisionTransformations"); - auto supportedPrecisions = std::vector({ - OperationPrecisionRestriction::create({ + auto supportedPrecisions = std::vector({ + PrecisionsRestriction::create({ {0, {ngraph::element::u8}}, {1, {ngraph::element::i8}}, }), - OperationPrecisionRestriction::create({ + PrecisionsRestriction::create({ {0, {ngraph::element::u8, ngraph::element::i8}}, {1, {ngraph::element::i8}} }), - OperationPrecisionRestriction::create({ + PrecisionsRestriction::create({ {0, {ngraph::element::u8}}, {1, {ngraph::element::i8}} }), - OperationPrecisionRestriction::create({ + PrecisionsRestriction::create({ {0, {ngraph::element::u8}}, {1, {ngraph::element::i8}}, }), - OperationPrecisionRestriction::create({ + PrecisionsRestriction::create({ {0, {ngraph::element::u8, ngraph::element::i8}}, {1, {ngraph::element::i8}} }), }); - auto perTensorQuantization = std::vector({ - OperationQuantizationRestriction::create({0}), - OperationQuantizationRestriction::create({0}) + auto perTensorQuantization = std::vector({ + QuantizationGranularityRestriction::create({0}), + QuantizationGranularityRestriction::create({0}) }); // for GNA networks reference execution bool updatePrecision = true; if (hasINT16orINT32Levels) { updatePrecision = false; - supportedPrecisions = std::vector({}); + supportedPrecisions = std::vector({}); } ngraph::pass::Manager lptManager; diff --git a/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp b/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp index 28237bc33d954a..212998f67e0778 100644 --- a/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp +++ b/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp @@ -345,24 +345,24 @@ void TransformationsPipeline::apply(std::shared_ptr func) { manager.run_passes(func); } - auto supportedPrecisions = std::vector({ - OperationPrecisionRestriction::create({ + auto supportedPrecisions = std::vector({ + PrecisionsRestriction::create({ {0, {ngraph::element::u8, ngraph::element::i8}}, {1, {ngraph::element::i8}}, }), - OperationPrecisionRestriction::create({ + PrecisionsRestriction::create({ {0, {ngraph::element::u8, ngraph::element::i8}}, {1, {ngraph::element::i8}} }), - OperationPrecisionRestriction::create({ + PrecisionsRestriction::create({ {0, {ngraph::element::u8, ngraph::element::i8}}, {1, {ngraph::element::i8}} }) }); - auto perTensorQuantization = std::vector({ - OperationQuantizationRestriction::create({0}), - OperationQuantizationRestriction::create({0}), + auto perTensorQuantization = std::vector({ + QuantizationGranularityRestriction::create({0}), + QuantizationGranularityRestriction::create({0}), }); ngraph::pass::Manager lptManager; diff --git a/src/tests/functional/inference_engine/lp_transformations/align_concat_quantization_parameters_transformation.cpp b/src/tests/functional/inference_engine/lp_transformations/align_concat_quantization_parameters_transformation.cpp index cb0b442754a4f1..14acde6b1fc7a7 100644 --- a/src/tests/functional/inference_engine/lp_transformations/align_concat_quantization_parameters_transformation.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/align_concat_quantization_parameters_transformation.cpp @@ -74,15 +74,15 @@ class AlignConcatQuantizationParametersTransformation : additionalLayer, testValues.actual.dequantization); - auto supportedPrecisions = std::vector({ - ngraph::pass::low_precision::OperationPrecisionRestriction::create({ + auto supportedPrecisions = std::vector({ + ngraph::pass::low_precision::PrecisionsRestriction::create({ {0, {ngraph::element::u8}}, {1, {ngraph::element::i8}} }) }); - auto perTensorQuantization = std::vector({ - ngraph::pass::low_precision::OperationQuantizationRestriction::create({0}), + auto perTensorQuantization = std::vector({ + ngraph::pass::low_precision::QuantizationGranularityRestriction::create({0}), }); SimpleLowPrecisionTransformer transform(supportedPrecisions, perTensorQuantization); diff --git a/src/tests/functional/inference_engine/lp_transformations/concat_selection_with_intermediate_transformation.cpp b/src/tests/functional/inference_engine/lp_transformations/concat_selection_with_intermediate_transformation.cpp index 9781382fdcc774..3cbdf45c520e07 100644 --- a/src/tests/functional/inference_engine/lp_transformations/concat_selection_with_intermediate_transformation.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/concat_selection_with_intermediate_transformation.cpp @@ -85,8 +85,8 @@ class ConcatSelectionWithIntermediateTransformation : public LayerTransformation testValues.actual.fakeQuantize1, testValues.actual.fakeQuantize2); - auto supportedPrecisions = std::vector({ - ngraph::pass::low_precision::OperationPrecisionRestriction::create({ + auto supportedPrecisions = std::vector({ + ngraph::pass::low_precision::PrecisionsRestriction::create({ {0, {ngraph::element::u8}} }) }); diff --git a/src/tests/functional/inference_engine/lp_transformations/concat_transformation.cpp b/src/tests/functional/inference_engine/lp_transformations/concat_transformation.cpp index 1aafcd8a51820b..a0425c947aa1ac 100644 --- a/src/tests/functional/inference_engine/lp_transformations/concat_transformation.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/concat_transformation.cpp @@ -12,9 +12,9 @@ #include #include #include +#include +#include -#include -#include #include #include #include @@ -146,14 +146,14 @@ class ConcatTransformation : public LayerTransformation, public testing::WithPar {}, testValues.axis, testValues.addNotPrecisionPreservedOperation); - auto supportedPrecisionsOnActivation = std::vector({ - ngraph::pass::low_precision::OperationPrecisionRestriction::create({{0, testValues.params.precisionsOnActivations}}) + auto supportedPrecisionsOnActivation = std::vector({ + ngraph::pass::low_precision::PrecisionsRestriction::create({{0, testValues.params.precisionsOnActivations}}) }); auto quantizationRestrictions = testValues.multiChannels ? - std::vector() : - std::vector({ - ngraph::pass::low_precision::OperationQuantizationRestriction::create() + std::vector() : + std::vector({ + ngraph::pass::low_precision::QuantizationGranularityRestriction::create() }); const auto params = TestTransformationParams::toParams(testValues.params); diff --git a/src/tests/functional/inference_engine/lp_transformations/concat_with_different_precision_on_children.cpp b/src/tests/functional/inference_engine/lp_transformations/concat_with_different_precision_on_children.cpp index 1795bcaa09a1e3..26ca81885178a2 100644 --- a/src/tests/functional/inference_engine/lp_transformations/concat_with_different_precision_on_children.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/concat_with_different_precision_on_children.cpp @@ -19,7 +19,7 @@ #include "lpt_ngraph_functions/concat_function.hpp" #include "lpt_ngraph_functions/common/fake_quantize_on_data.hpp" #include "simple_low_precision_transformer.hpp" -#include "low_precision/common/operation_quantization_restriction.hpp" +#include "low_precision/common/quantization_granularity_restriction.hpp" using namespace testing; @@ -92,9 +92,9 @@ class ConcatWithDifferentChildrenTransformation : public LayerTransformation, pu testValues.actual.fakeQuantize2); auto quantizationRestrictions = testValues.multiChannels ? - std::vector() : - std::vector({ - ngraph::pass::low_precision::OperationQuantizationRestriction::create() + std::vector() : + std::vector({ + ngraph::pass::low_precision::QuantizationGranularityRestriction::create() }); SimpleLowPrecisionTransformer transform({}, quantizationRestrictions); diff --git a/src/tests/functional/inference_engine/lp_transformations/concat_with_intermediate_precision_selection_transformation.cpp b/src/tests/functional/inference_engine/lp_transformations/concat_with_intermediate_precision_selection_transformation.cpp index dc631e789279d0..f8fa697bfbcaf5 100644 --- a/src/tests/functional/inference_engine/lp_transformations/concat_with_intermediate_precision_selection_transformation.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/concat_with_intermediate_precision_selection_transformation.cpp @@ -89,14 +89,14 @@ class ConcatWithIntermediatePrecisionSelectionTransformation : public LayerTrans testValues.actual.fakeQuantize1, testValues.actual.fakeQuantize2); - auto supportedPrecisionsOnActivation = std::vector({ - ngraph::pass::low_precision::OperationPrecisionRestriction::create({{0, testValues.params.precisionsOnActivations}}) + auto supportedPrecisionsOnActivation = std::vector({ + ngraph::pass::low_precision::PrecisionsRestriction::create({{0, testValues.params.precisionsOnActivations}}) }); auto quantizationRestrictions = testValues.multiChannels ? - std::vector() : - std::vector({ - ngraph::pass::low_precision::OperationQuantizationRestriction::create() + std::vector() : + std::vector({ + ngraph::pass::low_precision::QuantizationGranularityRestriction::create() }); SimpleLowPrecisionTransformer transform(supportedPrecisionsOnActivation, quantizationRestrictions); diff --git a/src/tests/functional/inference_engine/lp_transformations/concat_with_intermediate_transformation.cpp b/src/tests/functional/inference_engine/lp_transformations/concat_with_intermediate_transformation.cpp index 299235e0ad47f3..040f93a8091d43 100644 --- a/src/tests/functional/inference_engine/lp_transformations/concat_with_intermediate_transformation.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/concat_with_intermediate_transformation.cpp @@ -91,9 +91,9 @@ class ConcatWithIntermediateTransformation : public LayerTransformation, public testValues.actual.fakeQuantize2); auto quantizationRestrictions = testValues.multiChannels ? - std::vector() : - std::vector({ - ngraph::pass::low_precision::OperationQuantizationRestriction::create() + std::vector() : + std::vector({ + ngraph::pass::low_precision::QuantizationGranularityRestriction::create() }); SimpleLowPrecisionTransformer transform({}, quantizationRestrictions); diff --git a/src/tests/functional/inference_engine/lp_transformations/concat_with_intermediate_with_constant_transformation.cpp b/src/tests/functional/inference_engine/lp_transformations/concat_with_intermediate_with_constant_transformation.cpp index 8e641dbaf206c7..9b5f0c8c931f1b 100644 --- a/src/tests/functional/inference_engine/lp_transformations/concat_with_intermediate_with_constant_transformation.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/concat_with_intermediate_with_constant_transformation.cpp @@ -92,9 +92,9 @@ class ConcatWithIntermediateWithConstantTransformation : public LayerTransformat testValues.actual.fakeQuantize2); auto quantizationRestrictions = testValues.multiChannels ? - std::vector() : - std::vector({ - ngraph::pass::low_precision::OperationQuantizationRestriction::create() + std::vector() : + std::vector({ + ngraph::pass::low_precision::QuantizationGranularityRestriction::create() }); SimpleLowPrecisionTransformer transform({}, quantizationRestrictions); diff --git a/src/tests/functional/inference_engine/lp_transformations/concat_with_neighbors_transformation.cpp b/src/tests/functional/inference_engine/lp_transformations/concat_with_neighbors_transformation.cpp index 4b98716e971609..9e1f36edfd7a56 100644 --- a/src/tests/functional/inference_engine/lp_transformations/concat_with_neighbors_transformation.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/concat_with_neighbors_transformation.cpp @@ -102,17 +102,17 @@ class ConcatWithNeighborsTransformation : public LayerTransformation, public tes testValues.neighborType, testValues.additionalLayer); - auto supportedPrecisionsOnActivation = std::vector({ - ngraph::pass::low_precision::OperationPrecisionRestriction::create({ + auto supportedPrecisionsOnActivation = std::vector({ + ngraph::pass::low_precision::PrecisionsRestriction::create({ {0, testValues.params.precisionsOnActivations}, {1, testValues.params.precisionsOnWeights} }) }); auto quantizationRestrictions = testValues.multiChannels ? - std::vector() : - std::vector({ - ngraph::pass::low_precision::OperationQuantizationRestriction::create() + std::vector() : + std::vector({ + ngraph::pass::low_precision::QuantizationGranularityRestriction::create() }); SimpleLowPrecisionTransformer transform(supportedPrecisionsOnActivation, quantizationRestrictions); diff --git a/src/tests/functional/inference_engine/lp_transformations/concat_with_neighbors_transformation_with_convolution.cpp b/src/tests/functional/inference_engine/lp_transformations/concat_with_neighbors_transformation_with_convolution.cpp index b317c05ab0616f..1dde84344bdb32 100644 --- a/src/tests/functional/inference_engine/lp_transformations/concat_with_neighbors_transformation_with_convolution.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/concat_with_neighbors_transformation_with_convolution.cpp @@ -104,17 +104,17 @@ class ConcatWithNeighborsWithConvolutionTransformation : testValues.actual.convert3, testValues.actual.dequantization3); - auto supportedPrecisionsOnActivation = std::vector({ - ngraph::pass::low_precision::OperationPrecisionRestriction::create({ + auto supportedPrecisionsOnActivation = std::vector({ + ngraph::pass::low_precision::PrecisionsRestriction::create({ {0, {ngraph::element::u8}}, {1, {ngraph::element::i8}} }) }); auto quantizationRestrictions = testValues.multiChannels ? - std::vector() : - std::vector({ - ngraph::pass::low_precision::OperationQuantizationRestriction::create({0}) + std::vector() : + std::vector({ + ngraph::pass::low_precision::QuantizationGranularityRestriction::create({0}) }); SimpleLowPrecisionTransformer transform(supportedPrecisionsOnActivation, quantizationRestrictions); diff --git a/src/tests/functional/inference_engine/lp_transformations/concat_with_not_quantized_parent_transformation.cpp b/src/tests/functional/inference_engine/lp_transformations/concat_with_not_quantized_parent_transformation.cpp index 4a5488c42b2e51..c0f1da72cf42f2 100644 --- a/src/tests/functional/inference_engine/lp_transformations/concat_with_not_quantized_parent_transformation.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/concat_with_not_quantized_parent_transformation.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include "common_test_utils/ngraph_test_utils.hpp" #include "lpt_ngraph_functions/concat_function.hpp" @@ -155,16 +155,16 @@ class ConcatWithNotQuantizedParentTransformation : testValues.axis, testValues.addNotPrecisionPreservedOperation); - auto precisionsRestrictions = std::vector({ - ngraph::pass::low_precision::OperationPrecisionRestriction::create({ + auto precisionsRestrictions = std::vector({ + ngraph::pass::low_precision::PrecisionsRestriction::create({ {0, {ngraph::element::u8}}, {1, {ngraph::element::i8}} }), - ngraph::pass::low_precision::OperationPrecisionRestriction::create({{0, testValues.params.precisionsOnActivations}}) + ngraph::pass::low_precision::PrecisionsRestriction::create({{0, testValues.params.precisionsOnActivations}}) }); - auto quantizationRestrictions = std::vector({ - ngraph::pass::low_precision::OperationQuantizationRestriction::create({0}) + auto quantizationRestrictions = std::vector({ + ngraph::pass::low_precision::QuantizationGranularityRestriction::create({0}) }); const auto params = TestTransformationParams(testValues.params.updatePrecisions); @@ -172,7 +172,7 @@ class ConcatWithNotQuantizedParentTransformation : ngraph::pass::Manager manager; manager.register_pass(precisionsRestrictions); - manager.register_pass(quantizationRestrictions); + manager.register_pass(quantizationRestrictions); manager.register_pass(params.defaultPrecisions); manager.register_pass(); manager.register_pass(params.defaultPrecisions); diff --git a/src/tests/functional/inference_engine/lp_transformations/concat_with_split_transformation.cpp b/src/tests/functional/inference_engine/lp_transformations/concat_with_split_transformation.cpp index 5c4b0203671f7a..163b4db1abc8f7 100644 --- a/src/tests/functional/inference_engine/lp_transformations/concat_with_split_transformation.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/concat_with_split_transformation.cpp @@ -20,8 +20,8 @@ #include #include #include -#include -#include "low_precision/common/operation_precision_restriction.hpp" +#include +#include "low_precision/common/precisions_restriction.hpp" #include "common_test_utils/ngraph_test_utils.hpp" #include "lpt_ngraph_functions/concat_function.hpp" @@ -99,17 +99,17 @@ class ConcatWithSplitTransformation : public LayerTransformation, public testing testValues.actual.fakeQuantize2, addConvolution); - auto supportedPrecisions = std::vector({ - ngraph::pass::low_precision::OperationPrecisionRestriction::create({ + auto supportedPrecisions = std::vector({ + ngraph::pass::low_precision::PrecisionsRestriction::create({ {0, testValues.params.precisionsOnActivations}, {1, testValues.params.precisionsOnWeights}, }) }); auto quantizationRestrictions = testValues.multiChannels ? - std::vector() : - std::vector({ - ngraph::pass::low_precision::OperationQuantizationRestriction::create() + std::vector() : + std::vector({ + ngraph::pass::low_precision::QuantizationGranularityRestriction::create() }); SimpleLowPrecisionTransformer transform(supportedPrecisions, quantizationRestrictions); diff --git a/src/tests/functional/inference_engine/lp_transformations/concat_with_strided_slice_transformation.cpp b/src/tests/functional/inference_engine/lp_transformations/concat_with_strided_slice_transformation.cpp index 79485559d2d3a8..938b0ac952985b 100644 --- a/src/tests/functional/inference_engine/lp_transformations/concat_with_strided_slice_transformation.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/concat_with_strided_slice_transformation.cpp @@ -92,17 +92,17 @@ class ConcatWithStridedSliceTransformation : public LayerTransformation, public testValues.ssBeforeConcat, testValues.ssAfterConcat); - auto supportedPrecisions = std::vector({ - ngraph::pass::low_precision::OperationPrecisionRestriction::create({ + auto supportedPrecisions = std::vector({ + ngraph::pass::low_precision::PrecisionsRestriction::create({ {0, testValues.params.precisionsOnActivations}, {1, testValues.params.precisionsOnWeights}, }) }); auto quantizationRestrictions = testValues.multiChannels ? - std::vector() : - std::vector({ - ngraph::pass::low_precision::OperationQuantizationRestriction::create() + std::vector() : + std::vector({ + ngraph::pass::low_precision::QuantizationGranularityRestriction::create() }); SimpleLowPrecisionTransformer transform(supportedPrecisions, quantizationRestrictions); diff --git a/src/tests/functional/inference_engine/lp_transformations/fake_quantize_precision_selection_transformation.cpp b/src/tests/functional/inference_engine/lp_transformations/fake_quantize_precision_selection_transformation.cpp index 07899df7cc6334..3a24ef90332b4c 100644 --- a/src/tests/functional/inference_engine/lp_transformations/fake_quantize_precision_selection_transformation.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/fake_quantize_precision_selection_transformation.cpp @@ -89,8 +89,8 @@ class FakeQuantizePrecisionSelectionTransformation : public LayerTransformation, testValues.actual.fakeQuantizeOnWeights }); - auto supportedPrecisions = std::vector({ - ngraph::pass::low_precision::OperationPrecisionRestriction::create({ + auto supportedPrecisions = std::vector({ + ngraph::pass::low_precision::PrecisionsRestriction::create({ {0, testValues.precisionsOnActivationForLimitedOperation}, {1, { element::i8 }} }) diff --git a/src/tests/functional/inference_engine/lp_transformations/fake_quantize_transformation.cpp b/src/tests/functional/inference_engine/lp_transformations/fake_quantize_transformation.cpp index adbae5fac71f8f..5354755205bc2b 100644 --- a/src/tests/functional/inference_engine/lp_transformations/fake_quantize_transformation.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/fake_quantize_transformation.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include #include "common_test_utils/ngraph_test_utils.hpp" @@ -88,8 +88,8 @@ class FakeQuantizeTransformation : public LayerTransformation, public testing::W fakeQuantizeOnData.actual, fakeQuantizeOnData.addNotPrecisionPreservedOperation); - auto supportedPrecisions = std::vector({ - ngraph::pass::low_precision::OperationPrecisionRestriction::create({{0, params.precisionsOnActivations}}) + auto supportedPrecisions = std::vector({ + ngraph::pass::low_precision::PrecisionsRestriction::create({{0, params.precisionsOnActivations}}) }); SimpleLowPrecisionTransformer transform(supportedPrecisions, {}, { ngraph::element::f32, defaultPrecisions }); diff --git a/src/tests/functional/inference_engine/lp_transformations/fake_quantize_with_dq_not_optimal_transformation.cpp b/src/tests/functional/inference_engine/lp_transformations/fake_quantize_with_dq_not_optimal_transformation.cpp index cb84020c94a02c..b71af3ca531c04 100644 --- a/src/tests/functional/inference_engine/lp_transformations/fake_quantize_with_dq_not_optimal_transformation.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/fake_quantize_with_dq_not_optimal_transformation.cpp @@ -80,15 +80,15 @@ class FakeQuantizeWithNotOptimalTransformation : testValues.actual.dequantizationOnWeights, testValues.actual.dequantizationAfter); - auto precisionsRestrictions = std::vector({ - ngraph::pass::low_precision::OperationPrecisionRestriction::create({ + auto precisionsRestrictions = std::vector({ + ngraph::pass::low_precision::PrecisionsRestriction::create({ {0, {ngraph::element::u8}}, {1, {ngraph::element::i8}} }) }); - auto quantizationRestrictions = std::vector({ - ngraph::pass::low_precision::OperationQuantizationRestriction::create() + auto quantizationRestrictions = std::vector({ + ngraph::pass::low_precision::QuantizationGranularityRestriction::create() }); SimpleLowPrecisionTransformer transformer(precisionsRestrictions, quantizationRestrictions); diff --git a/src/tests/functional/inference_engine/lp_transformations/markup_avg_pool_precisions_transformation.cpp b/src/tests/functional/inference_engine/lp_transformations/markup_avg_pool_precisions_transformation.cpp index 4629adf48c5f98..8e4e8336cfe48b 100644 --- a/src/tests/functional/inference_engine/lp_transformations/markup_avg_pool_precisions_transformation.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/markup_avg_pool_precisions_transformation.cpp @@ -85,8 +85,8 @@ class MarkupAvgPoolPrecisionsTransformation : public LayerTransformation, public ngraph::pass::low_precision::TypeRelaxedReplacer pass; pass.run_on_function(actualFunction); - auto supportedPrecisionsOnActivation = std::vector({ - ngraph::pass::low_precision::OperationPrecisionRestriction::create({ + auto supportedPrecisionsOnActivation = std::vector({ + ngraph::pass::low_precision::PrecisionsRestriction::create({ {0, {ngraph::element::u8}}, {1, {ngraph::element::i8}} }) diff --git a/src/tests/functional/inference_engine/lp_transformations/move_fake_quantize_transformation.cpp b/src/tests/functional/inference_engine/lp_transformations/move_fake_quantize_transformation.cpp index 9fe13007cfb381..4f340adfbe2b4d 100644 --- a/src/tests/functional/inference_engine/lp_transformations/move_fake_quantize_transformation.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/move_fake_quantize_transformation.cpp @@ -154,14 +154,14 @@ class MoveFakeQuantizeTransformation : public LayerTransformation, public testin testValues.axis, oneInputWithSplit); - auto supportedPrecisionsOnActivation = std::vector({ - ngraph::pass::low_precision::OperationPrecisionRestriction::create({{0, testValues.params.precisionsOnActivations}}) + auto supportedPrecisionsOnActivation = std::vector({ + ngraph::pass::low_precision::PrecisionsRestriction::create({{0, testValues.params.precisionsOnActivations}}) }); auto quantizationRestrictions = testValues.multiChannels ? - std::vector() : - std::vector({ - ngraph::pass::low_precision::OperationQuantizationRestriction::create() + std::vector() : + std::vector({ + ngraph::pass::low_precision::QuantizationGranularityRestriction::create() }); const auto params = TestTransformationParams::toParams(testValues.params); diff --git a/src/tests/functional/inference_engine/lp_transformations/multiply_to_group_convolution_transformation.cpp b/src/tests/functional/inference_engine/lp_transformations/multiply_to_group_convolution_transformation.cpp index 25731967876b54..e7e64d7016c675 100644 --- a/src/tests/functional/inference_engine/lp_transformations/multiply_to_group_convolution_transformation.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/multiply_to_group_convolution_transformation.cpp @@ -61,8 +61,8 @@ class MultiplyToGroupConvolutionTransformation : testValues.actual.dequantization, testValues.haveMultiplyWithNoConstBeforeDequantization); - auto precisionRestrictions = std::vector({ - ngraph::pass::low_precision::OperationPrecisionRestriction::create({ + auto precisionRestrictions = std::vector({ + ngraph::pass::low_precision::PrecisionsRestriction::create({ {0, {ngraph::element::u8}}, {1, {ngraph::element::i8}} }) diff --git a/src/tests/functional/inference_engine/lp_transformations/operation_quantization_restriction_test.cpp b/src/tests/functional/inference_engine/lp_transformations/quantization_granularity_restriction_test.cpp similarity index 89% rename from src/tests/functional/inference_engine/lp_transformations/operation_quantization_restriction_test.cpp rename to src/tests/functional/inference_engine/lp_transformations/quantization_granularity_restriction_test.cpp index b598b44c373412..f07a453c256af0 100644 --- a/src/tests/functional/inference_engine/lp_transformations/operation_quantization_restriction_test.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/quantization_granularity_restriction_test.cpp @@ -10,7 +10,7 @@ #include -#include +#include #include #include "common_test_utils/ngraph_test_utils.hpp" @@ -22,8 +22,8 @@ using namespace ngraph::pass; class OperationQuantizationRestrictionTestValues { public: - low_precision::OperationPrecisionRestriction::PrecisionsByPort inputPrecisionsByPort; - low_precision::OperationPrecisionRestriction::PrecisionsByPort outputPrecisionsByPort; + low_precision::PrecisionsRestriction::PrecisionsByPort inputPrecisionsByPort; + low_precision::PrecisionsRestriction::PrecisionsByPort outputPrecisionsByPort; }; typedef std::tuple< @@ -42,8 +42,8 @@ class OperationQuantizationRestrictionTest : public LayerTransformation, public { 255ul, Shape({ 1, 1, 1, 1 }), { 0.f }, { 254.f }, { -1.27f }, { 1.27f } }); //ngraph::pass::Manager manager; - //auto supportedPrecisions = std::vector({ - // low_precision::OperationQuantizationRestriction::create( + //auto supportedPrecisions = std::vector({ + // low_precision::QuantizationGranularityRestriction::create( // testValues.inputPrecisionsByPort, // testValues.outputPrecisionsByPort) }); //manager.register_pass(supportedPrecisions); diff --git a/src/tests/functional/inference_engine/lp_transformations/simple_low_precision_transformer.cpp b/src/tests/functional/inference_engine/lp_transformations/simple_low_precision_transformer.cpp index 4d74b0e03e34e7..35aa7b1e0a14f2 100644 --- a/src/tests/functional/inference_engine/lp_transformations/simple_low_precision_transformer.cpp +++ b/src/tests/functional/inference_engine/lp_transformations/simple_low_precision_transformer.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include using namespace testing; @@ -21,8 +21,8 @@ using namespace ngraph::pass; OPENVINO_SUPPRESS_DEPRECATED_START SimpleLowPrecisionTransformer::SimpleLowPrecisionTransformer( - const std::vector& precisionRestrictions, - const std::vector& quantizationRestrictions, + const std::vector& precisionRestrictions, + const std::vector& quantizationRestrictions, const AttributeParameters& params) { auto passConfig = get_pass_config(); @@ -30,7 +30,7 @@ SimpleLowPrecisionTransformer::SimpleLowPrecisionTransformer( markup = std::make_shared(passConfig); markup->register_pass(params.defaultPrecisions); markup->register_pass(precisionRestrictions, params.defaultPrecisions); - markup->register_pass(quantizationRestrictions); + markup->register_pass(quantizationRestrictions); markup->register_pass(params.defaultPrecisions); markup->register_pass(params); markup->register_pass(params.defaultPrecisions); diff --git a/src/tests/functional/inference_engine/lp_transformations/simple_low_precision_transformer.hpp b/src/tests/functional/inference_engine/lp_transformations/simple_low_precision_transformer.hpp index 604af1f9347dce..d4b331aa24e416 100644 --- a/src/tests/functional/inference_engine/lp_transformations/simple_low_precision_transformer.hpp +++ b/src/tests/functional/inference_engine/lp_transformations/simple_low_precision_transformer.hpp @@ -11,14 +11,14 @@ #include "layer_transformation.hpp" #include "common_test_utils/test_common.hpp" #include "low_precision/layer_transformation.hpp" -#include "low_precision/common/operation_precision_restriction.hpp" -#include "low_precision/common/operation_quantization_restriction.hpp" +#include "low_precision/common/precisions_restriction.hpp" +#include "low_precision/common/quantization_granularity_restriction.hpp" class SimpleLowPrecisionTransformer : public ngraph::pass::FunctionPass{ public: SimpleLowPrecisionTransformer( - const std::vector& precisionRestrictions = {}, - const std::vector& quantizationRestrictions = {}, + const std::vector& precisionRestrictions = {}, + const std::vector& quantizationRestrictions = {}, const AttributeParameters& params = AttributeParameters()); template