diff --git a/inference-engine/tests/functional/inference_engine/lp_transformations/convolution_backprop_data_transformation.cpp b/inference-engine/tests/functional/inference_engine/lp_transformations/convolution_backprop_data_transformation.cpp index a5f9def8bd73e8..39c1f9f6df7139 100644 --- a/inference-engine/tests/functional/inference_engine/lp_transformations/convolution_backprop_data_transformation.cpp +++ b/inference-engine/tests/functional/inference_engine/lp_transformations/convolution_backprop_data_transformation.cpp @@ -202,6 +202,26 @@ const std::vector testValues = true } }, + // QDq version + { + LayerTransformation::createParamsU8I8(), + // ActualValues + { + ngraph::element::u8, + {{ngraph::element::f32}, { 128.f }, { 0.02f }}, + {{ngraph::element::f32}, { 2.f }, { 0.01f }}, + op::Constant::create(ngraph::element::i8, ngraph::Shape{}, std::vector{ 2.f }) + }, + // ExpectedValues + { + ngraph::element::u8, + {{}, { { 128.f }, ngraph::element::f32, {}, false }, {}}, + {{}, { { 2.f }, ngraph::element::f32, {1, 2, 1, 1}, true, 1ul, element::i8, false, { "DISABLED_CONSTANT_FOLDING" } }, {}}, + {{}, {}, {{ 0.0002f }, ngraph::element::f32, { 1 }}}, + op::Constant::create(ngraph::element::i8, ngraph::Shape{}, std::vector{ 2.f }), + true + } + }, // without zero point { LayerTransformation::createParamsU8I8(), @@ -222,6 +242,26 @@ const std::vector testValues = true } }, + // QDq version + { + LayerTransformation::createParamsU8I8(), + // ActualValues + { + ngraph::element::u8, + {{ngraph::element::f32}, {}, { 0.02f }}, + {{ngraph::element::f32}, {}, { 0.01f }}, + op::Constant::create(ngraph::element::i8, ngraph::Shape{}, std::vector{ 2.f }) + }, + // ExpectedValues + { + ngraph::element::u8, + {}, + {}, + {{}, {}, {{ 0.0002f }, ngraph::element::f32, {1}}}, + op::Constant::create(ngraph::element::i8, ngraph::Shape{}, std::vector{ 2.f }), + true + } + }, // per-channel dequantization with the same values { LayerTransformation::createParamsU8I8(), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/convolution_backprop_data_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/convolution_backprop_data_transformation.cpp index 3a4a7009bc7268..64ce304a24756f 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/convolution_backprop_data_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/convolution_backprop_data_transformation.cpp @@ -20,21 +20,61 @@ const std::vector tras }; const std::vector params = { + // FQ on weights + // with zero point { - {256ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 255.f }, { 0.f }, { 25.5f }}, + {256ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 255.f }, { -12.7f }, { 12.8f }}, {255ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 254.f }, { -127.f }, { 127.f }}, "", "" }, + // without zero point { {256ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 255.f }, { 0.f }, { 25.5f }}, {255ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 254.f }, { 0.f }, { 25.4f }}, "", "" }, + // with incorrect zero point on activations + { + {256ul, ngraph::Shape{1, 1, 1, 1}, { 5.f }, { 6.f }, { 5.f }, { 6.f }}, + {255ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 254.f }, { 0.f }, { 25.4f }}, + "", + "" + }, + // with incorrect zero point on weights + { + {256ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 255.f }, { 0.f }, { 25.5f }}, + {255ul, ngraph::Shape{1, 1, 1, 1}, { 5.f }, { 6.f }, { 5.f }, { 6.f }}, + "", + "" + }, + // QDq on weights + // with zero point + { + {256ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 255.f }, { -12.7f }, { 12.8f }}, + {{ngraph::element::f32}, { {12.f}, ngraph::element::f32, {}, false }, { {4.f}, ngraph::element::f32, {}, false }}, + "", + "" + }, + // without zero point { {256ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 255.f }, { 0.f }, { 25.5f }}, - {ngraph::element::f32, { 12.f }, { 4.f }}, + {{ngraph::element::f32}, {}, { {4.f}, ngraph::element::f32, {}, false }}, + "", + "" + }, + // with incorrect zero point on activations + { + {256ul, ngraph::Shape{1, 1, 1, 1}, { 5.f }, { 6.f }, { 5.f }, { 6.f }}, + {{ngraph::element::f32}, { {12.f}, ngraph::element::f32, {}, false }, { {4.f}, ngraph::element::f32, {}, false }}, + "", + "" + }, + // with incorrect zero point on weights + { + {256ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 255.f }, { -12.7f }, { 12.8f }}, + {{ngraph::element::f32}, { {1000.f}, ngraph::element::f32, {}, false }, { {4.f}, ngraph::element::f32, {}, false }}, "", "" } diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/convolution_backprop_data_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/convolution_backprop_data_transformation.cpp index e42a816a10317a..6a0e8d8f3baf2b 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/convolution_backprop_data_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/convolution_backprop_data_transformation.cpp @@ -21,24 +21,64 @@ const std::vector tras }; const std::vector params = { - { - {256ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 255.f }, { 0.f }, { 25.5f }}, - {255ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 254.f }, { -127.f }, { 127.f }}, - "", - "" - }, - { - {256ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 255.f }, { 0.f }, { 25.5f }}, - {255ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 254.f }, { 0.f }, { 25.4f }}, - "", - "" - }, - { - {256ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 255.f }, { 0.f }, { 25.5f }}, - {ngraph::element::f32, { 12.f }, { 4.f }}, - "", - "" - } + // FQ on weights + // with zero point + { + {256ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 255.f }, { -12.7f }, { 12.8f }}, + {255ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 254.f }, { -127.f }, { 127.f }}, + "", + "" + }, + // without zero point + { + {256ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 255.f }, { 0.f }, { 25.5f }}, + {255ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 254.f }, { 0.f }, { 25.4f }}, + "", + "" + }, + // with incorrect zero point on activations + { + {256ul, ngraph::Shape{1, 1, 1, 1}, { 5.f }, { 6.f }, { 5.f }, { 6.f }}, + {255ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 254.f }, { 0.f }, { 25.4f }}, + "", + "" + }, + // with incorrect zero point on weights + { + {256ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 255.f }, { 0.f }, { 25.5f }}, + {255ul, ngraph::Shape{1, 1, 1, 1}, { 5.f }, { 6.f }, { 5.f }, { 6.f }}, + "", + "" + }, + // QDq on weights + // with zero point + { + {256ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 255.f }, { -12.7f }, { 12.8f }}, + {{ngraph::element::f32}, { {12.f}, ngraph::element::f32, {}, false }, { {4.f}, ngraph::element::f32, {}, false }}, + "", + "" + }, + // without zero point + { + {256ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 255.f }, { 0.f }, { 25.5f }}, + {{ngraph::element::f32}, {}, { {4.f}, ngraph::element::f32, {}, false }}, + "", + "" + }, + // with incorrect zero point on activations + { + {256ul, ngraph::Shape{1, 1, 1, 1}, { 5.f }, { 6.f }, { 5.f }, { 6.f }}, + {{ngraph::element::f32}, { {12.f}, ngraph::element::f32, {}, false }, { {4.f}, ngraph::element::f32, {}, false }}, + "", + "" + }, + // with incorrect zero point on weights + { + {256ul, ngraph::Shape{1, 1, 1, 1}, { 0.f }, { 255.f }, { -12.7f }, { 12.8f }}, + {{ngraph::element::f32}, { {1000.f}, ngraph::element::f32, {}, false }, { {4.f}, ngraph::element::f32, {}, false }}, + "", + "" + } }; const std::vector inputShapes = { diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/convolution_backprop_data_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/convolution_backprop_data_transformation.hpp index ca472804a203b7..39d5ea583916e5 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/convolution_backprop_data_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/convolution_backprop_data_transformation.hpp @@ -60,9 +60,6 @@ class ConvolutionBackpropDataTransformation : void SetUp() override; void Run() override; - -private: - void validate(); }; } // namespace LayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_backprop_data_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_backprop_data_transformation.cpp index 0b35b2c5e24fb7..951af4fdd4e0e0 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_backprop_data_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_backprop_data_transformation.cpp @@ -25,7 +25,8 @@ std::string ConvolutionBackpropDataTransformation::getTestCaseName(testing::Test result << getTestCaseNameByParams(netPrecision, inputShape, targetDevice, params) << "_" << outputShape << "_" << param.fakeQuantizeOnData << "_" << - param.fakeQuantizeOnWeights; + param.fakeQuantizeOnWeights << "_" << + param.dequantizationOnWeights; return result.str(); } @@ -59,8 +60,6 @@ void ConvolutionBackpropDataTransformation::SetUp() { outputShape, param.fakeQuantizeOnData, weights); - - validate(); } void ConvolutionBackpropDataTransformation::Run() { @@ -71,16 +70,6 @@ void ConvolutionBackpropDataTransformation::Run() { EXPECT_EQ(actualType, params.expectedKernelType); } -void ConvolutionBackpropDataTransformation::validate() { - ngraph::element::Type netPrecision; - ngraph::Shape inputShape; - ngraph::Shape outputShape; - std::string targetDevice; - ngraph::pass::low_precision::LayerTransformation::Params params; - ConvolutionBackpropDataTransformationParam param; - std::tie(netPrecision, inputShape, outputShape, targetDevice, params, param) = this->GetParam(); -} - TEST_P(ConvolutionBackpropDataTransformation, CompareWithRefImpl) { Run(); }; diff --git a/inference-engine/tests/functional/shared_test_classes/src/base/layer_test_utils.cpp b/inference-engine/tests/functional/shared_test_classes/src/base/layer_test_utils.cpp index abb14d54f83dca..fc0326894fdab0 100644 --- a/inference-engine/tests/functional/shared_test_classes/src/base/layer_test_utils.cpp +++ b/inference-engine/tests/functional/shared_test_classes/src/base/layer_test_utils.cpp @@ -262,8 +262,6 @@ std::vector> LayerTestsCommon::CalculateRefs() { ngraph::pass::ConvertPrecision().run_on_function(function); ngraph::pass::ConvertPrecision().run_on_function(function); - ngraph::pass::VisualizeTree("/home/vzinoviev/work/model_dumps/model_after_convert.dot").run_on_function(function); - function->validate_nodes_and_infer_types(); auto referenceInputs = std::vector>(inputs.size()); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/convolution_backprop_data_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/convolution_backprop_data_function.cpp index b9fe418320a925..98017fb4f9711a 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/convolution_backprop_data_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/convolution_backprop_data_function.cpp @@ -68,14 +68,18 @@ std::shared_ptr ConvolutionBackpropDataFunction::getWeights( const element::Type& netPrecision, const builder::subgraph::DequantizationOperations& dequantizationOnWeights, const std::shared_ptr& value) { - const auto weights = value != nullptr ? + const auto weights = + value != nullptr ? value : std::make_shared( - netPrecision, - shape, - std::vector(shape_size(shape), 1)); + element::i8, + shape, + std::vector(shape_size(shape), 1)); auto dequantizationStructure = dequantizationOnWeights; dequantizationStructure.setPrecision(netPrecision); + if (!dequantizationOnWeights.subtract.constantPrecision.is_real()) { + dequantizationStructure.subtract.constantPrecision = dequantizationOnWeights.subtract.constantPrecision; + } const auto dq = makeDequantization(weights, dequantizationStructure); return dq;