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 db16f572224..65cb9694eb8 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 @@ -26,6 +26,7 @@ public: 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 isQuantizedStatic(const std::shared_ptr& layer) noexcept; protected: static bool isHandled( diff --git a/inference-engine/src/low_precision_transformations/src/concat.cpp b/inference-engine/src/low_precision_transformations/src/concat.cpp index 5c0da831b8e..b17846446a1 100644 --- a/inference-engine/src/low_precision_transformations/src/concat.cpp +++ b/inference-engine/src/low_precision_transformations/src/concat.cpp @@ -297,6 +297,22 @@ bool ConcatTransformation::isHandled(const TransformationContext& context, const return false; } +bool ConcatTransformation::isQuantizedStatic(const std::shared_ptr& layer) noexcept { + const auto concat = as_type_ptr(layer); + if (concat == nullptr) { + return false; + } + + const auto axis = concat->get_axis(); + const auto outputRank = concat->get_output_partial_shape(0).rank(); + if (axis < 0 && outputRank.is_dynamic()) { + return false; + } + + const size_t normalizedAxis = ngraph::normalize_axis(concat->get_friendly_name(), axis, outputRank); + return normalizedAxis == 1ul; +} + } // namespace low_precision } // namespace pass } // namespace ngraph diff --git a/inference-engine/src/low_precision_transformations/src/markup_can_be_quantized.cpp b/inference-engine/src/low_precision_transformations/src/markup_can_be_quantized.cpp index 3117efc2deb..10553e07fd7 100644 --- a/inference-engine/src/low_precision_transformations/src/markup_can_be_quantized.cpp +++ b/inference-engine/src/low_precision_transformations/src/markup_can_be_quantized.cpp @@ -7,6 +7,7 @@ #include #include +#include "low_precision/concat.hpp" #include "low_precision/convolution.hpp" #include "low_precision/convolution_backprop_data.hpp" #include "low_precision/group_convolution.hpp" @@ -54,6 +55,12 @@ bool ngraph::pass::low_precision::MarkupCanBeQuantized::run_on_function(std::sha } continue; } + if (const auto concat = std::dynamic_pointer_cast(node)) { + if (!ConcatTransformation::isQuantizedStatic(concat)) { + setEmptyPrecisions(concat); + } + continue; + } } return true; } diff --git a/inference-engine/tests/functional/inference_engine/lp_transformations/concat_transformation.cpp b/inference-engine/tests/functional/inference_engine/lp_transformations/concat_transformation.cpp index 9c539b7504a..b901d86203a 100644 --- a/inference-engine/tests/functional/inference_engine/lp_transformations/concat_transformation.cpp +++ b/inference-engine/tests/functional/inference_engine/lp_transformations/concat_transformation.cpp @@ -230,16 +230,18 @@ TEST_P(ConcatTransformation, CompareFunctions) { auto res = compare_functions(referenceFunction, actualFunction, true, true, false, true, false); ASSERT_TRUE(res.first) << res.second; - const auto actualFakeQuantizes = LayerTransformation::get(actualFunction); - ASSERT_TRUE(checkIfOutputAttributesSharedValuesAreTheSame>(actualFakeQuantizes)) << - "PrecisionsAttribute are not the same"; - ConcatTransformationTestValues testValues = std::get<2>(GetParam()); - if (testValues.checkIntervalsAlignmentAttributes) { - auto operations = LayerTransformation::get(actualFunction); - operations.insert(operations.end(), actualFakeQuantizes.begin(), actualFakeQuantizes.end()); - ASSERT_TRUE(checkIfAttributesSharedValuesAreTheSame>(operations)) << - "IntervalsAlignmentAttribute are not the same"; + const auto actualFakeQuantizes = LayerTransformation::get(actualFunction); + if (testValues.axis == 1) { + ASSERT_TRUE(checkIfOutputAttributesSharedValuesAreTheSame>(actualFakeQuantizes)) << + "PrecisionsAttribute are not the same"; + + if (testValues.checkIntervalsAlignmentAttributes) { + auto operations = LayerTransformation::get(actualFunction); + operations.insert(operations.end(), actualFakeQuantizes.begin(), actualFakeQuantizes.end()); + ASSERT_TRUE(checkIfAttributesSharedValuesAreTheSame>(operations)) << + "IntervalsAlignmentAttribute are not the same"; + } } } diff --git a/inference-engine/tests/functional/inference_engine/lp_transformations/concat_with_different_precision_on_children.cpp b/inference-engine/tests/functional/inference_engine/lp_transformations/concat_with_different_precision_on_children.cpp index e781b8b258d..5bd1dd8d379 100644 --- a/inference-engine/tests/functional/inference_engine/lp_transformations/concat_with_different_precision_on_children.cpp +++ b/inference-engine/tests/functional/inference_engine/lp_transformations/concat_with_different_precision_on_children.cpp @@ -11,11 +11,9 @@ #include #include -#include #include #include #include -#include #include "common_test_utils/ngraph_test_utils.hpp" #include "lpt_ngraph_functions/concat_function.hpp" @@ -45,7 +43,8 @@ public: ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize1; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize2; ngraph::element::Type precisionBeforeOp; - ngraph::builder::subgraph::DequantizationOperations dequantizationBefore; + ngraph::builder::subgraph::DequantizationOperations dequantizationBefore1; + ngraph::builder::subgraph::DequantizationOperations dequantizationBefore2; ngraph::element::Type precisionAfterOperation; ngraph::builder::subgraph::DequantizationOperations dequantizationAfter1; ngraph::builder::subgraph::DequantizationOperations dequantizationAfter2; @@ -63,6 +62,7 @@ class ConcatTransformationTestValues { public: TestTransformationParams params; bool multiChannels; + std::int64_t axis; ConcatTransformationActualValues actual; ConcatTransformationResultValues result; }; @@ -87,6 +87,7 @@ public: actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginalWithDifferentPrecisionOnChildren( precision, inputShape, + testValues.axis, testValues.actual.fakeQuantize1, testValues.actual.fakeQuantize2); @@ -100,17 +101,18 @@ public: transform.add(testValues.params); transform.add(testValues.params); transform.add(testValues.params); - transform.add(testValues.params); transform.transform(actualFunction); referenceFunction = ngraph::builder::subgraph::ConcatFunction::getReferenceWithDifferentPrecisionOnChildren( precision, inputShape, testValues.multiChannels, + testValues.axis, testValues.result.fakeQuantize1, testValues.result.fakeQuantize2, testValues.result.precisionBeforeOp, - testValues.result.dequantizationBefore, + testValues.result.dequantizationBefore1, + testValues.result.dequantizationBefore2, testValues.result.precisionAfterOperation, testValues.result.dequantizationAfter1, testValues.result.dequantizationAfter2); @@ -153,6 +155,7 @@ const std::vector testValues = { { LayerTransformation::createParamsU8I8(), false, + 1, { { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {2.55f / 2.f} } @@ -162,15 +165,37 @@ const std::vector testValues = { { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 128.f} }, ngraph::element::u8, {{}, {}, {}}, + {{}, {}, {}}, ngraph::element::u8, { ngraph::element::f32, {}, { 0.01f } }, { ngraph::element::f32, {}, { 0.01f } } } }, + // U8 with unsupported axis + { + LayerTransformation::createParamsU8I8(), + false, + 2, + { + { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} }, + { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {2.55f / 2.f} } + }, + { + { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} }, + { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {255.f} }, + ngraph::element::u8, + {{ngraph::element::f32}, {}, {0.01f}}, + {{ngraph::element::f32}, {}, {0.005f}}, + ngraph::element::f32, + {{}, {}, {}}, + {{}, {}, {}} + } + }, // I8 { LayerTransformation::createParamsI8I8(), false, + 1, { { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} }, { 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-1.28f / 2.f}, {1.27f / 2.f} } @@ -180,6 +205,7 @@ const std::vector testValues = { { 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-64.f}, { 64.f} }, ngraph::element::i8, {{}, {}, {}}, + {{}, {}, {}}, ngraph::element::i8, { ngraph::element::f32, {}, { 0.01f } }, { ngraph::element::f32, {}, { 0.01f } } @@ -189,6 +215,7 @@ const std::vector testValues = { { LayerTransformation::createParamsU8I8(), true, + 1, { { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {2.55f / 2.f} } @@ -198,6 +225,7 @@ const std::vector testValues = { { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 255.f} }, ngraph::element::u8, {{}, {}, {}}, + {{}, {}, {}}, ngraph::element::u8, { ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} }, { ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} }, @@ -207,6 +235,7 @@ const std::vector testValues = { { LayerTransformation::createParamsI8I8(), true, + 1, { { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} }, { 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-1.28f / 2.f}, {1.27f / 2.f} } @@ -216,6 +245,7 @@ const std::vector testValues = { { 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-128.f}, {127.f} }, ngraph::element::i8, {{}, {}, {}}, + {{}, {}, {}}, ngraph::element::i8, { ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} }, { ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} }, @@ -225,6 +255,7 @@ const std::vector testValues = { { LayerTransformation::createParamsU8I8().setUpdatePrecisions(false), false, + 1, { { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {2.55f / 2.f} } @@ -234,6 +265,7 @@ const std::vector testValues = { { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 128.f} }, ngraph::element::f32, {{}, {}, {}}, + {{}, {}, {}}, ngraph::element::f32, { {}, {}, { 0.01f } }, { {}, {}, { 0.01f } } diff --git a/inference-engine/tests/functional/inference_engine/lp_transformations/concat_with_unsupported_axis_transformation.cpp b/inference-engine/tests/functional/inference_engine/lp_transformations/concat_with_unsupported_axis_transformation.cpp new file mode 100644 index 00000000000..2ac33c4de30 --- /dev/null +++ b/inference-engine/tests/functional/inference_engine/lp_transformations/concat_with_unsupported_axis_transformation.cpp @@ -0,0 +1,37 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "layer_transformation.hpp" + +#include + +#include "lpt_ngraph_functions/concat_function.hpp" +#include "simple_low_precision_transformer.hpp" + +using namespace ::testing; + +class smoke_LPT_ConcatWithUnsupportedAxis : public Test {}; + +TEST_F(smoke_LPT_ConcatWithUnsupportedAxis, rtInfoCheck) { + using namespace ngraph::builder::subgraph; + + const ngraph::element::Type precision = ngraph::element::f32; + const ngraph::PartialShape inputPShape = PartialShape{ 1, 3, 16, 16 }; + const std::int64_t unsupportedAxis = 2; + const auto fakeQuantize = FakeQuantizeOnData{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} }; + + std::shared_ptr function = ConcatFunction::getOriginalWithDifferentPrecisionOnChildren( + precision, + inputPShape, + unsupportedAxis, + fakeQuantize, + fakeQuantize); + + SimpleLowPrecisionTransformer transformer; + transformer.transform(function); + + const auto actualConcat = LayerTransformation::get(function)[0]; + const auto& rtInfo = actualConcat->get_rt_info(); + ASSERT_TRUE(rtInfo.empty()) << "Unsupported concat mustn't contain LPT runtime attributes"; +} diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_different_precision_on_children.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_different_precision_on_children.cpp index b3631fe57d7..72d30a9b019 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_different_precision_on_children.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_different_precision_on_children.cpp @@ -16,42 +16,48 @@ const std::vector netPrecisions = { }; const std::vector trasformationParamValues = { - // LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8(), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8() }; const std::vector testValues = { // U8 { + 1, + { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} }, + { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f / 2.f} } + }, + // U8 and unsupported concat axis + { + 2, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f / 2.f} } }, // I8 { + 1, { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} }, { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f / 2.f}, {1.27f / 2.f} } }, // mixed: U8 + I8 { + 1, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} }, { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} } }, // mixed: I8 + U8 { + 1, { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} } } }; -const std::vector multiChannel = { true/*, false*/ }; - INSTANTIATE_TEST_SUITE_P(smoke_LPT, ConcatWithDifferentChildrenTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), ::testing::Values(ngraph::PartialShape({ 1, 6, 10, 10 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(testValues), - ::testing::ValuesIn(trasformationParamValues), - ::testing::ValuesIn(multiChannel)), + ::testing::ValuesIn(trasformationParamValues)), ConcatWithDifferentChildrenTransformation::getTestCaseName); } // namespace diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_different_precision_on_children.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_different_precision_on_children.cpp index 731946ef016..0f09ea78560 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_different_precision_on_children.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_different_precision_on_children.cpp @@ -16,42 +16,48 @@ const std::vector netPrecisions = { }; const std::vector trasformationParamValues = { - // LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8(), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8() }; const std::vector testValues = { // U8 { + 1, + { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} }, + { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f / 2.f} } + }, + // U8 and unsupported concat axis + { + 2, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f / 2.f} } }, // I8 { - { 256ul, ngraph::Shape({}), {-128.f}, {127.f}, {-1.28f}, {1.27f} }, - { 256ul, ngraph::Shape({}), {-128.f}, {127.f}, {-1.28f / 2}, {1.27f / 2} } + 1, + { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} }, + { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f / 2.f}, {1.27f / 2.f} } }, // mixed: U8 + I8 { + 1, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} }, { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} } }, // mixed: I8 + U8 { + 1, { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} } } }; -const std::vector multiChannel = { true/*, false*/ }; - INSTANTIATE_TEST_SUITE_P(smoke_LPT, ConcatWithDifferentChildrenTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), ::testing::Values(ngraph::PartialShape({ 1, 3, 10, 10 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(testValues), - ::testing::ValuesIn(trasformationParamValues), - ::testing::ValuesIn(multiChannel)), + ::testing::ValuesIn(trasformationParamValues)), ConcatWithDifferentChildrenTransformation::getTestCaseName); } // namespace diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_different_precision_on_children.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_different_precision_on_children.hpp index a92974bed4c..72a7c4b06e8 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_different_precision_on_children.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_different_precision_on_children.hpp @@ -13,6 +13,7 @@ namespace LayerTestsDefinitions { class ConcatWithDifferentChildrenTransformationParam { public: + std::int64_t axis; ngraph::builder::subgraph::FakeQuantizeOnData fqOnData1; ngraph::builder::subgraph::FakeQuantizeOnData fqOnData2; }; @@ -22,9 +23,8 @@ typedef std::tuple< ngraph::PartialShape, std::string, // target device: CPU, GPU ConcatWithDifferentChildrenTransformationParam, - ngraph::pass::low_precision::LayerTransformation::Params, // transformation parameters - // multichannel - bool> ConcatWithDifferentChildrenTransformationParams; + ngraph::pass::low_precision::LayerTransformation::Params // transformation parameters + > ConcatWithDifferentChildrenTransformationParams; class ConcatWithDifferentChildrenTransformation : public testing::WithParamInterface, diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_different_precision_on_children.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_different_precision_on_children.cpp index 6334b3d644f..1bca896058b 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_different_precision_on_children.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_different_precision_on_children.cpp @@ -25,13 +25,12 @@ std::string ConcatWithDifferentChildrenTransformation::getTestCaseName(testing:: std::string targetDevice; ConcatWithDifferentChildrenTransformationParam param; ngraph::pass::low_precision::LayerTransformation::Params params; - bool multiChannel; - std::tie(netPrecision, inputShapes, targetDevice, param, params, multiChannel) = obj.param; + std::tie(netPrecision, inputShapes, targetDevice, param, params) = obj.param; std::ostringstream result; result << getTestCaseNameByParams(netPrecision, inputShapes, targetDevice, params) << - (multiChannel ? "_multichannel" : "") << param.fqOnData1 << param.fqOnData2; + "_axis_" << param.axis << "_" << param.fqOnData1 << param.fqOnData2; return result.str(); } @@ -42,8 +41,7 @@ InferenceEngine::Blob::Ptr ConcatWithDifferentChildrenTransformation::GenerateIn std::string targetDevice; ConcatWithDifferentChildrenTransformationParam param; ngraph::pass::low_precision::LayerTransformation::Params params; - bool multiChannel; - std::tie(netPrecision, inputShapes, targetDevice, param, params, multiChannel) = this->GetParam(); + std::tie(netPrecision, inputShapes, targetDevice, param, params) = this->GetParam(); const float k = (info.name() == "input1") ? 1.f : (info.name() == "input2" ? 2.f : 3.f); return LayerTransformation::GenerateInput(ngraph::element::u8, info.getTensorDesc(), k); @@ -54,11 +52,10 @@ void ConcatWithDifferentChildrenTransformation::SetUp() { ngraph::PartialShape inputShapes; ConcatWithDifferentChildrenTransformationParam param; ngraph::pass::low_precision::LayerTransformation::Params params; - bool multiChannel; - std::tie(netPrecision, inputShapes, targetDevice, param, params, multiChannel) = this->GetParam(); + std::tie(netPrecision, inputShapes, targetDevice, param, params) = this->GetParam(); function = ngraph::builder::subgraph::ConcatFunction::getOriginalWithDifferentPrecisionOnChildren( - netPrecision, inputShapes, param.fqOnData1, param.fqOnData2); + netPrecision, inputShapes, param.axis, param.fqOnData1, param.fqOnData2); } TEST_P(ConcatWithDifferentChildrenTransformation, CompareWithRefImpl) { diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/concat_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/concat_function.hpp index 241b250bb00..0aa75c2cfbc 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/concat_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/concat_function.hpp @@ -82,6 +82,7 @@ public: static std::shared_ptr getOriginalWithDifferentPrecisionOnChildren( const ngraph::element::Type precision, const ngraph::PartialShape& inputShape, + const std::int64_t axis, const FakeQuantizeOnData& fqOnData1, const FakeQuantizeOnData& fqOnData2); @@ -229,10 +230,12 @@ public: const ngraph::element::Type precision, const ngraph::PartialShape& inputShape, const bool multiChannel, + const std::int64_t axis, const FakeQuantizeOnData& fqOnData1, const FakeQuantizeOnData& fqOnData2, const ngraph::element::Type precisionBeforeOp, - const DequantizationOperations& dequantizationBefore, + const DequantizationOperations& dequantizationBefore1, + const DequantizationOperations& dequantizationBefore2, const ngraph::element::Type precisionAfterOperation, const DequantizationOperations& dequantizationAfter1, const DequantizationOperations& dequantizationAfter2); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/concat_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/concat_function.cpp index d07034de213..28c04e0ed4d 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/concat_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/concat_function.cpp @@ -600,6 +600,7 @@ std::shared_ptr ConcatFunction::getOriginalWithStridedSlice( std::shared_ptr ConcatFunction::getOriginalWithDifferentPrecisionOnChildren( const ngraph::element::Type precision, const ngraph::PartialShape& inputShape, + const std::int64_t axis, const FakeQuantizeOnData& fqOnData1, const FakeQuantizeOnData& fqOnData2) { const auto input1 = std::make_shared(precision, inputShape); @@ -610,11 +611,7 @@ std::shared_ptr ConcatFunction::getOriginalWithDifferentPrecis input2->set_friendly_name("input2"); const auto fakeQuantize2 = makeFakeQuantize(input2, precision, fqOnData2); - const std::shared_ptr concat = std::make_shared( - ngraph::OutputVector{ fakeQuantize1->output(0), fakeQuantize2->output(0) }, 1); - - auto& rtInfo = concat->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); + const auto concat = std::make_shared(OutputVector{ fakeQuantize1->output(0), fakeQuantize2->output(0) }, axis); const std::vector kernel = { 3, 3 }; const std::vector stride = { 1, 1 }; @@ -1687,10 +1684,12 @@ std::shared_ptr ConcatFunction::getReferenceWithDifferentPreci const ngraph::element::Type precision, const ngraph::PartialShape& inputShape, const bool multiChannel, + const std::int64_t axis, const FakeQuantizeOnData& fqOnData1, const FakeQuantizeOnData& fqOnData2, const ngraph::element::Type precisionBeforeOp, - const DequantizationOperations& dequantizationBefore, + const DequantizationOperations& dequantizationBefore1, + const DequantizationOperations& dequantizationBefore2, const ngraph::element::Type precisionAfterOperation, const DequantizationOperations& dequantizationAfter1, const DequantizationOperations& dequantizationAfter2) { @@ -1700,7 +1699,7 @@ std::shared_ptr ConcatFunction::getReferenceWithDifferentPreci const auto fakeQuantize1 = makeFakeQuantizeTypeRelaxed(input1, precision, fqOnData1); low_precision::NetworkHelper::setOutDataPrecisionForTypeRelaxed(fakeQuantize1, precisionBeforeOp); fakeQuantize1->set_friendly_name("fakeQuantize1"); - const auto deqBefore1 = makeDequantization(fakeQuantize1, dequantizationBefore); + const auto deqBefore1 = makeDequantization(fakeQuantize1, dequantizationBefore1); const auto input2 = std::make_shared(precision, inputShape); input2->set_friendly_name("input2"); @@ -1708,16 +1707,12 @@ std::shared_ptr ConcatFunction::getReferenceWithDifferentPreci const auto fakeQuantize2 = makeFakeQuantizeTypeRelaxed(input2, precision, fqOnData2); low_precision::NetworkHelper::setOutDataPrecisionForTypeRelaxed(fakeQuantize2, precisionBeforeOp); fakeQuantize2->set_friendly_name("fakeQuantize2"); - const auto deqBefore2 = makeDequantization(fakeQuantize2, dequantizationBefore); + const auto deqBefore2 = makeDequantization(fakeQuantize2, dequantizationBefore2); - const std::shared_ptr concat = std::make_shared( - ngraph::OutputVector{ deqBefore1, deqBefore2 }, 1); + const auto concat = std::make_shared(OutputVector{ deqBefore1, deqBefore2 }, axis); low_precision::NetworkHelper::setOutDataPrecision(concat, precisionAfterOperation); concat->set_friendly_name("concat"); - auto& rtInfo = concat->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); - const auto lastDequantization1 = makeDequantization(concat->output(0), dequantizationAfter1); const std::vector kernel = { 3, 3 }; @@ -1741,20 +1736,18 @@ std::shared_ptr ConcatFunction::getReferenceWithDifferentPreci ngraph::ResultVector results; results.push_back(std::make_shared(avgPool)); - if (!dequantizationAfter2.empty()) { - const std::shared_ptr maxPool = std::make_shared( - concat->output(0), - stride, - padBegin, - padEnd, - kernel, - roundingType, - padType); + const std::shared_ptr maxPool = std::make_shared( + concat->output(0), + stride, + padBegin, + padEnd, + kernel, + roundingType, + padType); - const std::shared_ptr lastDequantization2 = makeDequantization(maxPool, dequantizationAfter2); - lastDequantization2->set_friendly_name("MaxPool"); - results.push_back(std::make_shared(lastDequantization2)); - } + const std::shared_ptr lastDequantization2 = makeDequantization(maxPool, dequantizationAfter2); + lastDequantization2->set_friendly_name("MaxPool"); + results.push_back(std::make_shared(lastDequantization2)); std::shared_ptr function = std::make_shared( results,