Transformations: API 2.0 transition part 3 for LPT transformations (#19610)

* lpt transformations: transition to api 2.0, ngraph -> openvino

* use ov namespace for lpt transformations

* fix low_precision usings

* includes refactoring

* delete RecurrentGraphRewrite and RecurrentMatcher as unused classes

* use ov header for itt; delete the disabled test

* delete the unused function

* suppress doxygen warning

* fix link in the documentation
This commit is contained in:
Ivan Tikhonov
2023-09-13 16:30:31 +04:00
committed by GitHub
parent 3454139931
commit d0213301a5
547 changed files with 2797 additions and 3176 deletions

View File

@@ -105,7 +105,7 @@ Model display features (here and below):
The transformation is required and includes two tasks:
1. Mark operation input ports (create ``Precision`` attribute instance) by provided restrictions: input port index and required precisions. Restrictions are provided as input argument in ``:ref:`ngraph::pass::low_precision::LowPrecision <doxid-classngraph_1_1pass_1_1low__precision_1_1_low_precision>``` constructor.
1. Mark operation input ports (create ``Precision`` attribute instance) by provided restrictions: input port index and required precisions. Restrictions are provided as input argument in ``:ref:`ov::pass::low_precision::LowPrecision <doxid-classov_1_1pass_1_1low__precision_1_1_low_precision>``` constructor.
2. Mark precision preserved operations.
No attributes are required before the transformation. Changes in the example model after ``MarkupPrecisions`` transformation:

View File

@@ -1,3 +1,3 @@
# ConvertSubtractConstant transformation {#openvino_docs_OV_UG_lpt_ConvertSubtractConstant}
ngraph::pass::low_precision::ConvertSubtractConstant class represents the `ConvertSubtractConstant` transformation.
ov::pass::low_precision::ConvertSubtractConstant class represents the `ConvertSubtractConstant` transformation.

View File

@@ -1,3 +1,3 @@
# PullReshapeThroughDequantization transformation {#openvino_docs_OV_UG_lpt_PullReshapeThroughDequantization}
ngraph::pass::low_precision::PullReshapeThroughDequantization class represents the `PullReshapeThroughDequantization` transformation.
ov::pass::low_precision::PullReshapeThroughDequantization class represents the `PullReshapeThroughDequantization` transformation.

View File

@@ -1,3 +1,3 @@
# PullTransposeThroughDequantization transformation {#openvino_docs_OV_UG_lpt_PullTransposeThroughDequantization}
ngraph::pass::low_precision::PullTransposeThroughDequantization class represents the `PullTransposeThroughDequantization` transformation.
ov::pass::low_precision::PullTransposeThroughDequantization class represents the `PullTransposeThroughDequantization` transformation.

View File

@@ -1,3 +1,3 @@
# AlignQuantizationIntervals transformation {#openvino_docs_OV_UG_lpt_AlignQuantizationIntervals}
ngraph::pass::low_precision::AlignQuantizationIntervals class represents the `AlignQuantizationIntervals` transformation.
ov::pass::low_precision::AlignQuantizationIntervals class represents the `AlignQuantizationIntervals` transformation.

View File

@@ -1,3 +1,3 @@
# AlignQuantizationParameters transformation {#openvino_docs_OV_UG_lpt_AlignQuantizationParameters}
ngraph::pass::low_precision::AlignQuantizationParameters class represents the `AlignQuantizationParameters` transformation.
ov::pass::low_precision::AlignQuantizationParameters class represents the `AlignQuantizationParameters` transformation.

View File

@@ -1,3 +1,3 @@
# CreateAttribute transformation {#openvino_docs_OV_UG_lpt_CreateAttribute}
ngraph::pass::low_precision::CreateAttribute class represents the `CreateAttribute` transformation.
ov::pass::low_precision::CreateAttribute class represents the `CreateAttribute` transformation.

View File

@@ -1,3 +1,3 @@
# CreatePrecisionsDependentAttribute transformation {#openvino_docs_OV_UG_lpt_CreatePrecisionsDependentAttribute}
ngraph::pass::low_precision::CreatePrecisionsDependentAttribute class represents the `CreatePrecisionsDependentAttribute` transformation.
ov::pass::low_precision::CreatePrecisionsDependentAttribute class represents the `CreatePrecisionsDependentAttribute` transformation.

View File

@@ -1,3 +1,3 @@
# MarkupAvgPoolPrecisionPreserved transformation {#openvino_docs_OV_UG_lpt_MarkupAvgPoolPrecisionPreserved}
ngraph::pass::low_precision::MarkupAvgPoolPrecisionPreserved class represents the `MarkupAvgPoolPrecisionPreserved` transformation.
ov::pass::low_precision::MarkupAvgPoolPrecisionPreserved class represents the `MarkupAvgPoolPrecisionPreserved` transformation.

View File

@@ -1,3 +1,3 @@
# MarkupBias transformation {#openvino_docs_OV_UG_lpt_MarkupBias}
ngraph::pass::low_precision::MarkupBias class represents the `MarkupBias` transformation.
ov::pass::low_precision::MarkupBias class represents the `MarkupBias` transformation.

View File

@@ -1,3 +1,3 @@
# MarkupCanBeQuantized transformation {#openvino_docs_OV_UG_lpt_MarkupCanBeQuantized}
ngraph::pass::low_precision::MarkupCanBeQuantized class represents the `MarkupCanBeQuantized` transformation.
ov::pass::low_precision::MarkupCanBeQuantized class represents the `MarkupCanBeQuantized` transformation.

View File

@@ -1,3 +1,3 @@
# MarkupPerTensorQuantization transformation {#openvino_docs_OV_UG_lpt_MarkupPerTensorQuantization}
ngraph::pass::low_precision::MarkupPerTensorQuantization class represents the `MarkupPerTensorQuantization` transformation.
ov::pass::low_precision::MarkupPerTensorQuantization class represents the `MarkupPerTensorQuantization` transformation.

View File

@@ -1,3 +1,3 @@
# MarkupPrecisions transformation {#openvino_docs_OV_UG_lpt_MarkupPrecisions}
ngraph::pass::low_precision::MarkupPrecisions class represents the `MarkupPrecisions` transformation.
ov::pass::low_precision::MarkupPrecisions class represents the `MarkupPrecisions` transformation.

View File

@@ -1,3 +1,3 @@
# PropagatePrecisions transformation {#openvino_docs_OV_UG_lpt_PropagatePrecisions}
ngraph::pass::low_precision::PropagatePrecisions class represents the `PropagatePrecisions` transformation.
ov::pass::low_precision::PropagatePrecisions class represents the `PropagatePrecisions` transformation.

View File

@@ -1,3 +1,3 @@
# PropagateSharedValue transformation {#openvino_docs_OV_UG_lpt_PropagateSharedValue}
ngraph::pass::low_precision::PropagateSharedValue class represents the `PropagateSharedValue` transformation.
ov::pass::low_precision::PropagateSharedValue class represents the `PropagateSharedValue` transformation.

View File

@@ -1,3 +1,3 @@
# PropagateThroughPrecisionPreserved transformation {#openvino_docs_OV_UG_lpt_PropagateThroughPrecisionPreserved}
ngraph::pass::low_precision::PropagateThroughPrecisionPreserved class represents the `PropagateThroughPrecisionPreserved` transformation.
ov::pass::low_precision::PropagateThroughPrecisionPreserved class represents the `PropagateThroughPrecisionPreserved` transformation.

View File

@@ -1,3 +1,3 @@
# PropagateToInput transformation {#openvino_docs_OV_UG_lpt_PropagateToInput}
ngraph::pass::low_precision::PropagateToInput class represents the `PropagateToInput` transformation.
ov::pass::low_precision::PropagateToInput class represents the `PropagateToInput` transformation.

View File

@@ -1,3 +1,3 @@
# UpdateSharedPrecisionPreserved transformation {#openvino_docs_OV_UG_lpt_UpdateSharedPrecisionPreserved}
ngraph::pass::low_precision::UpdateSharedPrecisionPreserved class represents the `UpdateSharedPrecisionPreserved` transformation.
ov::pass::low_precision::UpdateSharedPrecisionPreserved class represents the `UpdateSharedPrecisionPreserved` transformation.

View File

@@ -1,3 +1,3 @@
# ClampTransformation transformation {#openvino_docs_OV_UG_lpt_ClampTransformation}
ngraph::pass::low_precision::ClampTransformation class represents the `Clamp` operation transformation.
ov::pass::low_precision::ClampTransformation class represents the `Clamp` operation transformation.

View File

@@ -1,3 +1,3 @@
# PReluTransformation transformation {#openvino_docs_OV_UG_lpt_PReluTransformation}
ngraph::pass::low_precision::PReluTransformation class represents the `PRelu` operation transformation.
ov::pass::low_precision::PReluTransformation class represents the `PRelu` operation transformation.

View File

@@ -1,3 +1,3 @@
# ReluTransformation transformation {#openvino_docs_OV_UG_lpt_ReluTransformation}
ngraph::pass::low_precision::ReluTransformation class represents the `Relu` operation transformation.
ov::pass::low_precision::ReluTransformation class represents the `Relu` operation transformation.

View File

@@ -1,6 +1,6 @@
# AddTransformation transformation {#openvino_docs_OV_UG_lpt_AddTransformation}
ngraph::pass::low_precision::AddTransformation class represents the `Add` operation transformation.
ov::pass::low_precision::AddTransformation class represents the `Add` operation transformation.
The transformation propagates dequantization subtraction from one input branch to another and propagates dequantization multiplication from the same branch through `Add` operation. In transformation result, one `Add` operation input branch is in low precision without dequantization operations (empty branch), another input branch is in original precision with updated dequantization operations (full branch).

View File

@@ -1,3 +1,3 @@
# MultiplyTransformation transformation {#openvino_docs_OV_UG_lpt_MultiplyTransformation}
ngraph::pass::low_precision::MultiplyTransformation class represents the `Multiply` operation transformation.
ov::pass::low_precision::MultiplyTransformation class represents the `Multiply` operation transformation.

View File

@@ -1,3 +1,3 @@
# SubtractTransformation transformation {#openvino_docs_OV_UG_lpt_SubtractTransformation}
ngraph::pass::low_precision::SubtractTransformation class represents the `Subtract` operation transformation.
ov::pass::low_precision::SubtractTransformation class represents the `Subtract` operation transformation.

View File

@@ -1,6 +1,6 @@
# ConvolutionTransformation transformation {#openvino_docs_OV_UG_lpt_ConvolutionTransformation}
ngraph::pass::low_precision::ConvolutionTransformation class represents the `Convolution` operation transformation.
ov::pass::low_precision::ConvolutionTransformation class represents the `Convolution` operation transformation.
The transformation propagates dequantization operations on activations and weights through the `Convolution` operation. The transformation supports several weights quantization approaches:
* quantized weights in low precision with dequantization operations,

View File

@@ -1,3 +1,3 @@
# ConvolutionBackpropDataTransformation transformation {#openvino_docs_OV_UG_lpt_ConvolutionBackpropDataTransformation}
ngraph::pass::low_precision::ConvolutionBackpropDataTransformation class represents the `ConvolutionBackpropData` operation transformation.
ov::pass::low_precision::ConvolutionBackpropDataTransformation class represents the `ConvolutionBackpropData` operation transformation.

View File

@@ -1,3 +1,3 @@
# GroupConvolutionTransformation transformation {#openvino_docs_OV_UG_lpt_GroupConvolutionTransformation}
ngraph::pass::low_precision::GroupConvolutionTransformation class represents the `GroupConvolution` operation transformation.
ov::pass::low_precision::GroupConvolutionTransformation class represents the `GroupConvolution` operation transformation.

View File

@@ -1,3 +1,3 @@
# InterpolateTransformation transformation {#openvino_docs_OV_UG_lpt_InterpolateTransformation}
ngraph::pass::low_precision::InterpolateTransformation class represents the `Interpolate` operation transformation.
ov::pass::low_precision::InterpolateTransformation class represents the `Interpolate` operation transformation.

View File

@@ -1,3 +1,3 @@
# MatMulTransformation transformation {#openvino_docs_OV_UG_lpt_MatMulTransformation}
ngraph::pass::low_precision::MatMulTransformation class represents the `MatMul` operation transformation.
ov::pass::low_precision::MatMulTransformation class represents the `MatMul` operation transformation.

View File

@@ -1,3 +1,3 @@
# ConcatTransformation transformation {#openvino_docs_OV_UG_lpt_ConcatTransformation}
ngraph::pass::low_precision::ConcatTransformation class represents the `Concat` operation transformation.
ov::pass::low_precision::ConcatTransformation class represents the `Concat` operation transformation.

View File

@@ -1,3 +1,3 @@
# DepthToSpaceTransformation transformation {#openvino_docs_OV_UG_lpt_DepthToSpaceTransformation}
ngraph::pass::low_precision::DepthToSpaceTransformation class represents the `DepthToSpace` operation transformation.
ov::pass::low_precision::DepthToSpaceTransformation class represents the `DepthToSpace` operation transformation.

View File

@@ -1,3 +1,3 @@
# GatherTransformation transformation {#openvino_docs_OV_UG_lpt_GatherTransformation}
ngraph::pass::low_precision::GatherTransformation class represents the `Gather` operation transformation.
ov::pass::low_precision::GatherTransformation class represents the `Gather` operation transformation.

View File

@@ -1,3 +1,3 @@
# PadTransformation transformation {#openvino_docs_OV_UG_lpt_PadTransformation}
ngraph::pass::low_precision::PadTransformation class represents the `Pad` operation transformation.
ov::pass::low_precision::PadTransformation class represents the `Pad` operation transformation.

View File

@@ -1,3 +1,3 @@
# ShuffleChannelsTransformation transformation {#openvino_docs_OV_UG_lpt_ShuffleChannelsTransformation}
ngraph::pass::low_precision::ShuffleChannelsTransformation class represents the `ShuffleChannels` operation transformation.
ov::pass::low_precision::ShuffleChannelsTransformation class represents the `ShuffleChannels` operation transformation.

View File

@@ -1,3 +1,3 @@
# SplitTransformation transformation {#openvino_docs_OV_UG_lpt_SplitTransformation}
ngraph::pass::low_precision::SplitTransformation class represents the `Split` operation transformation.
ov::pass::low_precision::SplitTransformation class represents the `Split` operation transformation.

View File

@@ -1,3 +1,3 @@
# StridedSliceTransformation transformation {#openvino_docs_OV_UG_lpt_StridedSliceTransformation}
ngraph::pass::low_precision::StridedSliceTransformation class represents the `StridedSlice` operation transformation.
ov::pass::low_precision::StridedSliceTransformation class represents the `StridedSlice` operation transformation.

View File

@@ -1,3 +1,3 @@
# TransposeTransformation transformation {#openvino_docs_OV_UG_lpt_TransposeTransformation}
ngraph::pass::low_precision::TransposeTransformation class represents the `Transpose` operation transformation.
ov::pass::low_precision::TransposeTransformation class represents the `Transpose` operation transformation.

View File

@@ -1,3 +1,3 @@
# VariadicSplitTransformation transformation {#openvino_docs_OV_UG_lpt_VariadicSplitTransformation}
ngraph::pass::low_precision::VariadicSplitTransformation class represents the `VariadicSplit` operation transformation.
ov::pass::low_precision::VariadicSplitTransformation class represents the `VariadicSplit` operation transformation.

View File

@@ -1,3 +1,3 @@
# MVNTransformation transformation {#openvino_docs_OV_UG_lpt_MVNTransformation}
ngraph::pass::low_precision::MVNTransformation class represents the `MVN` operation transformation.
ov::pass::low_precision::MVNTransformation class represents the `MVN` operation transformation.

View File

@@ -1,3 +1,3 @@
# NormalizeL2Transformation transformation {#openvino_docs_OV_UG_lpt_NormalizeL2Transformation}
ngraph::pass::low_precision::NormalizeL2Transformation class represents the `NormalizeL2` operation transformation.
ov::pass::low_precision::NormalizeL2Transformation class represents the `NormalizeL2` operation transformation.

View File

@@ -1,3 +1,3 @@
# AvgPoolTransformation transformation {#openvino_docs_OV_UG_lpt_AvgPoolTransformation}
ngraph::pass::low_precision::AvgPoolTransformation class represents the `AvgPool` operation transformation.
ov::pass::low_precision::AvgPoolTransformation class represents the `AvgPool` operation transformation.

View File

@@ -1,3 +1,3 @@
# MaxPoolTransformation transformation {#openvino_docs_OV_UG_lpt_MaxPoolTransformation}
ngraph::pass::low_precision::MaxPoolTransformation class represents the `MaxPool` operation transformation.
ov::pass::low_precision::MaxPoolTransformation class represents the `MaxPool` operation transformation.

View File

@@ -1,3 +1,3 @@
# FakeQuantizeTransformation transformation {#openvino_docs_OV_UG_lpt_FakeQuantizeTransformation}
ngraph::pass::low_precision::FakeQuantizeTransformation class represents the `FakeQuantize` operation transformation.
ov::pass::low_precision::FakeQuantizeTransformation class represents the `FakeQuantize` operation transformation.

View File

@@ -1,3 +1,3 @@
# FoldFakeQuantizeTransformation transformation {#openvino_docs_OV_UG_lpt_FoldFakeQuantizeTransformation}
ngraph::pass::low_precision::FoldFakeQuantizeTransformation class represents the `FoldFakeQuantize` operation transformation.
ov::pass::low_precision::FoldFakeQuantizeTransformation class represents the `FoldFakeQuantize` operation transformation.

View File

@@ -1,3 +1,3 @@
# ReduceMaxTransformation transformation {#openvino_docs_OV_UG_lpt_ReduceMaxTransformation}
ngraph::pass::low_precision::ReduceMaxTransformation class represents the `ReduceMax` operation transformation.
ov::pass::low_precision::ReduceMaxTransformation class represents the `ReduceMax` operation transformation.

View File

@@ -1,3 +1,3 @@
# ReduceMeanTransformation transformation {#openvino_docs_OV_UG_lpt_ReduceMeanTransformation}
ngraph::pass::low_precision::ReduceMeanTransformation class represents the `ReduceMean` operation transformation.
ov::pass::low_precision::ReduceMeanTransformation class represents the `ReduceMean` operation transformation.

View File

@@ -1,3 +1,3 @@
# ReduceMinTransformation transformation {#openvino_docs_OV_UG_lpt_ReduceMinTransformation}
ngraph::pass::low_precision::ReduceMinTransformation class represents the `ReduceMin` operation transformation.
ov::pass::low_precision::ReduceMinTransformation class represents the `ReduceMin` operation transformation.

View File

@@ -1,3 +1,3 @@
# ReduceSumTransformation transformation {#openvino_docs_OV_UG_lpt_ReduceSumTransformation}
ngraph::pass::low_precision::ReduceSumTransformation class represents the `ReduceSum` operation transformation.
ov::pass::low_precision::ReduceSumTransformation class represents the `ReduceSum` operation transformation.

View File

@@ -1,3 +1,3 @@
# ReshapeTransformation transformation {#openvino_docs_OV_UG_lpt_ReshapeTransformation}
ngraph::pass::low_precision::ReshapeTransformation class represents the `Reshape` operation transformation.
ov::pass::low_precision::ReshapeTransformation class represents the `Reshape` operation transformation.

View File

@@ -1,3 +1,3 @@
# SqueezeTransformation transformation {#openvino_docs_OV_UG_lpt_SqueezeTransformation}
ngraph::pass::low_precision::SqueezeTransformation class represents the `Squeeze` operation transformation.
ov::pass::low_precision::SqueezeTransformation class represents the `Squeeze` operation transformation.

View File

@@ -1,3 +1,3 @@
# UnsqueezeTransformation transformation {#openvino_docs_OV_UG_lpt_UnsqueezeTransformation}
ngraph::pass::low_precision::UnsqueezeTransformation class represents the `Unsqueeze` operation transformation.
ov::pass::low_precision::UnsqueezeTransformation class represents the `Unsqueeze` operation transformation.

View File

@@ -1,3 +1,3 @@
# EliminateFakeQuantizeTransformation transformation {#openvino_docs_OV_UG_lpt_EliminateFakeQuantizeTransformation}
ngraph::pass::low_precision::EliminateFakeQuantizeTransformation class represents the `EliminateFakeQuantizeTransformation` transformation.
ov::pass::low_precision::EliminateFakeQuantizeTransformation class represents the `EliminateFakeQuantizeTransformation` transformation.

View File

@@ -1,3 +1,3 @@
# FakeQuantizeDecompositionTransformation transformation {#openvino_docs_OV_UG_lpt_FakeQuantizeDecompositionTransformation}
ngraph::pass::low_precision::FakeQuantizeDecompositionTransformation class represents the `FakeQuantizeDecompositionTransformation` transformation.
ov::pass::low_precision::FakeQuantizeDecompositionTransformation class represents the `FakeQuantizeDecompositionTransformation` transformation.

View File

@@ -1,3 +1,3 @@
# FoldConvertTransformation transformation {#openvino_docs_OV_UG_lpt_FoldConvertTransformation}
ngraph::pass::low_precision::FoldConvertTransformation class represents the `FoldConvertTransformation` transformation.
ov::pass::low_precision::FoldConvertTransformation class represents the `FoldConvertTransformation` transformation.

View File

@@ -1,3 +1,3 @@
# FuseConvertTransformation transformation {#openvino_docs_OV_UG_lpt_FuseConvertTransformation}
ngraph::pass::low_precision::FuseConvertTransformation class represents the `FuseConvertTransformation` transformation.
ov::pass::low_precision::FuseConvertTransformation class represents the `FuseConvertTransformation` transformation.

View File

@@ -1,3 +1,3 @@
# FuseMultiplyToFakeQuantizeTransformation transformation {#openvino_docs_OV_UG_lpt_FuseMultiplyToFakeQuantizeTransformation}
ngraph::pass::low_precision::FuseMultiplyToFakeQuantizeTransformation class represents the `FuseMultiplyToFakeQuantizeTransformation` transformation.
ov::pass::low_precision::FuseMultiplyToFakeQuantizeTransformation class represents the `FuseMultiplyToFakeQuantizeTransformation` transformation.

View File

@@ -1,3 +1,3 @@
# FuseSubtractToFakeQuantizeTransformation transformation {#openvino_docs_OV_UG_lpt_FuseSubtractToFakeQuantizeTransformation}
ngraph::pass::low_precision::FuseSubtractToFakeQuantizeTransformation class represents the `FuseSubtractToFakeQuantizeTransformation` transformation.
ov::pass::low_precision::FuseSubtractToFakeQuantizeTransformation class represents the `FuseSubtractToFakeQuantizeTransformation` transformation.

View File

@@ -1,3 +1,3 @@
# MultiplyToGroupConvolutionTransformation transformation {#openvino_docs_OV_UG_lpt_MultiplyToGroupConvolutionTransformation}
ngraph::pass::low_precision::MultiplyToGroupConvolutionTransformation class represents the `MultiplyToGroupConvolutionTransformation` transformation.
ov::pass::low_precision::MultiplyToGroupConvolutionTransformation class represents the `MultiplyToGroupConvolutionTransformation` transformation.

View File

@@ -33,9 +33,9 @@ ov::pass::Manager manager;
auto pass_config = manager.get_pass_config();
//! [lpt_common]
// check if the function is quantized to ignore LPT transformations for not quantized function to speed up model loading
const bool useLpt = ngraph::pass::low_precision::LowPrecision::isFunctionQuantized(nGraphFunc);
const bool useLpt = ov::pass::low_precision::LowPrecision::isFunctionQuantized(nGraphFunc);
auto defaultPrecisions =
useLpt ? ngraph::pass::low_precision::precision_set::int8_support : std::vector<ov::element::Type>{};
useLpt ? ov::pass::low_precision::precision_set::int8_support : std::vector<ov::element::Type>{};
if (useLpt) {
// disable constant folding on dequantization subgraphs so they can be processed by LPT
manager.register_pass<ov::pass::MarkDequantizationSubgraph>(defaultPrecisions);
@@ -45,7 +45,7 @@ if (useLpt) {
if (useLpt) {
// convert subtract constant to INT8 to prevent unnecessary FP16 to FP32 conversion
manager.register_pass<ngraph::pass::low_precision::ConvertSubtractConstant>(defaultPrecisions);
manager.register_pass<ov::pass::low_precision::ConvertSubtractConstant>(defaultPrecisions);
}
// nGraph common transformations happen here
@@ -53,12 +53,12 @@ if (useLpt) {
if (useLpt) {
// convert not supported cases FakeQuantize -> Convert -> Convert -> Subtract -> Multiply to a single FakeQuantize
pass_config->set_callback<ov::pass::ConvertQuantizeDequantize>([&defaultPrecisions](const std::shared_ptr<const ngraph::Node> &node) -> bool {
return ngraph::pass::low_precision::NetworkHelper::areQuantizeAndDequantizeSupportedForMultiply(node, defaultPrecisions);
return ov::pass::low_precision::NetworkHelper::areQuantizeAndDequantizeSupportedForMultiply(node, defaultPrecisions);
});
// convert not supported cases FakeQuantize -> Convert -> Convert -> Subtract -> Multiply to a single FakeQuantize
pass_config->set_callback<ov::pass::ConvertSubtract>([&defaultPrecisions](const std::shared_ptr<const ngraph::Node> &node) -> bool {
return ngraph::pass::low_precision::NetworkHelper::areQuantizeAndDequantizeSupportedForSubtract(node, defaultPrecisions);
return ov::pass::low_precision::NetworkHelper::areQuantizeAndDequantizeSupportedForSubtract(node, defaultPrecisions);
});
}
@@ -66,7 +66,7 @@ manager.run_passes(nGraphFunc);
//! [lpt_common]
//! [lpt_execution]
using namespace ngraph::pass::low_precision;
using namespace ov::pass::low_precision;
if (useLpt) {
// Low precision transformations plugin specific configuration: restrictions definition
auto supportedPrecisions = std::vector<PrecisionsRestriction>({
@@ -96,7 +96,7 @@ if (useLpt) {
// Low precision transformations instantiation and registration in pass manager
ov::pass::Manager lptManager;
lptManager.register_pass<ngraph::pass::low_precision::LowPrecision>(supportedPrecisions, perTensorQuantization);
lptManager.register_pass<ov::pass::low_precision::LowPrecision>(supportedPrecisions, perTensorQuantization);
// Low precision transformations plugin specific configuration: transformation callbacks definition
lptManager.get_pass_config()->set_callback<MarkupPrecisions>([](const std::shared_ptr<const ngraph::Node>& node) -> bool {
@@ -130,7 +130,7 @@ int lpt_supported_precisions() {
std::shared_ptr<ov::Model> nGraphFunc;
ov::pass::Manager manager;
using namespace ngraph::pass::low_precision;
using namespace ov::pass::low_precision;
//! [lpt_supported_precisions]
auto supportedPrecisions = std::vector<PrecisionsRestriction>({
PrecisionsRestriction::create<ov::opset1::Convolution>({
@@ -140,7 +140,7 @@ auto supportedPrecisions = std::vector<PrecisionsRestriction>({
});
ov::pass::Manager lptManager;
lptManager.register_pass<ngraph::pass::low_precision::LowPrecision>(supportedPrecisions);
lptManager.register_pass<ov::pass::low_precision::LowPrecision>(supportedPrecisions);
lptManager.run_passes(nGraphFunc);
//! [lpt_supported_precisions]
@@ -154,7 +154,7 @@ return 0;
int per_tensor_quantization() {
std::shared_ptr<ov::Model> nGraphFunc;
//! [per_tensor_quantization]
using namespace ngraph::pass::low_precision;
using namespace ov::pass::low_precision;
const std::vector<PrecisionsRestriction> emptyRestrictions;
@@ -163,7 +163,7 @@ auto perTensorQuantization = std::vector<QuantizationGranularityRestriction>({
});
ov::pass::Manager lptManager;
lptManager.register_pass<ngraph::pass::low_precision::LowPrecision>(emptyRestrictions, perTensorQuantization);
lptManager.register_pass<ov::pass::low_precision::LowPrecision>(emptyRestrictions, perTensorQuantization);
lptManager.run_passes(nGraphFunc);
//! [per_tensor_quantization]
@@ -177,10 +177,10 @@ auto pass_config = manager.get_pass_config();
//! [asymmetric_quantization]
using namespace ngraph::pass::low_precision;
using namespace ov::pass::low_precision;
ov::pass::Manager lptManager;
lptManager.register_pass<ngraph::pass::low_precision::LowPrecision>();
lptManager.register_pass<ov::pass::low_precision::LowPrecision>();
lptManager.get_pass_config()->set_callback<ConvolutionBackpropDataTransformation>([&defaultPrecisions](const std::shared_ptr<const ngraph::Node>& node) -> bool {
return LayerTransformation::isAsymmetricQuantization(node, defaultPrecisions) || WeightableLayerTransformation::isAsymmetricOnWeights(node);
});
@@ -194,7 +194,7 @@ int lpt_markup_pipeline() {
std::shared_ptr<ov::Model> nGraphFunc;
ov::pass::Manager manager;
using namespace ngraph::pass::low_precision;
using namespace ov::pass::low_precision;
//! [lpt_markup_pipeline]
auto supportedPrecisions = std::vector<PrecisionsRestriction>({
PrecisionsRestriction::create<ov::opset1::Convolution>({
@@ -208,7 +208,7 @@ auto perTensorQuantization = std::vector<QuantizationGranularityRestriction>({
});
ov::pass::Manager lptManager;
lptManager.register_pass<ngraph::pass::low_precision::LowPrecision>(supportedPrecisions, perTensorQuantization);
lptManager.register_pass<ov::pass::low_precision::LowPrecision>(supportedPrecisions, perTensorQuantization);
lptManager.run_passes(nGraphFunc);
//! [lpt_markup_pipeline]

View File

@@ -16,6 +16,7 @@ no uniquely matching class member found for
example was already documented\. ignoring documentation found here\.
documentation for unknown define
detected potential recursive class relation between class
no matching class member found for
no matching file member found for
documented empty return type of
documented symbol

View File

@@ -9,11 +9,11 @@
#pragma once
#include <openvino/cc/selective_build.h>
#include <openvino/itt.hpp>
#include <openvino/cc/ngraph/itt.hpp>
#include "openvino/cc/selective_build.h"
#include "openvino/itt.hpp"
#include "openvino/cc/pass/itt.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
namespace itt {

View File

@@ -4,10 +4,10 @@
#pragma once
#include <ngraph/ngraph.hpp>
#include "low_precision/eltwise_base_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -24,10 +24,10 @@ class LP_TRANSFORMATIONS_API AddTransformation : public EltwiseBaseTransformatio
public:
OPENVINO_RTTI("AddTransformation", "0");
AddTransformation(const Params& params = Params());
bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override;
bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override;
bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> layer) const override;
};
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -9,7 +9,7 @@
#include "low_precision/layer_transformation.hpp"
#include "openvino/pass/pass.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -17,7 +17,7 @@ class LP_TRANSFORMATIONS_API AlignQuantizationIntervals;
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov
/**
* @ingroup ie_transformation_common_api
@@ -28,11 +28,11 @@ class LP_TRANSFORMATIONS_API AlignQuantizationIntervals;
* [AlignQuantizationIntervals](@ref openvino_docs_OV_UG_lpt_AlignQuantizationIntervals) page
* in the Inference Engine Developer Guide.
*/
class ngraph::pass::low_precision::AlignQuantizationIntervals : public ov::pass::ModelPass {
class ov::pass::low_precision::AlignQuantizationIntervals : public ov::pass::ModelPass {
public:
OPENVINO_RTTI("AlignQuantizationIntervals", "0");
AlignQuantizationIntervals(const std::vector<ov::element::Type>& defaultPrecisions = ngraph::pass::low_precision::precision_set::int8_support);
AlignQuantizationIntervals(const std::vector<ov::element::Type>& defaultPrecisions = ov::pass::low_precision::precision_set::int8_support);
bool run_on_model(const std::shared_ptr<ov::Model>& m) override;
private:
const std::vector<ngraph::element::Type> defaultPrecisions;
const std::vector<ov::element::Type> defaultPrecisions;
};

View File

@@ -6,11 +6,11 @@
#include <memory>
#include <ngraph/pass/pass.hpp>
#include "openvino/pass/pass.hpp"
#include "low_precision/lpt_visibility.hpp"
#include "low_precision/layer_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -18,7 +18,7 @@ class LP_TRANSFORMATIONS_API AlignQuantizationParameters;
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov
/**
* @ingroup ie_transformation_common_api
@@ -29,11 +29,11 @@ class LP_TRANSFORMATIONS_API AlignQuantizationParameters;
* [AlignQuantizationParameters](@ref openvino_docs_OV_UG_lpt_AlignQuantizationParameters) page
* in the Inference Engine Developer Guide.
*/
class ngraph::pass::low_precision::AlignQuantizationParameters : public ov::pass::ModelPass {
class ov::pass::low_precision::AlignQuantizationParameters : public ov::pass::ModelPass {
public:
OPENVINO_RTTI("AlignQuantizationParameters", "0");
AlignQuantizationParameters(const std::vector<ngraph::element::Type> defaultPrecisions = ngraph::pass::low_precision::precision_set::int8_support);
bool run_on_model(const std::shared_ptr<ngraph::Function>& m) override;
AlignQuantizationParameters(const std::vector<ov::element::Type> defaultPrecisions = ov::pass::low_precision::precision_set::int8_support);
bool run_on_model(const std::shared_ptr<ov::Model>& m) override;
private:
const std::vector<ngraph::element::Type> defaultPrecisions;
const std::vector<ov::element::Type> defaultPrecisions;
};

View File

@@ -4,24 +4,24 @@
#pragma once
#include <ngraph/ngraph.hpp>
#include "layer_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
class LP_TRANSFORMATIONS_API AssignAndReadValueTransformation : public LayerTransformation {
public:
OPENVINO_RTTI("AssignAndReadValueTransformation", "0");
AssignAndReadValueTransformation(const std::shared_ptr<ngraph::Function> function, const Params& params = Params());
bool transform(TransformationContext& context, ngraph::pattern::Matcher& m) override;
AssignAndReadValueTransformation(const std::shared_ptr<ov::Model> model, const Params& params = Params());
bool transform(TransformationContext& context, ov::pass::pattern::Matcher& m) override;
bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> op) const override;
bool isPrecisionPreserved(std::shared_ptr<Node> layer) const noexcept override;
private:
std::shared_ptr<ngraph::Function> function;
std::shared_ptr<ov::Model> model;
};
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -7,7 +7,7 @@
#include <algorithm>
#include "low_precision/layer_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -30,4 +30,4 @@ public:
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -3,11 +3,11 @@
//
#pragma once
#include <ngraph/node.hpp>
#include <ngraph/pass/graph_rewrite.hpp>
#include "openvino/core/node.hpp"
#include "openvino/pass/graph_rewrite.hpp"
#include "rt_info/attribute_parameters.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -15,9 +15,9 @@ class LP_TRANSFORMATIONS_API BaseMatcherPass;
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov
class LP_TRANSFORMATIONS_API ngraph::pass::low_precision::BaseMatcherPass : public ov::pass::MatcherPass {
class LP_TRANSFORMATIONS_API ov::pass::low_precision::BaseMatcherPass : public ov::pass::MatcherPass {
public:
BaseMatcherPass(const AttributeParameters& params = AttributeParameters());
AttributeParameters params;

View File

@@ -5,10 +5,10 @@
#pragma once
#include <memory>
#include <ngraph/ngraph.hpp>
#include "layer_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -24,11 +24,11 @@ class LP_TRANSFORMATIONS_API ClampTransformation : public LayerTransformation {
public:
OPENVINO_RTTI("ClampTransformation", "0");
ClampTransformation(const Params& params = Params());
bool transform(TransformationContext& context, ngraph::pattern::Matcher& m) override;
bool transform(TransformationContext& context, ov::pass::pattern::Matcher& m) override;
bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> op) const override;
bool isPrecisionPreserved(std::shared_ptr<Node> layer) const noexcept override;
};
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -6,11 +6,11 @@
#include <memory>
#include <tuple>
#include <low_precision/lpt_visibility.hpp>
#include "low_precision/lpt_visibility.hpp"
#include "openvino/core/node.hpp"
#include "openvino/opsets/opset1.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -35,17 +35,17 @@ public:
bool isLowPrecision() const;
std::shared_ptr<Node> copyWithNewInput(const std::shared_ptr<Node>& input) const;
bool checkElementwise(const std::shared_ptr<ngraph::Node>& elementwise) const;
bool checkElementwise(const std::shared_ptr<ov::Node>& elementwise) const;
static bool checkShape(const std::shared_ptr<ngraph::Node>& elementwise);
static bool checkShape(const std::shared_ptr<ov::Node>& elementwise);
static int fillDequantizationParams(
const std::shared_ptr<ngraph::Node>& elementwise,
const std::shared_ptr<ov::Node>& elementwise,
std::shared_ptr<ov::opset1::Convert>& convert,
std::shared_ptr<ov::opset1::Constant>& constant);
static int fillDequantizationParams(
const std::shared_ptr<ngraph::Node>& elementwise,
const std::shared_ptr<ov::Node>& elementwise,
std::shared_ptr<ov::opset1::Constant>& constant);
size_t channelDimIndex;
@@ -60,4 +60,4 @@ public:
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -6,16 +6,16 @@
#include <exception>
#include <string>
#include <ngraph/node.hpp>
#include <low_precision/lpt_visibility.hpp>
#include "openvino/core/node.hpp"
#include "low_precision/lpt_visibility.hpp"
/**
* @def THROW_TRANSFORMATION_EXCEPTION_LPT
* @brief A macro used to throw the exception with a notable description for low precision transformations
*/
#define THROW_IE_LPT_EXCEPTION(node) throw ::ngraph::pass::low_precision::InferenceEngineLptException(__FILE__, __LINE__, node)
#define THROW_IE_LPT_EXCEPTION(node) throw ::ov::pass::low_precision::InferenceEngineLptException(__FILE__, __LINE__, node)
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -39,7 +39,7 @@ public:
}
};
#define THROW_TRANSFORMATION_EXCEPTION throw ::ngraph::pass::low_precision::Exception() << __FILE__ << ":" << __LINE__ << " "
#define THROW_TRANSFORMATION_EXCEPTION throw ::ov::pass::low_precision::Exception() << __FILE__ << ":" << __LINE__ << " "
class LP_TRANSFORMATIONS_API InferenceEngineLptException : public Exception {
@@ -53,4 +53,4 @@ public:
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -11,7 +11,7 @@
#include "low_precision/lpt_visibility.hpp"
#include "low_precision/rt_info/quantization_granularity_attribute.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -27,4 +27,4 @@ public:
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -9,10 +9,10 @@
#include <unordered_set>
#include <vector>
#include <low_precision/lpt_visibility.hpp>
#include "low_precision/lpt_visibility.hpp"
#include "openvino/core/node.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
/**
@@ -21,30 +21,30 @@ namespace low_precision {
* the same precision for mentioned
*
* // One restriction for each port
* PrecisionsRestriction::create<ngraph::opset1::Convolution>({
* {{0}, {ngraph::element::u8}},
* {{1}, {ngraph::element::i8}},
* PrecisionsRestriction::create<ov::opset1::Convolution>({
* {{0}, {ov::element::u8}},
* {{1}, {ov::element::i8}},
* }),
*
* // Common precision restriction for several ports:
* // both inputs will have the same precision
* PrecisionsRestriction::create<ngraph::opset5::LSTMSequence>({
* {{0, 1}, {ngraph::element::u8, ngraph::element::i8}}
* PrecisionsRestriction::create<ov::opset5::LSTMSequence>({
* {{0, 1}, {ov::element::u8, ov::element::i8}}
* }),
*/
class PrecisionsRestriction {
public:
using PrecisionsByPorts = std::vector<std::pair<std::vector<size_t>, std::vector<ngraph::element::Type>>>;
using PrecisionsByPorts = std::vector<std::pair<std::vector<size_t>, std::vector<ov::element::Type>>>;
using PrecisionsByPortsFunction = std::function<PrecisionsByPorts(const std::shared_ptr<Node>&)>;
ngraph::Node::type_info_t operationType;
ov::Node::type_info_t operationType;
bool specifyVersion;
PrecisionsByPorts precisionsByPorts;
PrecisionsByPortsFunction precisionsByPortsFunction;
PrecisionsRestriction() = default;
PrecisionsRestriction(
const ngraph::Node::type_info_t& operationType,
const ov::Node::type_info_t& operationType,
const bool specifyVersion,
const PrecisionsByPorts& precisionsByPorts) :
operationType(operationType),
@@ -52,7 +52,7 @@ public:
precisionsByPorts(precisionsByPorts) {}
PrecisionsRestriction(
const ngraph::Node::type_info_t& operationType,
const ov::Node::type_info_t& operationType,
const bool specifyVersion,
const PrecisionsByPortsFunction& precisionsByPortsFunction) :
operationType(operationType),
@@ -86,4 +86,4 @@ public:
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -6,26 +6,26 @@
#include <vector>
#include <ngraph/node.hpp>
#include "openvino/core/node.hpp"
#include <low_precision/lpt_visibility.hpp>
#include <low_precision/rt_info/quantization_granularity_attribute.hpp>
#include <low_precision/common/port_quantization_granularity_restriction.hpp>
#include "low_precision/lpt_visibility.hpp"
#include "low_precision/rt_info/quantization_granularity_attribute.hpp"
#include "low_precision/common/port_quantization_granularity_restriction.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
class LP_TRANSFORMATIONS_API QuantizationGranularityRestriction {
public:
ngraph::Node::type_info_t operationType;
ov::Node::type_info_t operationType;
bool specifyVersion;
std::vector<PortQuantizationGranularityRestriction> restrictions;
QuantizationGranularityRestriction() = default;
QuantizationGranularityRestriction(
const ngraph::Node::type_info_t operationType,
const ov::Node::type_info_t operationType,
const bool specifyVersion,
const std::vector<PortQuantizationGranularityRestriction>& restrictions) :
operationType(operationType),
@@ -48,7 +48,7 @@ public:
for (auto i = 0ul; i < restrictedPorts.size(); ++i) {
restrictions.push_back(PortQuantizationGranularityRestriction(
restrictedPorts[i],
ngraph::QuantizationGranularityAttribute::Granularity::PerTensor));
ov::QuantizationGranularityAttribute::Granularity::PerTensor));
}
return QuantizationGranularityRestriction(T::get_type_info_static(), specifyVersion, restrictions);
}
@@ -66,4 +66,4 @@ public:
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -10,12 +10,12 @@
#include <string>
#include <vector>
#include <ngraph/ngraph.hpp>
#include "layer_transformation.hpp"
#include "common/fake_quantize_dequantization.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -31,7 +31,7 @@ class LP_TRANSFORMATIONS_API ConcatTransformation : public LayerTransformation {
public:
OPENVINO_RTTI("ConcatTransformation", "0");
ConcatTransformation(const Params& params = Params());
bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override;
bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override;
bool isPrecisionPreserved(std::shared_ptr<Node> layer) const noexcept override;
bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> layer) const override;
static bool isQuantizedStatic(const std::shared_ptr<const Node>& layer);
@@ -39,4 +39,4 @@ public:
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -4,10 +4,10 @@
#pragma once
#include <ngraph/ngraph.hpp>
#include "low_precision/layer_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -15,10 +15,10 @@ class LP_TRANSFORMATIONS_API ConvertTransformation : public LayerTransformation
public:
OPENVINO_RTTI("ConvertTransformation", "0");
ConvertTransformation(const Params& params = Params());
bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override;
bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override;
bool isPrecisionPreserved(std::shared_ptr<Node> layer) const noexcept override;
};
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -7,10 +7,10 @@
#include <memory>
#include <utility>
#include <low_precision/lpt_visibility.hpp>
#include "low_precision/lpt_visibility.hpp"
#include "openvino/pass/graph_rewrite.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -18,7 +18,7 @@ class LP_TRANSFORMATIONS_API ConvertSubtractConstant;
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov
/**
* @ingroup ie_transformation_common_api
@@ -29,8 +29,8 @@ class LP_TRANSFORMATIONS_API ConvertSubtractConstant;
* [ConvertSubtractConstant](@ref openvino_docs_OV_UG_lpt_ConvertSubtractConstant) page
* in the Inference Engine Developer Guide.
*/
class ngraph::pass::low_precision::ConvertSubtractConstant : public ov::pass::MatcherPass {
class ov::pass::low_precision::ConvertSubtractConstant : public ov::pass::MatcherPass {
public:
OPENVINO_RTTI("ConvertSubtractConstant", "0");
ConvertSubtractConstant(const std::vector<ngraph::element::Type>& constantPrecisions = {});
ConvertSubtractConstant(const std::vector<ov::element::Type>& constantPrecisions = {});
};

View File

@@ -6,7 +6,7 @@
#include "weightable_layer_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -24,14 +24,14 @@ public:
ConvolutionTransformation(const Params& params = Params());
bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override;
bool isQuantized(const std::shared_ptr<const Node>& layer,
const std::vector<ngraph::element::Type>&defaultPrecisions) const override;
const std::vector<ov::element::Type>&defaultPrecisions) const override;
static bool isQuantizedStatic(const std::shared_ptr<const Node>& layer,
const std::vector<ngraph::element::Type>& defaultPrecisions);
const std::vector<ov::element::Type>& defaultPrecisions);
protected:
size_t getInputChannels(const std::shared_ptr<ngraph::Node> conv) const override;
size_t getInputChannels(const std::shared_ptr<ov::Node> conv) const override;
};
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -6,7 +6,7 @@
#include "weightable_layer_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -24,14 +24,14 @@ public:
bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override;
bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> op) const override;
bool isQuantized(const std::shared_ptr<const Node>& layer,
const std::vector<ngraph::element::Type>&defaultPrecisions) const override;
const std::vector<ov::element::Type>&defaultPrecisions) const override;
static bool isQuantizedStatic(const std::shared_ptr<const Node>& layer,
const std::vector<ngraph::element::Type>& defaultPrecisions);
const std::vector<ov::element::Type>& defaultPrecisions);
protected:
size_t getInputChannels(const std::shared_ptr<ngraph::Node> conv) const override;
size_t getInputChannels(const std::shared_ptr<ov::Node> conv) const override;
};
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -8,13 +8,13 @@
#include <memory>
#include <vector>
#include <ngraph/pass/graph_rewrite.hpp>
#include <ngraph/pattern/op/wrap_type.hpp>
#include "openvino/pass/graph_rewrite.hpp"
#include "openvino/pass/pattern/op/wrap_type.hpp"
#include "low_precision/lpt_visibility.hpp"
#include "low_precision/base_matcher_pass.hpp"
#include "low_precision/lpt_itt.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -23,7 +23,7 @@ class CreateAttribute;
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov
enum class AttributeSource {
Node,
@@ -37,8 +37,8 @@ enum class AttributeSource {
* For more details about the transformation, refer to
* [CreateAttribute](@ref openvino_docs_OV_UG_lpt_CreateAttribute) page in the Inference Engine Developer Guide.
*/
template <typename AttributeType, typename OperationType = ngraph::pattern::op::Label>
class ngraph::pass::low_precision::CreateAttribute : public ngraph::pass::low_precision::BaseMatcherPass {
template <typename AttributeType, typename OperationType = ov::pass::pattern::op::Label>
class ov::pass::low_precision::CreateAttribute : public ov::pass::low_precision::BaseMatcherPass {
public:
CreateAttribute(const AttributeParameters& params = AttributeParameters(), const AttributeSource source = AttributeSource::Node) : BaseMatcherPass(params) {
assert((source == AttributeSource::Node) || (source == AttributeSource::OutputPort));
@@ -46,7 +46,7 @@ public:
pattern::any_input() :
pattern::wrap_type<OperationType>();
ngraph::graph_rewrite_callback callback = [&](pattern::Matcher& m) {
ov::graph_rewrite_callback callback = [&](pattern::Matcher& m) {
auto op = m.get_match_root();
if (transformation_callback(op)) {
return false;
@@ -61,7 +61,7 @@ public:
return true;
};
auto matcher = std::make_shared<ngraph::pattern::Matcher>(operation, "CreateAttribute");
auto matcher = std::make_shared<ov::pass::pattern::Matcher>(operation, "CreateAttribute");
this->register_matcher(matcher, callback);
}
};

View File

@@ -7,17 +7,17 @@
#include <memory>
#include <vector>
#include <ngraph/node.hpp>
#include <ngraph/pattern/op/wrap_type.hpp>
#include "openvino/core/node.hpp"
#include "openvino/pass/pattern/op/wrap_type.hpp"
#include <low_precision/lpt_visibility.hpp>
#include <ngraph/pass/graph_rewrite.hpp>
#include <ngraph/opsets/opset1.hpp>
#include "low_precision/lpt_visibility.hpp"
#include "openvino/pass/graph_rewrite.hpp"
#include "openvino/opsets/opset1.hpp"
#include "rt_info/precision_preserved_attribute.hpp"
#include "network_helper.hpp"
#include "lpt_itt.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -26,7 +26,7 @@ class CreatePrecisionsDependentAttribute;
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov
/**
* @ingroup ie_transformation_common_api
@@ -38,12 +38,12 @@ class CreatePrecisionsDependentAttribute;
* in the Inference Engine Developer Guide.
*/
template <typename AttributeType, typename OperationType>
class ngraph::pass::low_precision::CreatePrecisionsDependentAttribute : public ov::pass::MatcherPass {
class ov::pass::low_precision::CreatePrecisionsDependentAttribute : public ov::pass::MatcherPass {
public:
CreatePrecisionsDependentAttribute() {
auto operation = pattern::wrap_type<OperationType>();
ngraph::graph_rewrite_callback callback = [&](pattern::Matcher& m) {
ov::graph_rewrite_callback callback = [&](pattern::Matcher& m) {
auto node = m.get_match_root();
if (transformation_callback(node)) {
return false;
@@ -65,7 +65,7 @@ public:
rt[AttributeType::get_type_info_static()] = attribute;
// Step #3: assign the same shared value to enable PrecisionPreservedAttribute update during AttributeType propagation
ngraph::pass::low_precision::NetworkHelper::reassign<AttributeType>(
ov::pass::low_precision::NetworkHelper::reassign<AttributeType>(
targetSharedValue,
{
attribute.attribute,
@@ -75,7 +75,7 @@ public:
return true;
};
auto matcher = std::make_shared<ngraph::pattern::Matcher>(operation, "CreatePrecisionsDependentAttribute");
auto matcher = std::make_shared<ov::pass::pattern::Matcher>(operation, "CreatePrecisionsDependentAttribute");
this->register_matcher(matcher, callback);
}
};

View File

@@ -6,7 +6,7 @@
#include "transparent_base_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -27,4 +27,4 @@ public:
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -5,10 +5,10 @@
#pragma once
#include <memory>
#include <ngraph/ngraph.hpp>
#include "low_precision/layer_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -24,11 +24,11 @@ class LP_TRANSFORMATIONS_API EliminateFakeQuantizeTransformation : public LayerT
public:
OPENVINO_RTTI("EliminateFakeQuantizeTransformation", "0");
EliminateFakeQuantizeTransformation(const Params& params = Params());
bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override;
bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override;
bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> layer) const override;
bool isPrecisionPreserved(std::shared_ptr<Node> layer) const noexcept override;
};
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -5,10 +5,10 @@
#pragma once
#include <memory>
#include <ngraph/ngraph.hpp>
#include "layer_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -33,4 +33,4 @@ protected:
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -7,7 +7,7 @@
#include <memory>
#include "layer_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -37,4 +37,4 @@ public:
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -5,10 +5,10 @@
#pragma once
#include <memory>
#include <ngraph/ngraph.hpp>
#include "layer_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -25,10 +25,10 @@ class LP_TRANSFORMATIONS_API FakeQuantizeDecompositionTransformation : public La
public:
OPENVINO_RTTI("FakeQuantizeDecompositionTransformation", "0");
FakeQuantizeDecompositionTransformation(const Params& params = Params());
bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override;
bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override;
bool isPrecisionPreserved(std::shared_ptr<Node> layer) const noexcept override;
};
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -5,10 +5,10 @@
#pragma once
#include <memory>
#include <ngraph/ngraph.hpp>
#include "low_precision/layer_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -24,11 +24,11 @@ class LP_TRANSFORMATIONS_API FoldConvertTransformation : public LayerTransformat
public:
OPENVINO_RTTI("FoldConvertTransformation", "0");
FoldConvertTransformation(const Params& params = Params());
bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override;
bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override;
bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> layer) const override;
bool isPrecisionPreserved(std::shared_ptr<Node> layer) const noexcept override;
};
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -4,10 +4,10 @@
#pragma once
#include <ngraph/ngraph.hpp>
#include "low_precision/layer_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -23,12 +23,12 @@ class LP_TRANSFORMATIONS_API FoldFakeQuantizeTransformation : public LayerTransf
public:
OPENVINO_RTTI("FoldFakeQuantizeTransformation", "0");
FoldFakeQuantizeTransformation(const Params& params = Params());
bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override;
bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override;
bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> layer) const override;
bool isPrecisionPreserved(std::shared_ptr<Node> layer) const noexcept override;
bool isConstantOutput(std::shared_ptr<ngraph::Node> op) const;
bool isConstantOutput(std::shared_ptr<ov::Node> op) const;
};
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -4,11 +4,11 @@
#pragma once
#include <ngraph/ngraph.hpp>
#include "low_precision/layer_transformation.hpp"
#include "low_precision/eltwise_base_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -24,11 +24,11 @@ class LP_TRANSFORMATIONS_API FuseConvertTransformation : public LayerTransformat
public:
OPENVINO_RTTI("FuseConvertTransformation", "0");
FuseConvertTransformation(const Params& params = Params());
bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override;
bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override;
bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> layer) const override;
bool isPrecisionPreserved(std::shared_ptr<Node> layer) const noexcept override;
};
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -5,10 +5,10 @@
#pragma once
#include <memory>
#include <ngraph/ngraph.hpp>
#include "low_precision/layer_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -24,11 +24,11 @@ class LP_TRANSFORMATIONS_API FuseMultiplyToFakeQuantizeTransformation : public L
public:
OPENVINO_RTTI("FuseMultiplyToFakeQuantizeTransformation", "0");
FuseMultiplyToFakeQuantizeTransformation(const Params& params = Params());
bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override;
bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override;
bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> layer) const override;
bool isPrecisionPreserved(std::shared_ptr<Node> layer) const noexcept override;
};
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -5,10 +5,10 @@
#pragma once
#include <memory>
#include <ngraph/ngraph.hpp>
#include "low_precision/layer_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -24,11 +24,11 @@ class LP_TRANSFORMATIONS_API FuseSubtractToFakeQuantizeTransformation : public L
public:
OPENVINO_RTTI("FuseSubtractToFakeQuantizeTransformation", "0");
FuseSubtractToFakeQuantizeTransformation(const Params& params = Params());
bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override;
bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override;
bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> layer) const override;
bool isPrecisionPreserved(std::shared_ptr<Node> layer) const noexcept override;
};
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -7,7 +7,7 @@
#include <algorithm>
#include "low_precision/layer_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -22,4 +22,4 @@ public:
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -4,10 +4,10 @@
#pragma once
#include <ngraph/ngraph.hpp>
#include "convolution.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -23,16 +23,16 @@ class LP_TRANSFORMATIONS_API GroupConvolutionTransformation : public Convolution
public:
OPENVINO_RTTI("GroupConvolutionTransformation", "0");
GroupConvolutionTransformation(const Params& params = Params());
bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override;
bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override;
bool isQuantized(const std::shared_ptr<const Node>& layer,
const std::vector<ngraph::element::Type>& defaultPrecisions) const override;
const std::vector<ov::element::Type>& defaultPrecisions) const override;
static bool isQuantizedStatic(const std::shared_ptr<const Node>& layer,
const std::vector<ngraph::element::Type>& defaultPrecisions);
const std::vector<ov::element::Type>& defaultPrecisions);
protected:
size_t getInputChannels(const std::shared_ptr<ngraph::Node> conv) const override;
size_t getInputChannels(const std::shared_ptr<ov::Node> conv) const override;
};
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -6,7 +6,7 @@
#include "transparent_base_transformation.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -22,11 +22,11 @@ class LP_TRANSFORMATIONS_API InterpolateTransformation : public LayerTransformat
public:
OPENVINO_RTTI("InterpolateTransformation", "0");
InterpolateTransformation(const Params& params = Params());
bool transform(TransformationContext &context, ngraph::pattern::Matcher &m) override;
bool transform(TransformationContext &context, ov::pass::pattern::Matcher &m) override;
bool isPrecisionPreserved(std::shared_ptr<Node> layer) const noexcept override;
bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> layer) const override;
};
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -34,17 +34,17 @@
// #define LPT_PRINT_DEQUANTIZATION_INFO
// #define LPT_DISPLAY_PRECISION
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
namespace precision_set {
const std::vector<element::Type> int8_support = {
ngraph::element::u8, ngraph::element::i8
ov::element::u8, ov::element::i8
};
const std::vector<element::Type> int8_int16_int32_support = {
ngraph::element::u8, ngraph::element::i8,
ngraph::element::u16, ngraph::element::i16,
ngraph::element::u32, ngraph::element::i32
ov::element::u8, ov::element::i8,
ov::element::u16, ov::element::i16,
ov::element::u32, ov::element::i32
};
}
enum levels : size_t {
@@ -151,9 +151,9 @@ public:
case element::f32:
return std::numeric_limits<float>::lowest();
default:
NGRAPH_CHECK(false, "unexpected precision ", precision);
OPENVINO_ASSERT(false, "unexpected precision ", precision);
}
NGRAPH_CHECK(false, "unexpected levels ", levels, " for precision ", precision);
OPENVINO_ASSERT(false, "unexpected levels ", levels, " for precision ", precision);
}
static float getMaxValue(const element::Type precision, const size_t levels) {
@@ -189,7 +189,7 @@ public:
case element::f32:
return std::numeric_limits<float>::max();
default:
NGRAPH_CHECK(false, "unexpected precision ", precision);
OPENVINO_ASSERT(false, "unexpected precision ", precision);
}
}
@@ -258,8 +258,8 @@ public:
Params(
const bool updatePrecisions = true,
element::Type deqPrecision = element::f32,
const std::vector<ngraph::element::Type> defaultPrecisions =
{ ngraph::element::u8, ngraph::element::i8 },
const std::vector<ov::element::Type> defaultPrecisions =
{ ov::element::u8, ov::element::i8 },
const bool reshapeIgnorePerTensorQuantizationCheck = false) :
updatePrecisions(updatePrecisions),
deqPrecision(deqPrecision),
@@ -276,14 +276,14 @@ public:
return *this;
}
Params& setDefaultPrecisions(const std::vector<ngraph::element::Type>& defaultPrecisions) {
Params& setDefaultPrecisions(const std::vector<ov::element::Type>& defaultPrecisions) {
this->defaultPrecisions = defaultPrecisions;
return *this;
}
bool updatePrecisions;
element::Type deqPrecision;
std::vector<ngraph::element::Type> defaultPrecisions;
std::vector<ov::element::Type> defaultPrecisions;
// to support GPU workarround to keep Reshape and MatMul in FP32
bool reshapeIgnorePerTensorQuantizationCheck;
};
@@ -308,11 +308,11 @@ public:
void setUpdatePrecisions(const bool updatePrecisions);
void setDefaultPrecisions(const std::vector<ngraph::element::Type>& defaultPrecisions);
void setDefaultPrecisions(const std::vector<ov::element::Type>& defaultPrecisions);
virtual bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> layer) const;
static bool canBeTransformedStatic(const std::shared_ptr<Node>& layer,
const std::vector<ngraph::element::Type>& defaultPrecisions = precision_set::int8_support);
const std::vector<ov::element::Type>& defaultPrecisions = precision_set::int8_support);
bool canSubtractBeHandled(const std::shared_ptr<Node>& op, const FakeQuantizeDequantization& dequantization) const;
@@ -326,13 +326,13 @@ public:
static PrecisionDetails getPrecisionDetails(const QuantizationDetails& quantizationDetails);
static bool isAsymmetricQuantization(const std::shared_ptr<const Node>& node,
const std::vector<ngraph::element::Type>& defaultPrecisions = precision_set::int8_support);
const std::vector<ov::element::Type>& defaultPrecisions = precision_set::int8_support);
// return true if operation can be quantized and false otherwise
// for example: if convolution operation weights are not quantized, then isQuantize returns false and true otherwise
// note: dequantization operations on activations are absent during method execution
virtual bool isQuantized(const std::shared_ptr<const Node>& layer,
const std::vector<ngraph::element::Type>& defaultPrecisions) const;
const std::vector<ov::element::Type>& defaultPrecisions) const;
// return true if operation can be preserved for precision
// note: dequantization operations on activations are absent during method execution
@@ -355,35 +355,35 @@ protected:
bool updatePrecisions;
element::Type deqPrecision;
std::vector<ngraph::element::Type> defaultPrecisions;
std::vector<ov::element::Type> defaultPrecisions;
bool reshapeIgnorePerTensorQuantizationCheck;
static constexpr char originalLayerPostfix[] = "_original";
TransformationContext* context;
protected:
std::shared_ptr<ngraph::Node> moveDequantizationAfter(
std::shared_ptr<ov::Node> moveDequantizationAfter(
TransformationContext &context,
const std::shared_ptr<ngraph::Node>& operation,
const std::shared_ptr<ov::Node>& operation,
const FakeQuantizeDequantization& dequantization,
const bool updatePrecision,
const bool moveSubtract = true) const;
std::shared_ptr<ngraph::Node> moveDequantizationBefore(
std::shared_ptr<ov::Node> moveDequantizationBefore(
TransformationContext& context,
const std::shared_ptr<ngraph::Node>& operation,
const std::shared_ptr<ov::Node>& operation,
const FakeQuantizeDequantization& dequantization,
const bool updatePrecision,
const bool moveSubtract = true) const;
void updateOutput(
TransformationContext &context,
std::shared_ptr<ngraph::Node> lastNode,
std::shared_ptr<ngraph::Node> originalNode) const;
std::shared_ptr<ov::Node> lastNode,
std::shared_ptr<ov::Node> originalNode) const;
void updateOutput(
TransformationContext& context,
std::shared_ptr<ngraph::Node> lastNode,
std::shared_ptr<ov::Node> lastNode,
std::string originalName) const;
void addPattern(ov::pass::GraphRewrite& pass, TransformationContext& context, std::shared_ptr<Node> patternRoot);
@@ -393,7 +393,7 @@ protected:
template <typename Operation>
void addSingleNodePattern(ov::pass::GraphRewrite& pass, TransformationContext& context) const {
using namespace ngraph;
using namespace ov;
auto is_op_type = [](std::shared_ptr<Node> n) {
return !!as_type_ptr<Operation>(n);
@@ -408,4 +408,4 @@ typedef std::shared_ptr<LayerTransformation> LayerTransformationPtr;
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -7,27 +7,27 @@
#include <vector>
#include <memory>
// one place to include all Low Precision Transformations from ngraph::pass::low_precision
#include <low_precision/rt_info/intervals_alignment_attribute.hpp>
#include <low_precision/rt_info/quantization_alignment_attribute.hpp>
#include <low_precision/rt_info/precisions_attribute.hpp>
#include <low_precision/rt_info/precision_preserved_attribute.hpp>
// one place to include all Low Precision Transformations from ov::pass::low_precision
#include "low_precision/rt_info/intervals_alignment_attribute.hpp"
#include "low_precision/rt_info/quantization_alignment_attribute.hpp"
#include "low_precision/rt_info/precisions_attribute.hpp"
#include "low_precision/rt_info/precision_preserved_attribute.hpp"
#include <low_precision/markup_precisions.hpp>
#include <low_precision/markup_avg_pool_precision_preserved.hpp>
#include <low_precision/propagate_precisions.hpp>
#include <low_precision/align_quantization_intervals.hpp>
#include "low_precision/markup_precisions.hpp"
#include "low_precision/markup_avg_pool_precision_preserved.hpp"
#include "low_precision/propagate_precisions.hpp"
#include "low_precision/align_quantization_intervals.hpp"
#include <low_precision/lpt_visibility.hpp>
#include <low_precision/common/quantization_granularity_restriction.hpp>
#include <low_precision/common/precisions_restriction.hpp>
#include "low_precision/lpt_visibility.hpp"
#include "low_precision/common/quantization_granularity_restriction.hpp"
#include "low_precision/common/precisions_restriction.hpp"
#include "low_precision/layer_transformation.hpp"
#include "low_precision/markup_precisions.hpp"
#include "openvino/pass/graph_rewrite.hpp"
#include "openvino/pass/pass.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -37,9 +37,9 @@ class LP_TRANSFORMATIONS_API LowPrecision;
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov
class ngraph::pass::low_precision::MarkupOptimizations : public ov::pass::ModelPass {
class ov::pass::low_precision::MarkupOptimizations : public ov::pass::ModelPass {
public:
OPENVINO_RTTI("MarkupOptimizations", "0");
MarkupOptimizations(
@@ -53,23 +53,23 @@ private:
const AttributeParameters& params;
};
class ngraph::pass::low_precision::TypeRelaxedReplacer : public ov::pass::GraphRewrite {
class ov::pass::low_precision::TypeRelaxedReplacer : public ov::pass::GraphRewrite {
public:
OPENVINO_RTTI("TypeRelaxedReplacer", "0");
TypeRelaxedReplacer();
};
class ngraph::pass::low_precision::LowPrecision : public ov::pass::ModelPass {
class ov::pass::low_precision::LowPrecision : public ov::pass::ModelPass {
public:
OPENVINO_RTTI("LowPrecision", "0");
LowPrecision(
const std::vector<PrecisionsRestriction>& precisionRestrictions = {},
const std::vector<QuantizationGranularityRestriction>& quantizationRestrictions = {},
const LayerTransformation::Params = LayerTransformation::Params());
bool run_on_model(const std::shared_ptr<ngraph::Function>& m) override;
bool run_on_model(const std::shared_ptr<ov::Model>& m) override;
static bool isFunctionQuantized(const std::shared_ptr<const ngraph::Function>& function);
static bool isFQLevelsPresent(const std::shared_ptr<const ngraph::Function>& function, const std::set<size_t>& levels);
static bool isFunctionQuantized(const std::shared_ptr<const ov::Model>& model);
static bool isFQLevelsPresent(const std::shared_ptr<const ov::Model>& model, const std::set<size_t>& levels);
protected:
std::vector<PrecisionsRestriction> precisionRestrictions;

View File

@@ -10,9 +10,9 @@
#pragma once
#include <openvino/itt.hpp>
#include "openvino/itt.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
namespace itt {
@@ -25,4 +25,4 @@ OV_ITT_DOMAIN(LPT_LT);
} // namespace itt
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -5,11 +5,11 @@
#pragma once
#include <memory>
#include <low_precision/lpt_visibility.hpp>
#include "low_precision/lpt_visibility.hpp"
#include "low_precision/layer_transformation.hpp"
#include "openvino/pass/pass.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -17,7 +17,7 @@ class LP_TRANSFORMATIONS_API MarkupAvgPoolPrecisionPreserved;
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov
/**
* @ingroup ie_transformation_common_api
@@ -27,11 +27,11 @@ class LP_TRANSFORMATIONS_API MarkupAvgPoolPrecisionPreserved;
* [MarkupAvgPoolPrecisionPreserved](@ref openvino_docs_OV_UG_lpt_MarkupAvgPoolPrecisionPreserved) page
* in the Inference Engine Developer Guide.
*/
class ngraph::pass::low_precision::MarkupAvgPoolPrecisionPreserved : public ov::pass::ModelPass {
class ov::pass::low_precision::MarkupAvgPoolPrecisionPreserved : public ov::pass::ModelPass {
public:
OPENVINO_RTTI("MarkupAvgPoolPrecisionPreserved", "0");
MarkupAvgPoolPrecisionPreserved(const std::vector<ov::element::Type> defaultPrecisions = ngraph::pass::low_precision::precision_set::int8_support);
MarkupAvgPoolPrecisionPreserved(const std::vector<ov::element::Type> defaultPrecisions = ov::pass::low_precision::precision_set::int8_support);
bool run_on_model(const std::shared_ptr<ov::Model>& m) override;
private:
const std::vector<ngraph::element::Type> defaultPrecisions;
const std::vector<ov::element::Type> defaultPrecisions;
};

View File

@@ -4,12 +4,12 @@
#pragma once
#include <low_precision/lpt_visibility.hpp>
#include "low_precision/lpt_visibility.hpp"
#include <memory>
#include <openvino/pass/graph_rewrite.hpp>
#include <openvino/pass/pattern/matcher.hpp>
#include "openvino/pass/graph_rewrite.hpp"
#include "openvino/pass/pattern/matcher.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -29,4 +29,4 @@ public:
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov

View File

@@ -5,10 +5,10 @@
#pragma once
#include <memory>
#include <ngraph/pass/pass.hpp>
#include "openvino/pass/pass.hpp"
#include "low_precision/lpt_visibility.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -16,7 +16,7 @@ class LP_TRANSFORMATIONS_API MarkupCanBeQuantized;
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov
/**
* @ingroup ie_transformation_common_api
@@ -28,11 +28,11 @@ class LP_TRANSFORMATIONS_API MarkupCanBeQuantized;
* [MarkupCanBeQuantized](@ref openvino_docs_OV_UG_lpt_MarkupCanBeQuantized) page
* in the Inference Engine Developer Guide.
*/
class ngraph::pass::low_precision::MarkupCanBeQuantized : public ov::pass::ModelPass {
class ov::pass::low_precision::MarkupCanBeQuantized : public ov::pass::ModelPass {
public:
OPENVINO_RTTI("MarkupCanBeQuantized", "0");
MarkupCanBeQuantized(const std::vector<ngraph::element::Type> defaultPrecisions = { ngraph::element::u8, ngraph::element::i8 });
bool run_on_model(const std::shared_ptr<ngraph::Function>& m) override;
MarkupCanBeQuantized(const std::vector<ov::element::Type> defaultPrecisions = { ov::element::u8, ov::element::i8 });
bool run_on_model(const std::shared_ptr<ov::Model>& m) override;
private:
const std::vector<ngraph::element::Type> defaultPrecisions;
const std::vector<ov::element::Type> defaultPrecisions;
};

View File

@@ -12,7 +12,7 @@
#include "low_precision/common/precisions_restriction.hpp"
#include "openvino/pass/pass.hpp"
namespace ngraph {
namespace ov {
namespace pass {
namespace low_precision {
@@ -20,7 +20,7 @@ class LP_TRANSFORMATIONS_API MarkupPrecisions;
} // namespace low_precision
} // namespace pass
} // namespace ngraph
} // namespace ov
// Transformation is used to add customization options runtime
/**
@@ -34,7 +34,7 @@ class LP_TRANSFORMATIONS_API MarkupPrecisions;
* [MarkupPrecisions](@ref openvino_docs_OV_UG_lpt_MarkupPrecisions) page
* in the Inference Engine Developer Guide.
*/
class ngraph::pass::low_precision::MarkupPrecisions : public ov::pass::ModelPass {
class ov::pass::low_precision::MarkupPrecisions : public ov::pass::ModelPass {
public:
class Restriction {
public:
@@ -67,12 +67,12 @@ public:
OPENVINO_RTTI("MarkupPrecisions", "0");
explicit MarkupPrecisions(const std::vector<PrecisionsRestriction>& restrictions = {},
const std::vector<ngraph::element::Type>& defaultPrecisions = { ngraph::element::u8, ngraph::element::i8 });
const std::vector<ov::element::Type>& defaultPrecisions = { ov::element::u8, ov::element::i8 });
bool run_on_model(const std::shared_ptr<ov::Model>& m) override;
private:
static bool isPrecisionPreserved(const std::shared_ptr<Node>& node);
static bool isSupported(const std::shared_ptr<Node>& node);
std::unordered_map<std::string, Restriction> restrictionsByOperation;
std::vector<ngraph::element::Type> defaultPrecisions;
std::vector<ov::element::Type> defaultPrecisions;
};

Some files were not shown because too many files have changed in this diff Show More