From 4964d410c9932790ad25d7c6e49f04b8c13d8fcf Mon Sep 17 00:00:00 2001 From: Golubev Date: Thu, 19 Aug 2021 10:47:18 +0300 Subject: [PATCH] [LPT][TESTS] ReshapeTransofrmation fix #2 and functional tests --- .../src/reshape.cpp | 8 ++----- .../reshape_transformation.cpp | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/inference-engine/src/low_precision_transformations/src/reshape.cpp b/inference-engine/src/low_precision_transformations/src/reshape.cpp index 4988328c654ba7..4b12741c2fc933 100644 --- a/inference-engine/src/low_precision_transformations/src/reshape.cpp +++ b/inference-engine/src/low_precision_transformations/src/reshape.cpp @@ -80,14 +80,10 @@ void reshapeDequantizationConstant(const std::shared_ptr& resha return constant; } - std::shared_ptr updatedConstant = constant; Shape newOperationConstantBroadcastedShape = constant->get_shape(); // add dimensions to broadcast values if (newOperationConstantBroadcastedShape.size() == 2ul) { - newOperationConstantBroadcastedShape.push_back(dimensionsToBroadcast); - - const auto unsqueezeConst = opset1::Constant::create(element::i32, Shape{}, { 2 }); - updatedConstant = fold(constant, unsqueezeConst); + newOperationConstantBroadcastedShape[0] = dimensionsToBroadcast; } else { newOperationConstantBroadcastedShape[2] = dimensionsToBroadcast; } @@ -97,7 +93,7 @@ void reshapeDequantizationConstant(const std::shared_ptr& resha Shape{ newOperationConstantBroadcastedShape.size() }, newOperationConstantBroadcastedShape); - return fold(updatedConstant, targetShapeConstant); + return fold(constant, targetShapeConstant); }; const std::shared_ptr broadcastedConstant = getBCastedConst(originalConstant, dimensionsToBroadcast); diff --git a/inference-engine/tests/functional/inference_engine/lp_transformations/reshape_transformation.cpp b/inference-engine/tests/functional/inference_engine/lp_transformations/reshape_transformation.cpp index 6a67202125cfbd..38502dc6834490 100644 --- a/inference-engine/tests/functional/inference_engine/lp_transformations/reshape_transformation.cpp +++ b/inference-engine/tests/functional/inference_engine/lp_transformations/reshape_transformation.cpp @@ -931,6 +931,30 @@ const std::vector testValues = { {{0.1f, 0.01f, 0.1f}, ngraph::element::f32, {1, 3}} } } + }, + // U8: without subtract 2D -> 2D + { + { Dimension::dynamic(), 2 }, + { -1, 6 }, + LayerTransformation::createParamsU8I8(), + { + ngraph::element::u8, + { + {ngraph::element::f32}, + {}, + {{0.1f, 0.02f}, ngraph::element::f32, {1, 2}} + } + }, + { + ngraph::element::u8, + {{}, {}, {}}, + ngraph::element::u8, + { + {ngraph::element::f32}, + {}, + {{0.1f, 0.02f, 0.1f, 0.02f, 0.1f, 0.02f}, ngraph::element::f32, {1, 6}} + } + } } };