From a29fdb7fa7e324413fd2d0aa10a1047fddc57142 Mon Sep 17 00:00:00 2001 From: Edward Shogulin Date: Thu, 24 Jun 2021 17:49:47 +0300 Subject: [PATCH] [LPT] FQ decomposition in common pass manager - exporation #3 --- .../include/low_precision/add.hpp | 2 +- .../include/low_precision/avg_pool.hpp | 2 +- .../include/low_precision/clamp.hpp | 2 +- .../include/low_precision/concat.hpp | 2 +- .../include/low_precision/convert.hpp | 2 +- .../include/low_precision/convolution.hpp | 2 +- .../low_precision/convolution_backprop_data.hpp | 2 +- .../include/low_precision/depth_to_space.hpp | 2 +- .../include/low_precision/fake_quantize.hpp | 7 +++++-- .../low_precision/fake_quantize_decomposition.hpp | 2 +- .../include/low_precision/fold_convert.hpp | 2 +- .../include/low_precision/fold_fake_quantize.hpp | 2 +- .../include/low_precision/fuse_convert.hpp | 2 +- .../include/low_precision/fuse_fake_quantize.hpp | 2 +- .../fuse_multiply_to_fake_quantize.hpp | 2 +- .../fuse_subtract_to_fake_quantize.hpp | 2 +- .../include/low_precision/group_convolution.hpp | 2 +- .../include/low_precision/interpolate.hpp | 2 +- .../include/low_precision/layer_transformation.hpp | 4 ++-- .../include/low_precision/mat_mul.hpp | 2 +- .../include/low_precision/max_pool.hpp | 2 +- .../include/low_precision/multiply.hpp | 2 +- .../low_precision/multiply_to_group_convolution.hpp | 2 +- .../include/low_precision/mvn.hpp | 2 +- .../include/low_precision/normalize_l2.hpp | 2 +- .../include/low_precision/prelu.hpp | 2 +- .../low_precision/reduce_base_transformation.hpp | 2 +- .../include/low_precision/relu.hpp | 2 +- .../include/low_precision/reshape.hpp | 2 +- .../include/low_precision/shuffle_channels.hpp | 2 +- .../include/low_precision/split.hpp | 2 +- .../include/low_precision/squeeze.hpp | 2 +- .../include/low_precision/strided_slice.hpp | 2 +- .../include/low_precision/subtract.hpp | 2 +- .../subtract_multiply_to_multiply_add.hpp | 2 +- .../transparent_base_transformation.hpp | 2 +- .../include/low_precision/transpose.hpp | 2 +- .../include/low_precision/unsqueeze.hpp | 2 +- .../src/low_precision_transformations/src/add.cpp | 2 +- .../low_precision_transformations/src/avg_pool.cpp | 2 +- .../src/low_precision_transformations/src/clamp.cpp | 2 +- .../low_precision_transformations/src/concat.cpp | 2 +- .../low_precision_transformations/src/convert.cpp | 2 +- .../src/convolution.cpp | 2 +- .../src/convolution_backprop_data.cpp | 2 +- .../src/depth_to_space.cpp | 2 +- .../src/fake_quantize.cpp | 13 ++++++++----- .../src/fake_quantize_decomposition.cpp | 2 +- .../src/fold_convert.cpp | 2 +- .../src/fold_fake_quantize.cpp | 2 +- .../src/fuse_convert.cpp | 2 +- .../src/fuse_fake_quantize.cpp | 2 +- .../src/fuse_multiply_to_fake_quantize.cpp | 2 +- .../src/fuse_subtract_to_fake_quantize.cpp | 2 +- .../src/group_convolution.cpp | 2 +- .../src/interpolate.cpp | 2 +- .../src/layer_transformation.cpp | 2 +- .../low_precision_transformations/src/mat_mul.cpp | 2 +- .../low_precision_transformations/src/max_pool.cpp | 2 +- .../low_precision_transformations/src/multiply.cpp | 2 +- .../src/multiply_to_group_convolution.cpp | 2 +- .../src/low_precision_transformations/src/mvn.cpp | 2 +- .../src/normalize_l2.cpp | 2 +- .../src/low_precision_transformations/src/prelu.cpp | 2 +- .../src/reduce_base_transformation.cpp | 2 +- .../src/low_precision_transformations/src/relu.cpp | 2 +- .../low_precision_transformations/src/reshape.cpp | 2 +- .../src/shuffle_channels.cpp | 2 +- .../src/low_precision_transformations/src/split.cpp | 2 +- .../low_precision_transformations/src/squeeze.cpp | 2 +- .../src/strided_slice.cpp | 2 +- .../low_precision_transformations/src/subtract.cpp | 2 +- .../src/subtract_multiply_to_multiply_add.cpp | 2 +- .../src/transparent_base_transformation.cpp | 2 +- .../low_precision_transformations/src/transpose.cpp | 2 +- .../low_precision_transformations/src/unsqueeze.cpp | 2 +- 76 files changed, 88 insertions(+), 82 deletions(-) diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/add.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/add.hpp index ede29a848cc191..92caba9f382a5f 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/add.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/add.hpp @@ -15,7 +15,7 @@ class LP_TRANSFORMATIONS_API AddTransformation : public EltwiseBaseTransformatio public: NGRAPH_RTTI_DECLARATION; AddTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/avg_pool.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/avg_pool.hpp index 1733ac0ed7c4f4..2d37f030ae30a0 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/avg_pool.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/avg_pool.hpp @@ -15,7 +15,7 @@ class LP_TRANSFORMATIONS_API AvgPoolTransformation : public LayerTransformation public: NGRAPH_RTTI_DECLARATION; AvgPoolTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/clamp.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/clamp.hpp index 0e62b0b645e296..a3cf76a1284470 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/clamp.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/clamp.hpp @@ -16,7 +16,7 @@ class LP_TRANSFORMATIONS_API ClampTransformation : public LayerTransformation { public: NGRAPH_RTTI_DECLARATION; ClampTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher& m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher& m) override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/concat.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/concat.hpp index dae6cb85a9865a..d2d8a453647955 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/concat.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/concat.hpp @@ -23,7 +23,7 @@ class LP_TRANSFORMATIONS_API ConcatTransformation : public LayerTransformation { public: NGRAPH_RTTI_DECLARATION; ConcatTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/convert.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/convert.hpp index 415830c47a2f90..cf7299c9def383 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/convert.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/convert.hpp @@ -15,7 +15,7 @@ class LP_TRANSFORMATIONS_API ConvertTransformation : public LayerTransformation public: NGRAPH_RTTI_DECLARATION; ConvertTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/convolution.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/convolution.hpp index 19e8e7868d125b..5542d04d70adb3 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/convolution.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/convolution.hpp @@ -15,7 +15,7 @@ class LP_TRANSFORMATIONS_API ConvolutionTransformation : public WeightableLayerT public: NGRAPH_RTTI_DECLARATION; ConvolutionTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool isQuantized(const std::shared_ptr& layer) const noexcept override; static bool isQuantizedStatic(const std::shared_ptr& layer) noexcept; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/convolution_backprop_data.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/convolution_backprop_data.hpp index 31dc9c417be5b8..2f1b2a4e0705bc 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/convolution_backprop_data.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/convolution_backprop_data.hpp @@ -15,7 +15,7 @@ class LP_TRANSFORMATIONS_API ConvolutionBackpropDataTransformation : public Weig public: ConvolutionBackpropDataTransformation(const Params& params = Params()); //void registerMatcherIn(GraphRewrite& pass, TransformationContext& context) const override; - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; bool isQuantized(const std::shared_ptr& layer) const noexcept override; static bool isQuantizedStatic(const std::shared_ptr& layer) noexcept; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/depth_to_space.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/depth_to_space.hpp index 640ce710eada29..b02ead7321b622 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/depth_to_space.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/depth_to_space.hpp @@ -14,7 +14,7 @@ class LP_TRANSFORMATIONS_API DepthToSpaceTransformation : public TransparentBase public: NGRAPH_RTTI_DECLARATION; DepthToSpaceTransformation(const Params& params = Params()); - bool transform(TransformationContext &context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext &context, ngraph::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/fake_quantize.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/fake_quantize.hpp index 69fb8159dbc6d5..5e29b04adffb81 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/fake_quantize.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/fake_quantize.hpp @@ -17,13 +17,16 @@ class LP_TRANSFORMATIONS_API FakeQuantizeTransformation : public LayerTransforma public: NGRAPH_RTTI_DECLARATION; FakeQuantizeTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; static bool checkElementwise(const std::shared_ptr& eltwise); private: - std::shared_ptr fuseElementwise(TransformationContext& context, const std::shared_ptr& fakeQuantize) const; + std::shared_ptr fuseElementwise( + TransformationContext& context, + MatcherPass& matcherPass, + const std::shared_ptr& fakeQuantize) const; }; } // namespace low_precision diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/fake_quantize_decomposition.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/fake_quantize_decomposition.hpp index b1ee411e75d0dc..45948ca32b72ad 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/fake_quantize_decomposition.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/fake_quantize_decomposition.hpp @@ -17,7 +17,7 @@ class LP_TRANSFORMATIONS_API FakeQuantizeDecompositionTransformation : public La public: NGRAPH_RTTI_DECLARATION; FakeQuantizeDecompositionTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/fold_convert.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/fold_convert.hpp index 2f8aa07ed134a6..4390b7290e2f60 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/fold_convert.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/fold_convert.hpp @@ -16,7 +16,7 @@ class LP_TRANSFORMATIONS_API FoldConvertTransformation : public LayerTransformat public: NGRAPH_RTTI_DECLARATION; FoldConvertTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/fold_fake_quantize.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/fold_fake_quantize.hpp index 921aa82aab97ab..7f2862fc942288 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/fold_fake_quantize.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/fold_fake_quantize.hpp @@ -15,7 +15,7 @@ class LP_TRANSFORMATIONS_API FoldFakeQuantizeTransformation : public LayerTransf public: NGRAPH_RTTI_DECLARATION; FoldFakeQuantizeTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/fuse_convert.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/fuse_convert.hpp index 441734310a89ad..4ccc59808ad129 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/fuse_convert.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/fuse_convert.hpp @@ -16,7 +16,7 @@ class LP_TRANSFORMATIONS_API FuseConvertTransformation : public LayerTransformat public: NGRAPH_RTTI_DECLARATION; FuseConvertTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/fuse_fake_quantize.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/fuse_fake_quantize.hpp index 3b29ea02cf0bc0..b752df52a494cd 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/fuse_fake_quantize.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/fuse_fake_quantize.hpp @@ -16,7 +16,7 @@ class LP_TRANSFORMATIONS_API FuseFakeQuantizeTransformation : public LayerTransf public: NGRAPH_RTTI_DECLARATION; FuseFakeQuantizeTransformation(const Params& params); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; private: diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/fuse_multiply_to_fake_quantize.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/fuse_multiply_to_fake_quantize.hpp index 6e6e4011db9759..d43aa87441eb29 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/fuse_multiply_to_fake_quantize.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/fuse_multiply_to_fake_quantize.hpp @@ -16,7 +16,7 @@ class LP_TRANSFORMATIONS_API FuseMultiplyToFakeQuantizeTransformation : public L public: NGRAPH_RTTI_DECLARATION; FuseMultiplyToFakeQuantizeTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/fuse_subtract_to_fake_quantize.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/fuse_subtract_to_fake_quantize.hpp index 06da1b56c40ba4..80d6f22f785eff 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/fuse_subtract_to_fake_quantize.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/fuse_subtract_to_fake_quantize.hpp @@ -16,7 +16,7 @@ class LP_TRANSFORMATIONS_API FuseSubtractToFakeQuantizeTransformation : public L public: NGRAPH_RTTI_DECLARATION; FuseSubtractToFakeQuantizeTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/group_convolution.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/group_convolution.hpp index bc50bf6b42d85a..d53c37b8df93b8 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/group_convolution.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/group_convolution.hpp @@ -15,7 +15,7 @@ class LP_TRANSFORMATIONS_API GroupConvolutionTransformation : public Convolution public: NGRAPH_RTTI_DECLARATION; GroupConvolutionTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool isQuantized(const std::shared_ptr& layer) const noexcept override; static bool isQuantizedStatic(const std::shared_ptr& layer) noexcept; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/interpolate.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/interpolate.hpp index 840d09b6a4106a..9d454e59542dd8 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/interpolate.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/interpolate.hpp @@ -14,7 +14,7 @@ class LP_TRANSFORMATIONS_API InterpolateTransformation : public LayerTransformat public: NGRAPH_RTTI_DECLARATION; InterpolateTransformation(const Params& params = Params()); - bool transform(TransformationContext &context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext &context, ngraph::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/layer_transformation.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/layer_transformation.hpp index f9600aca27c983..40807928305e85 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/layer_transformation.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/layer_transformation.hpp @@ -195,7 +195,7 @@ class LP_TRANSFORMATIONS_API LayerTransformation : public ngraph::pass::MatcherP LayerTransformation(const Params& params); virtual ~LayerTransformation() = default; - virtual bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const = 0; + virtual bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) = 0; void setContext(TransformationContext* context) noexcept; @@ -265,7 +265,7 @@ class LP_TRANSFORMATIONS_API LayerTransformation : public ngraph::pass::MatcherP std::shared_ptr lastNode, std::string originalName) const; - void addPattern(ngraph::pass::GraphRewrite& pass, TransformationContext& context, std::shared_ptr patternRoot) const; + void addPattern(ngraph::pass::GraphRewrite& pass, TransformationContext& context, std::shared_ptr patternRoot); //TODO: replace with canBeTransformed when quantization by special dimension is supported for all transformations bool canBeTransformedSpatialDimension(const TransformationContext& context, std::shared_ptr layer) const; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/mat_mul.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/mat_mul.hpp index 105c99843b188e..067f82ea59b28b 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/mat_mul.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/mat_mul.hpp @@ -15,7 +15,7 @@ class LP_TRANSFORMATIONS_API MatMulTransformation : public LayerTransformation { public: NGRAPH_RTTI_DECLARATION; MatMulTransformation(const Params& params = Params()); - bool transform(TransformationContext &context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext &context, ngraph::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; static bool is3DTensorOnActivations(const std::shared_ptr& node); diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/max_pool.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/max_pool.hpp index 40d01d1997f330..ca2b8a08272817 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/max_pool.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/max_pool.hpp @@ -17,7 +17,7 @@ class LP_TRANSFORMATIONS_API MaxPoolTransformation : public LayerTransformation NGRAPH_RTTI_DECLARATION; MaxPoolTransformation(const Params& params = Params()); bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/multiply.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/multiply.hpp index 157d4251e83a90..da226fe263b757 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/multiply.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/multiply.hpp @@ -15,7 +15,7 @@ class LP_TRANSFORMATIONS_API MultiplyTransformation : public EltwiseBaseTransfor public: NGRAPH_RTTI_DECLARATION; MultiplyTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; }; } // namespace low_precision diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/multiply_to_group_convolution.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/multiply_to_group_convolution.hpp index afa6f6a1e3d4d9..f25ba9c9284fc6 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/multiply_to_group_convolution.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/multiply_to_group_convolution.hpp @@ -20,7 +20,7 @@ class LP_TRANSFORMATIONS_API MultiplyToGroupConvolutionTransformation : public L const Params& params = Params(), const OperationPrecisionRestriction::PrecisionsByPort& restrictions = {}); ~MultiplyToGroupConvolutionTransformation() override {} - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; bool isQuantized(const std::shared_ptr& layer) const noexcept override; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/mvn.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/mvn.hpp index dc93cdf61f2cdb..42ddd6f0b620a1 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/mvn.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/mvn.hpp @@ -14,7 +14,7 @@ class LP_TRANSFORMATIONS_API MVNTransformation : public LayerTransformation { public: NGRAPH_RTTI_DECLARATION; MVNTransformation(const Params& params = Params()); - bool transform(TransformationContext &context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext &context, ngraph::pattern::Matcher &m) override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/normalize_l2.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/normalize_l2.hpp index ea294d1a4af3bb..88a113cb38a49d 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/normalize_l2.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/normalize_l2.hpp @@ -14,7 +14,7 @@ class LP_TRANSFORMATIONS_API NormalizeL2Transformation : public LayerTransformat public: NGRAPH_RTTI_DECLARATION; NormalizeL2Transformation(const Params& params = Params()); - bool transform(TransformationContext &context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext &context, ngraph::pattern::Matcher &m) override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/prelu.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/prelu.hpp index 51b6221e68fce4..e58d4b25615752 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/prelu.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/prelu.hpp @@ -16,7 +16,7 @@ class LP_TRANSFORMATIONS_API PReluTransformation : public LayerTransformation { public: NGRAPH_RTTI_DECLARATION; PReluTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/reduce_base_transformation.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/reduce_base_transformation.hpp index 949ff08ec40564..0b9782e4eb207a 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/reduce_base_transformation.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/reduce_base_transformation.hpp @@ -22,7 +22,7 @@ namespace low_precision { class LP_TRANSFORMATIONS_API ReduceBaseTransformation : public LayerTransformation { public: ReduceBaseTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher& m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher& m) override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr reduce) const override; protected: diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/relu.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/relu.hpp index 959ca5a25845e7..1f7489a73d8337 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/relu.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/relu.hpp @@ -16,7 +16,7 @@ class LP_TRANSFORMATIONS_API ReluTransformation : public LayerTransformation { public: NGRAPH_RTTI_DECLARATION; ReluTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/reshape.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/reshape.hpp index 091014600794f5..4f9f5fe0e2800f 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/reshape.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/reshape.hpp @@ -15,7 +15,7 @@ class LP_TRANSFORMATIONS_API ReshapeTransformation : public LayerTransformation public: NGRAPH_RTTI_DECLARATION; ReshapeTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/shuffle_channels.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/shuffle_channels.hpp index 8ab303172a8c75..ab28d754598e67 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/shuffle_channels.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/shuffle_channels.hpp @@ -15,7 +15,7 @@ class LP_TRANSFORMATIONS_API ShuffleChannelsTransformation : public LayerTransfo public: NGRAPH_RTTI_DECLARATION; ShuffleChannelsTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher& m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher& m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/split.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/split.hpp index e13551b78899a7..d4f2c72b8beb7b 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/split.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/split.hpp @@ -17,7 +17,7 @@ class LP_TRANSFORMATIONS_API SplitTransformation : public LayerTransformation { public: NGRAPH_RTTI_DECLARATION; SplitTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher& m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher& m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; void updateOutputs( diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/squeeze.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/squeeze.hpp index 2af21dd22bb626..fab050564c8bc0 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/squeeze.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/squeeze.hpp @@ -15,7 +15,7 @@ class LP_TRANSFORMATIONS_API SqueezeTransformation : public LayerTransformation public: NGRAPH_RTTI_DECLARATION; SqueezeTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/strided_slice.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/strided_slice.hpp index dfc21374e98321..5a0520f54ae9b1 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/strided_slice.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/strided_slice.hpp @@ -16,7 +16,7 @@ class LP_TRANSFORMATIONS_API StridedSliceTransformation : public LayerTransforma public: NGRAPH_RTTI_DECLARATION; StridedSliceTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher& m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher& m) override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/subtract.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/subtract.hpp index a9514502bb7fa2..56c66d9945040b 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/subtract.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/subtract.hpp @@ -15,7 +15,7 @@ class LP_TRANSFORMATIONS_API SubtractTransformation : public LayerTransformation public: NGRAPH_RTTI_DECLARATION; SubtractTransformation(const Params& params); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; }; } // namespace low_precision diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/subtract_multiply_to_multiply_add.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/subtract_multiply_to_multiply_add.hpp index 36f05899e739f6..cee4f4f5d627e1 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/subtract_multiply_to_multiply_add.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/subtract_multiply_to_multiply_add.hpp @@ -16,7 +16,7 @@ class LP_TRANSFORMATIONS_API SubtractMultiplyToMultiplyAddTransformation : publi public: NGRAPH_RTTI_DECLARATION; SubtractMultiplyToMultiplyAddTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/transparent_base_transformation.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/transparent_base_transformation.hpp index b3698a95b1f7ac..05b0dbebc0191f 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/transparent_base_transformation.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/transparent_base_transformation.hpp @@ -16,7 +16,7 @@ class LP_TRANSFORMATIONS_API TransparentBaseTransformation : public LayerTransfo public: TransparentBaseTransformation(const Params& params) : LayerTransformation(params) {} ~TransparentBaseTransformation() override {}; - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/transpose.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/transpose.hpp index 92b10a237ec497..d22fcc8ed8cf36 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/transpose.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/transpose.hpp @@ -16,7 +16,7 @@ class LP_TRANSFORMATIONS_API TransposeTransformation : public LayerTransformatio public: NGRAPH_RTTI_DECLARATION; TransposeTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; }; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/unsqueeze.hpp b/inference-engine/src/low_precision_transformations/include/low_precision/unsqueeze.hpp index 153c9cff86c129..580c09ad80bcce 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/unsqueeze.hpp +++ b/inference-engine/src/low_precision_transformations/include/low_precision/unsqueeze.hpp @@ -15,7 +15,7 @@ class LP_TRANSFORMATIONS_API UnsqueezeTransformation : public LayerTransformatio public: NGRAPH_RTTI_DECLARATION; UnsqueezeTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) const override; + bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; }; diff --git a/inference-engine/src/low_precision_transformations/src/add.cpp b/inference-engine/src/low_precision_transformations/src/add.cpp index cd50de3d7a25e3..f7254098c89208 100644 --- a/inference-engine/src/low_precision_transformations/src/add.cpp +++ b/inference-engine/src/low_precision_transformations/src/add.cpp @@ -106,7 +106,7 @@ AddTransformation::AddTransformation(const Params& params) : EltwiseBaseTransfor this->register_matcher(m, callback); } -bool AddTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool AddTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { std::shared_ptr op = as_type_ptr(m.get_match_root()); if ((op == nullptr) || (!canBeTransformed(context, op))) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/avg_pool.cpp b/inference-engine/src/low_precision_transformations/src/avg_pool.cpp index d23387c2cb894b..d007f2b9bcd150 100644 --- a/inference-engine/src/low_precision_transformations/src/avg_pool.cpp +++ b/inference-engine/src/low_precision_transformations/src/avg_pool.cpp @@ -33,7 +33,7 @@ AvgPoolTransformation::AvgPoolTransformation(const Params& params) : LayerTransf this->register_matcher(m, callback); } -bool AvgPoolTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool AvgPoolTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { if (!canBeTransformed(context, m.get_match_root())) { return false; } diff --git a/inference-engine/src/low_precision_transformations/src/clamp.cpp b/inference-engine/src/low_precision_transformations/src/clamp.cpp index a7411ed64ce518..9a19856168497d 100644 --- a/inference-engine/src/low_precision_transformations/src/clamp.cpp +++ b/inference-engine/src/low_precision_transformations/src/clamp.cpp @@ -31,7 +31,7 @@ ClampTransformation::ClampTransformation(const Params& params) : LayerTransforma this->register_matcher(m, callback); } -bool ClampTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher& m) const { +bool ClampTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher& m) { auto subWithTheSameValues = [](std::shared_ptr sub) { if (sub == nullptr) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/concat.cpp b/inference-engine/src/low_precision_transformations/src/concat.cpp index 1452ad33bdaa9e..6729966a193aa7 100644 --- a/inference-engine/src/low_precision_transformations/src/concat.cpp +++ b/inference-engine/src/low_precision_transformations/src/concat.cpp @@ -41,7 +41,7 @@ ConcatTransformation::ConcatTransformation(const Params& params) : LayerTransfor this->register_matcher(m, callback); } -bool ConcatTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool ConcatTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { std::shared_ptr concat = ngraph::as_type_ptr(m.get_match_root()); if (!canBeTransformed(context, concat)) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/convert.cpp b/inference-engine/src/low_precision_transformations/src/convert.cpp index 0113a0d8c257c8..2807c6a431b71c 100644 --- a/inference-engine/src/low_precision_transformations/src/convert.cpp +++ b/inference-engine/src/low_precision_transformations/src/convert.cpp @@ -36,7 +36,7 @@ ConvertTransformation::ConvertTransformation(const Params& params) : LayerTransf this->register_matcher(m, callback); } -bool ConvertTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool ConvertTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { std::shared_ptr convert = as_type_ptr(m.get_match_root()); if (!convert) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/convolution.cpp b/inference-engine/src/low_precision_transformations/src/convolution.cpp index b21f473e7c3514..fecdaf6290d4ef 100644 --- a/inference-engine/src/low_precision_transformations/src/convolution.cpp +++ b/inference-engine/src/low_precision_transformations/src/convolution.cpp @@ -51,7 +51,7 @@ bool ConvolutionTransformation::isQuantizedStatic(const std::shared_ptrregister_matcher(m, callback); } -bool DepthToSpaceTransformation::transform(TransformationContext &context, ngraph::pattern::Matcher &m) const { +bool DepthToSpaceTransformation::transform(TransformationContext &context, ngraph::pattern::Matcher &m) { std::shared_ptr depthToSpace = m.get_match_root(); if (!canBeTransformed(context, depthToSpace)) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/fake_quantize.cpp b/inference-engine/src/low_precision_transformations/src/fake_quantize.cpp index 4941aae9fdb7ce..72c4dab06d312e 100644 --- a/inference-engine/src/low_precision_transformations/src/fake_quantize.cpp +++ b/inference-engine/src/low_precision_transformations/src/fake_quantize.cpp @@ -33,7 +33,7 @@ FakeQuantizeTransformation::FakeQuantizeTransformation(const Params& params) : L this->register_matcher(m, callback); } -bool FakeQuantizeTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool FakeQuantizeTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { std::shared_ptr layer = std::dynamic_pointer_cast(m.get_match_root()); if (!QuantizationDetails::outputLayoutIsSupported(layer)) { return false; @@ -42,8 +42,7 @@ bool FakeQuantizeTransformation::transform(TransformationContext& context, ngrap bool wasHandled = false; std::shared_ptr fakeQuantize = layer; do { - layer = fakeQuantize; - fakeQuantize = fuseElementwise(context, fakeQuantize); + fakeQuantize = fuseElementwise(context, *this, fakeQuantize); wasHandled = wasHandled || (fakeQuantize != nullptr); } while (fakeQuantize != nullptr); @@ -128,6 +127,7 @@ bool FakeQuantizeTransformation::checkElementwise(const std::shared_ptr& e std::shared_ptr FakeQuantizeTransformation::fuseElementwise( TransformationContext& context, + MatcherPass& matcherPass, const std::shared_ptr& fakeQuantize) const { const std::shared_ptr eltwise = fakeQuantize->get_input_node_shared_ptr(0); @@ -190,12 +190,15 @@ std::shared_ptr FakeQuantizeTransformation::fuseElementwis const auto data = fq::getData(eltwise); const size_t outputIdx = NetworkHelper::getParentOutputIndex(data, eltwise); - std::shared_ptr newFakeQuantize = as_type_ptr(fakeQuantize->clone_with_new_inputs({ + + std::shared_ptr newFakeQuantize = matcherPass.register_new_node( data->output(outputIdx), inputLowConst_f32, inputHighConst_f32, foldConvert(fakeQuantize->input_value(3), deqPrecision), - foldConvert(fakeQuantize->input_value(4), deqPrecision) })); + foldConvert(fakeQuantize->input_value(4), deqPrecision), + fakeQuantize->get_levels(), + fakeQuantize->get_auto_broadcast()); replace_node(fakeQuantize, newFakeQuantize); ngraph::copy_runtime_info({ fakeQuantize, eltwise }, newFakeQuantize); diff --git a/inference-engine/src/low_precision_transformations/src/fake_quantize_decomposition.cpp b/inference-engine/src/low_precision_transformations/src/fake_quantize_decomposition.cpp index 4e8893938fadfa..b814331d4e4c44 100644 --- a/inference-engine/src/low_precision_transformations/src/fake_quantize_decomposition.cpp +++ b/inference-engine/src/low_precision_transformations/src/fake_quantize_decomposition.cpp @@ -240,7 +240,7 @@ std::shared_ptr decomposeFakeQuantize( } // namespace fq_decomposition -bool FakeQuantizeDecompositionTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher& m) const { +bool FakeQuantizeDecompositionTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher& m) { auto layer = as_type_ptr(m.get_match_root()); if (!NetworkHelper::isQuantizeSupported(layer)) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/fold_convert.cpp b/inference-engine/src/low_precision_transformations/src/fold_convert.cpp index 29d3871a2d3f38..d55b6f8a2e7e6a 100644 --- a/inference-engine/src/low_precision_transformations/src/fold_convert.cpp +++ b/inference-engine/src/low_precision_transformations/src/fold_convert.cpp @@ -30,7 +30,7 @@ FoldConvertTransformation::FoldConvertTransformation(const Params& params) : Lay this->register_matcher(matcher, callback); } -bool FoldConvertTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool FoldConvertTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { const auto subtract = m.get_match_root(); if (!canBeTransformed(context, subtract)) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/fold_fake_quantize.cpp b/inference-engine/src/low_precision_transformations/src/fold_fake_quantize.cpp index 799a2d2caaade8..9e691cf2e4efac 100644 --- a/inference-engine/src/low_precision_transformations/src/fold_fake_quantize.cpp +++ b/inference-engine/src/low_precision_transformations/src/fold_fake_quantize.cpp @@ -32,7 +32,7 @@ FoldFakeQuantizeTransformation::FoldFakeQuantizeTransformation(const Params& par this->register_matcher(m, callback); } -bool FoldFakeQuantizeTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool FoldFakeQuantizeTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { const auto fakeQuantize = as_type_ptr(m.get_match_root()); if (fakeQuantize == nullptr) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/fuse_convert.cpp b/inference-engine/src/low_precision_transformations/src/fuse_convert.cpp index 61d0f904b9c1e1..ee6fea2717e73c 100644 --- a/inference-engine/src/low_precision_transformations/src/fuse_convert.cpp +++ b/inference-engine/src/low_precision_transformations/src/fuse_convert.cpp @@ -56,7 +56,7 @@ std::shared_ptr removeConvertIfPossibleForSubtract( return newSubtract; } -bool FuseConvertTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool FuseConvertTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { const auto op = m.get_match_root(); if (!canBeTransformed(context, op)) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/fuse_fake_quantize.cpp b/inference-engine/src/low_precision_transformations/src/fuse_fake_quantize.cpp index 5781c487ebe083..3380cca2d6d485 100644 --- a/inference-engine/src/low_precision_transformations/src/fuse_fake_quantize.cpp +++ b/inference-engine/src/low_precision_transformations/src/fuse_fake_quantize.cpp @@ -30,7 +30,7 @@ FuseFakeQuantizeTransformation::FuseFakeQuantizeTransformation(const Params& par this->register_matcher(m, callback); } -bool FuseFakeQuantizeTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool FuseFakeQuantizeTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { std::shared_ptr fakeQuantize = as_type_ptr(m.get_match_root()); do { fakeQuantize = handle(context, fakeQuantize); diff --git a/inference-engine/src/low_precision_transformations/src/fuse_multiply_to_fake_quantize.cpp b/inference-engine/src/low_precision_transformations/src/fuse_multiply_to_fake_quantize.cpp index 58e3abcf143c81..d220cfcb14c7a0 100644 --- a/inference-engine/src/low_precision_transformations/src/fuse_multiply_to_fake_quantize.cpp +++ b/inference-engine/src/low_precision_transformations/src/fuse_multiply_to_fake_quantize.cpp @@ -31,7 +31,7 @@ FuseMultiplyToFakeQuantizeTransformation::FuseMultiplyToFakeQuantizeTransformati this->register_matcher(m, callback); } -bool FuseMultiplyToFakeQuantizeTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool FuseMultiplyToFakeQuantizeTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { const auto multiply = m.get_match_root(); if (!canBeTransformed(context, multiply)) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/fuse_subtract_to_fake_quantize.cpp b/inference-engine/src/low_precision_transformations/src/fuse_subtract_to_fake_quantize.cpp index 112b8e40d2811e..a53f28a48db63a 100644 --- a/inference-engine/src/low_precision_transformations/src/fuse_subtract_to_fake_quantize.cpp +++ b/inference-engine/src/low_precision_transformations/src/fuse_subtract_to_fake_quantize.cpp @@ -30,7 +30,7 @@ FuseSubtractToFakeQuantizeTransformation::FuseSubtractToFakeQuantizeTransformati this->register_matcher(m, callback); } -bool FuseSubtractToFakeQuantizeTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool FuseSubtractToFakeQuantizeTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { const auto subtract = m.get_match_root(); if (!canBeTransformed(context, subtract)) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/group_convolution.cpp b/inference-engine/src/low_precision_transformations/src/group_convolution.cpp index 48181f8b5cc4e6..91aacbe95721c1 100644 --- a/inference-engine/src/low_precision_transformations/src/group_convolution.cpp +++ b/inference-engine/src/low_precision_transformations/src/group_convolution.cpp @@ -36,7 +36,7 @@ bool GroupConvolutionTransformation::isQuantized(const std::shared_ptrregister_matcher(matcher, callback); } -bool InterpolateTransformation::transform(TransformationContext &context, ngraph::pattern::Matcher &m) const { +bool InterpolateTransformation::transform(TransformationContext &context, ngraph::pattern::Matcher &m) { std::shared_ptr interpolate = m.get_match_root(); if (!canBeTransformed(context, m.get_match_root())) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/layer_transformation.cpp b/inference-engine/src/low_precision_transformations/src/layer_transformation.cpp index 6a26a8aeb3516f..cfe7bb955c82a7 100644 --- a/inference-engine/src/low_precision_transformations/src/layer_transformation.cpp +++ b/inference-engine/src/low_precision_transformations/src/layer_transformation.cpp @@ -334,7 +334,7 @@ void LayerTransformation::updateOutput( } } -void LayerTransformation::addPattern(ngraph::pass::GraphRewrite& pass, TransformationContext& context, std::shared_ptr patternRoot) const { +void LayerTransformation::addPattern(ngraph::pass::GraphRewrite& pass, TransformationContext& context, std::shared_ptr patternRoot) { ngraph::graph_rewrite_callback internal_callback = [this, &context](ngraph::pattern::Matcher &m) { const bool result = transform(context, m); (void)result; diff --git a/inference-engine/src/low_precision_transformations/src/mat_mul.cpp b/inference-engine/src/low_precision_transformations/src/mat_mul.cpp index 7bb44186381bd1..63cb7abf75677c 100644 --- a/inference-engine/src/low_precision_transformations/src/mat_mul.cpp +++ b/inference-engine/src/low_precision_transformations/src/mat_mul.cpp @@ -39,7 +39,7 @@ MatMulTransformation::MatMulTransformation(const Params& params) : LayerTransfor this->register_matcher(m, callback); } -bool MatMulTransformation::transform(TransformationContext &context, ngraph::pattern::Matcher &m) const { +bool MatMulTransformation::transform(TransformationContext &context, ngraph::pattern::Matcher &m) { std::shared_ptr matMul = as_type_ptr(m.get_match_root()); if ((matMul == nullptr) || !canBeTransformed(context, matMul)) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/max_pool.cpp b/inference-engine/src/low_precision_transformations/src/max_pool.cpp index 248bb00a18411d..f0b40fd9ecd6db 100644 --- a/inference-engine/src/low_precision_transformations/src/max_pool.cpp +++ b/inference-engine/src/low_precision_transformations/src/max_pool.cpp @@ -51,7 +51,7 @@ bool MaxPoolTransformation::canBeTransformed(const TransformationContext& contex return true; } -bool MaxPoolTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool MaxPoolTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { if (!canBeTransformed(context, m.get_match_root())) { return false; } diff --git a/inference-engine/src/low_precision_transformations/src/multiply.cpp b/inference-engine/src/low_precision_transformations/src/multiply.cpp index 4272045ee226a7..1880029fdd7414 100644 --- a/inference-engine/src/low_precision_transformations/src/multiply.cpp +++ b/inference-engine/src/low_precision_transformations/src/multiply.cpp @@ -39,7 +39,7 @@ MultiplyTransformation::MultiplyTransformation(const Params& params) : EltwiseBa this->register_matcher(m, callback); } -bool MultiplyTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool MultiplyTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { auto multiply = m.get_match_root(); if (!LayerTransformation::canBeTransformed(context, multiply)) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/multiply_to_group_convolution.cpp b/inference-engine/src/low_precision_transformations/src/multiply_to_group_convolution.cpp index 131808b402a7ce..a8b230eac8db07 100644 --- a/inference-engine/src/low_precision_transformations/src/multiply_to_group_convolution.cpp +++ b/inference-engine/src/low_precision_transformations/src/multiply_to_group_convolution.cpp @@ -31,7 +31,7 @@ MultiplyToGroupConvolutionTransformation::MultiplyToGroupConvolutionTransformati this->register_matcher(m, callback); } -bool MultiplyToGroupConvolutionTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool MultiplyToGroupConvolutionTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { const auto multiply = m.get_match_root(); if (!canBeTransformed(context, multiply)) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/mvn.cpp b/inference-engine/src/low_precision_transformations/src/mvn.cpp index f45b1b8d848d44..6ce59766542668 100644 --- a/inference-engine/src/low_precision_transformations/src/mvn.cpp +++ b/inference-engine/src/low_precision_transformations/src/mvn.cpp @@ -105,7 +105,7 @@ bool MVNTransformation::canBeTransformed(const TransformationContext& context, s return perTensor && isScalarScales; } -bool MVNTransformation::transform(TransformationContext &context, ngraph::pattern::Matcher &m) const { +bool MVNTransformation::transform(TransformationContext &context, ngraph::pattern::Matcher &m) { std::shared_ptr operation = m.get_match_root(); if (!canBeTransformed(context, operation)) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/normalize_l2.cpp b/inference-engine/src/low_precision_transformations/src/normalize_l2.cpp index ae37fa3dee97be..cd54856d14887b 100644 --- a/inference-engine/src/low_precision_transformations/src/normalize_l2.cpp +++ b/inference-engine/src/low_precision_transformations/src/normalize_l2.cpp @@ -97,7 +97,7 @@ bool NormalizeL2Transformation::canBeTransformed(const TransformationContext& co return true; } -bool NormalizeL2Transformation::transform(TransformationContext &context, ngraph::pattern::Matcher &m) const { +bool NormalizeL2Transformation::transform(TransformationContext &context, ngraph::pattern::Matcher &m) { std::shared_ptr operation = m.get_match_root(); if (!canBeTransformed(context, operation)) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/prelu.cpp b/inference-engine/src/low_precision_transformations/src/prelu.cpp index 38fb2b6ceee291..eccffff8dae690 100644 --- a/inference-engine/src/low_precision_transformations/src/prelu.cpp +++ b/inference-engine/src/low_precision_transformations/src/prelu.cpp @@ -34,7 +34,7 @@ PReluTransformation::PReluTransformation(const Params& params) : LayerTransforma this->register_matcher(m, callback); } -bool PReluTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool PReluTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { std::shared_ptr prelu = m.get_match_root(); if (!canBeTransformed(context, prelu)) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/reduce_base_transformation.cpp b/inference-engine/src/low_precision_transformations/src/reduce_base_transformation.cpp index 65dfa8e12f05a7..92a94620f04cbc 100644 --- a/inference-engine/src/low_precision_transformations/src/reduce_base_transformation.cpp +++ b/inference-engine/src/low_precision_transformations/src/reduce_base_transformation.cpp @@ -13,7 +13,7 @@ namespace low_precision { ReduceBaseTransformation::ReduceBaseTransformation(const Params& params) : LayerTransformation(params) {} -bool ReduceBaseTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher& m) const { +bool ReduceBaseTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher& m) { if (!canBeTransformed(context, m.get_match_root())) { return false; } diff --git a/inference-engine/src/low_precision_transformations/src/relu.cpp b/inference-engine/src/low_precision_transformations/src/relu.cpp index c45b8cc3346733..da1af447b0d5e1 100644 --- a/inference-engine/src/low_precision_transformations/src/relu.cpp +++ b/inference-engine/src/low_precision_transformations/src/relu.cpp @@ -34,7 +34,7 @@ ReluTransformation::ReluTransformation(const Params& params) : LayerTransformati this->register_matcher(m, callback); } -bool ReluTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool ReluTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { std::shared_ptr relu = m.get_match_root(); if (!LayerTransformation::canBeTransformed(context, relu)) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/reshape.cpp b/inference-engine/src/low_precision_transformations/src/reshape.cpp index 7ed569174e53bc..241023a5636623 100644 --- a/inference-engine/src/low_precision_transformations/src/reshape.cpp +++ b/inference-engine/src/low_precision_transformations/src/reshape.cpp @@ -157,7 +157,7 @@ void reshapeDequantizationConstant(const std::shared_ptr& resha } } -bool ReshapeTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool ReshapeTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { std::shared_ptr reshape = as_type_ptr(m.get_match_root()); if (NetworkHelper::isConstantPath(reshape)) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/shuffle_channels.cpp b/inference-engine/src/low_precision_transformations/src/shuffle_channels.cpp index a903e5acb03692..bef63c53f10b53 100644 --- a/inference-engine/src/low_precision_transformations/src/shuffle_channels.cpp +++ b/inference-engine/src/low_precision_transformations/src/shuffle_channels.cpp @@ -33,7 +33,7 @@ ShuffleChannelsTransformation::ShuffleChannelsTransformation(const Params& param this->register_matcher(m, callback); } -bool ShuffleChannelsTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher& m) const { +bool ShuffleChannelsTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher& m) { if (!canBeTransformed(context, m.get_match_root())) { return false; } diff --git a/inference-engine/src/low_precision_transformations/src/split.cpp b/inference-engine/src/low_precision_transformations/src/split.cpp index 256bc3d31a5b6e..cac139399687cd 100644 --- a/inference-engine/src/low_precision_transformations/src/split.cpp +++ b/inference-engine/src/low_precision_transformations/src/split.cpp @@ -31,7 +31,7 @@ SplitTransformation::SplitTransformation(const Params& params) : LayerTransforma this->register_matcher(m, callback); } -bool SplitTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher& m) const { +bool SplitTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher& m) { if (!canBeTransformed(context, m.get_match_root())) { return false; } diff --git a/inference-engine/src/low_precision_transformations/src/squeeze.cpp b/inference-engine/src/low_precision_transformations/src/squeeze.cpp index 83ea10810c9c33..d59127010e4400 100644 --- a/inference-engine/src/low_precision_transformations/src/squeeze.cpp +++ b/inference-engine/src/low_precision_transformations/src/squeeze.cpp @@ -33,7 +33,7 @@ SqueezeTransformation::SqueezeTransformation(const Params& params) : LayerTransf this->register_matcher(m, callback); } -bool SqueezeTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool SqueezeTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { if (!canBeTransformed(context, m.get_match_root())) { return false; } diff --git a/inference-engine/src/low_precision_transformations/src/strided_slice.cpp b/inference-engine/src/low_precision_transformations/src/strided_slice.cpp index fb093ae0b1e19c..c2ef06729155eb 100644 --- a/inference-engine/src/low_precision_transformations/src/strided_slice.cpp +++ b/inference-engine/src/low_precision_transformations/src/strided_slice.cpp @@ -88,7 +88,7 @@ StridedSliceTransformation::StridedSliceTransformation(const Params& params) : L this->register_matcher(m, callback); } -bool StridedSliceTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher& m) const { +bool StridedSliceTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher& m) { if (!StridedSliceTransformation::canBeTransformed(context, m.get_match_root())) { return false; } diff --git a/inference-engine/src/low_precision_transformations/src/subtract.cpp b/inference-engine/src/low_precision_transformations/src/subtract.cpp index 77220f500abcdd..1b1db21f30334b 100644 --- a/inference-engine/src/low_precision_transformations/src/subtract.cpp +++ b/inference-engine/src/low_precision_transformations/src/subtract.cpp @@ -41,7 +41,7 @@ SubtractTransformation::SubtractTransformation(const Params& params) : LayerTran this->register_matcher(m, callback); } -bool SubtractTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool SubtractTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { std::shared_ptr subtract = as_type_ptr(m.get_match_root()); if (!canBeTransformed(context, subtract)) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/subtract_multiply_to_multiply_add.cpp b/inference-engine/src/low_precision_transformations/src/subtract_multiply_to_multiply_add.cpp index 916d7eba0e4db3..274da04bf92bcb 100644 --- a/inference-engine/src/low_precision_transformations/src/subtract_multiply_to_multiply_add.cpp +++ b/inference-engine/src/low_precision_transformations/src/subtract_multiply_to_multiply_add.cpp @@ -66,7 +66,7 @@ FakeQuantizeDequantization get(const std::shared_ptr node) { return FakeQuantizeDequantization(dataNode, convert, subtract, subtractConvert, subtractConstant, multiply, multiplyConstant); } -bool SubtractMultiplyToMultiplyAddTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool SubtractMultiplyToMultiplyAddTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { auto multiply = m.get_match_root(); if (!canBeTransformed(context, multiply)) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/transparent_base_transformation.cpp b/inference-engine/src/low_precision_transformations/src/transparent_base_transformation.cpp index b8c75d43619b49..c89ca0e9144c67 100644 --- a/inference-engine/src/low_precision_transformations/src/transparent_base_transformation.cpp +++ b/inference-engine/src/low_precision_transformations/src/transparent_base_transformation.cpp @@ -15,7 +15,7 @@ using namespace ngraph; using namespace ngraph::pass; using namespace ngraph::pass::low_precision; -bool TransparentBaseTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool TransparentBaseTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { auto operation = m.get_match_root(); const std::shared_ptr dequantization = operation->input_value(0).get_node_shared_ptr(); // const std::shared_ptr dequantizationParent = dequantization->input_value(0).get_node_shared_ptr(); diff --git a/inference-engine/src/low_precision_transformations/src/transpose.cpp b/inference-engine/src/low_precision_transformations/src/transpose.cpp index 4f8c0f7ed14194..25d939898d663e 100644 --- a/inference-engine/src/low_precision_transformations/src/transpose.cpp +++ b/inference-engine/src/low_precision_transformations/src/transpose.cpp @@ -86,7 +86,7 @@ void transposeDequantizationConstant(std::shared_ptr& transpose) { } } -bool TransposeTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool TransposeTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { std::shared_ptr transpose = m.get_match_root(); if (!canBeTransformed(context, transpose)) { return false; diff --git a/inference-engine/src/low_precision_transformations/src/unsqueeze.cpp b/inference-engine/src/low_precision_transformations/src/unsqueeze.cpp index 10463c50e7ed4c..323834a42b202c 100644 --- a/inference-engine/src/low_precision_transformations/src/unsqueeze.cpp +++ b/inference-engine/src/low_precision_transformations/src/unsqueeze.cpp @@ -33,7 +33,7 @@ UnsqueezeTransformation::UnsqueezeTransformation(const Params& params) : LayerTr this->register_matcher(m, callback); } -bool UnsqueezeTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) const { +bool UnsqueezeTransformation::transform(TransformationContext& context, ngraph::pattern::Matcher &m) { if (!canBeTransformed(context, m.get_match_root())) { return false; }