[LPT] Reduced gaps between static and dynamic execution (#9775)

* LPT: removed limitations on Dq by dynamic channel

* [TESTS] LPT tests updated
This commit is contained in:
Vladislav Golubev 2022-01-27 15:07:42 +03:00 committed by GitHub
parent 0627fe857e
commit bd7a5db029
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 179 additions and 952 deletions

View File

@ -26,6 +26,9 @@ public:
bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override;
bool isQuantized(const std::shared_ptr<const Node>& layer) const override;
static bool isQuantizedStatic(const std::shared_ptr<const Node>& layer);
protected:
size_t getInputChannels(const std::shared_ptr<ngraph::Node> conv) const override;
};
} // namespace low_precision

View File

@ -26,6 +26,9 @@ public:
bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> op) const override;
bool isQuantized(const std::shared_ptr<const Node>& layer) const override;
static bool isQuantizedStatic(const std::shared_ptr<const Node>& layer);
protected:
size_t getInputChannels(const std::shared_ptr<ngraph::Node> conv) const override;
};
} // namespace low_precision

View File

@ -26,6 +26,9 @@ public:
bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override;
bool isQuantized(const std::shared_ptr<const Node>& layer) const override;
static bool isQuantizedStatic(const std::shared_ptr<const Node>& layer);
protected:
size_t getInputChannels(const std::shared_ptr<ngraph::Node> conv) const override;
};
} // namespace low_precision

View File

@ -209,10 +209,6 @@ public:
const std::vector<element::Type>& v1,
const std::vector<element::Type>& v2) noexcept;
static bool isFQByDynamicDimension(const std::shared_ptr<opset1::FakeQuantize>& fq);
static bool isDQByDynamicDimension(const std::shared_ptr<Node>& layer, size_t inputIdx = 0);
static bool isPrecisionPreserved(const std::shared_ptr<ngraph::Node>& node);
static void insertDequantizationAfter(

View File

@ -17,7 +17,7 @@ namespace low_precision {
* @ingroup ie_transformation_common_api
* @brief WeightableLayerTransformation is base type for weightable operation transformation.
*/
class LP_TRANSFORMATIONS_API WeightableLayerTransformation : public LayerTransformation{
class LP_TRANSFORMATIONS_API WeightableLayerTransformation : public LayerTransformation {
public:
WeightableLayerTransformation(const Params& params);
bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> layer) const override;
@ -36,6 +36,7 @@ protected:
bool decomposeFakeQuantizeForWeightsPath(const std::shared_ptr<Node>& weightableLayer, size_t outChannelsShapeIndex = 0ul) const;
static bool isGroup(const std::shared_ptr<Node>& node);
static bool isDepthwise(const std::shared_ptr<Node>& node);
virtual size_t getInputChannels(const std::shared_ptr<ngraph::Node> conv) const = 0;
public:
static std::shared_ptr<opset1::FakeQuantize> getFakeQuantizeOnWeights(const std::shared_ptr<Node>& node);

View File

@ -51,6 +51,12 @@ bool ConvolutionTransformation::isQuantizedStatic(const std::shared_ptr<const No
return WeightableLayerTransformation::isQuantizedStatic(layer, false);
}
size_t ConvolutionTransformation::getInputChannels(const std::shared_ptr<ngraph::Node> conv) const {
const auto channels = conv->get_input_partial_shape(1)[1];
assert(channels.is_static());
return channels.get_length();
}
bool ConvolutionTransformation::transform(TransformationContext &context, ngraph::pattern::Matcher &m) {
auto convolution = m.get_match_root();
@ -98,7 +104,7 @@ bool ConvolutionTransformation::transform(TransformationContext &context, ngraph
// Insert explicit broadcast for channel dimension [1] and immediately fold it
Shape broadcastShape(length, 1);
broadcastShape[1] = subtract->get_output_partial_shape(0)[1].get_length();
broadcastShape[1] = getInputChannels(convolution);
std::shared_ptr<Node> newShift = fold<opset1::Broadcast>(
subtract->input_value(1),

View File

@ -61,6 +61,12 @@ bool ConvolutionBackpropDataTransformation::isQuantizedStatic(const std::shared_
return WeightableLayerTransformation::isQuantizedStatic(layer, false);
}
size_t ConvolutionBackpropDataTransformation::getInputChannels(const std::shared_ptr<ngraph::Node> conv) const {
const auto channels = conv->get_input_partial_shape(1)[0];
assert(channels.is_static());
return channels.get_length();
}
bool ConvolutionBackpropDataTransformation::transform(TransformationContext &context, ngraph::pattern::Matcher &m) {
auto convolutionBackpropData = m.get_match_root();

View File

@ -39,10 +39,6 @@ bool FakeQuantizeTransformation::transform(TransformationContext& context, ngrap
return false;
}
if (NetworkHelper::isFQByDynamicDimension(layer)) {
return false;
}
bool wasHandled = false;
std::shared_ptr<opset1::FakeQuantize> fakeQuantize = layer;
do {

View File

@ -277,10 +277,6 @@ bool FakeQuantizeDecompositionTransformation::transform(TransformationContext& c
return false;
}
if (NetworkHelper::isFQByDynamicDimension(layer)) {
return false;
}
layer = NetworkHelper::fuseConvert(layer);
if (NetworkHelper::isConstantPath(layer)) {
return false;

View File

@ -114,11 +114,11 @@ bool FakeQuantizeDequantization::checkElementwise(const std::shared_ptr<ngraph::
return false;
}
if ((constShape.size() <= 1ul) || (std::all_of(constShape.begin(), constShape.end(), [](const size_t value) { return value == 1ul; }))) {
if (ngraph::shape_size(constShape) == 1) {
return true;
}
const auto partialShape = dequantizationElementwise->get_input_partial_shape(0);
const auto partialShape = dequantizationElementwise->get_output_partial_shape(0);
if (partialShape.rank().is_dynamic()) {
return false;
}

View File

@ -51,6 +51,13 @@ bool GroupConvolutionTransformation::isQuantizedStatic(const std::shared_ptr<con
return WeightableLayerTransformation::isQuantizedStatic(layer, true);
}
size_t GroupConvolutionTransformation::getInputChannels(const std::shared_ptr<ngraph::Node> conv) const {
const auto groups = conv->get_input_partial_shape(1)[0];
const auto channels = conv->get_input_partial_shape(1)[2];
assert(channels.is_static() && groups.is_static());
return channels.get_length() * groups.get_length();
}
} // namespace low_precision
} // namespace pass
} // namespace ngraph

View File

@ -45,10 +45,6 @@ bool LayerTransformation::canBeTransformed(const TransformationContext& context,
return false;
}
if (NetworkHelper::isDQByDynamicDimension(layer)) {
return false;
}
return canBeTransformedStatic(layer);
}
@ -110,10 +106,6 @@ bool LayerTransformation::canBeTransformedSpatialDimension(const TransformationC
return false;
}
if (NetworkHelper::isDQByDynamicDimension(layer)) {
return false;
}
for (const auto& output : layer->outputs()) {
const auto outPShape = output.get_partial_shape();
const auto rank = outPShape.rank();

View File

@ -189,10 +189,6 @@ bool MatMulTransformation::canBeTransformed(const TransformationContext& context
return false;
}
if (NetworkHelper::isDQByDynamicDimension(layer, 1)) {
return false;
}
std::shared_ptr<opset1::MatMul> matMul = ov::as_type_ptr<opset1::MatMul>(layer);
if (matMul == nullptr) {
return false;

View File

@ -1935,74 +1935,6 @@ std::vector<element::Type> NetworkHelper::precisionIntersection(
return v3;
}
bool NetworkHelper::isFQByDynamicDimension(const std::shared_ptr<opset1::FakeQuantize>& fq) {
const auto pInputShape = fq->get_input_partial_shape(0);
const auto olPShape = fq->get_input_partial_shape(3);
assert(olPShape.is_static());
auto olShape = olPShape.to_shape();
if (shape_size(olShape) > 1ul) {
if (pInputShape.rank().is_dynamic()) {
return true;
}
const size_t rank = pInputShape.rank().get_length();
while (olShape.size() < rank) {
olShape.insert(olShape.begin(), 1ul);
}
for (size_t i = 0; i < olShape.size(); ++i) {
if (olShape[i] != 1ul && pInputShape[i].is_dynamic()) {
return true;
}
}
}
return false;
}
bool NetworkHelper::isDQByDynamicDimension(const std::shared_ptr<Node>& layer, size_t inputIdx) {
const auto dequantization = getDequantization(layer, inputIdx);
if (dequantization.empty()) {
return false;
}
const auto dataPShape = dequantization.data.get_partial_shape();
auto constantByDynamicDymension = [&dataPShape](const std::shared_ptr<opset1::Constant>& constant) {
auto constShape = constant->get_shape();
if (shape_size(constShape) == 1ul) {
return false;
}
const auto rank = dataPShape.rank();
if (rank.is_dynamic()) {
return true;
}
const size_t rankValue = rank.get_length();
while (constShape.size() < rankValue) {
constShape.insert(constShape.begin(), 1ul);
}
for (size_t i = 0; i < constShape.size(); ++i) {
if (constShape[i] != 1ul && dataPShape[i].is_dynamic()) {
return true;
}
}
return false;
};
if (dequantization.subtract && constantByDynamicDymension(dequantization.subtractConstant)) {
return true;
}
if (dequantization.multiply && constantByDynamicDymension(dequantization.multiplyConstant)) {
return true;
}
return false;
}
bool isDisabled(const std::shared_ptr<Node>& node) {
for (const auto& input : node->inputs()) {
auto precisionAttribute = getAttribute<PrecisionsAttribute>(input);

View File

@ -36,10 +36,6 @@ bool ReduceBaseTransformation::canBeTransformed(const TransformationContext& con
return false;
}
if (NetworkHelper::isDQByDynamicDimension(reduce)) {
return false;
}
const auto axesConstant = ov::as_type_ptr<ngraph::opset1::Constant>(reduce->get_input_node_shared_ptr(1));
if (axesConstant == nullptr) {
return false;

View File

@ -116,11 +116,22 @@ bool StridedSliceTransformation::transform(TransformationContext& context, ngrap
}
bool StridedSliceTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> operation) const {
if (!ov::is_type<ngraph::opset1::StridedSlice>(operation) || NetworkHelper::isDQByDynamicDimension(operation)) {
if (!ov::is_type<ngraph::opset1::StridedSlice>(operation)) {
return false;
}
return !NetworkHelper::getDequantization(operation).empty();
const auto dequantization = NetworkHelper::getDequantization(operation);
if (dequantization.empty()) {
return false;
}
if (operation->get_input_partial_shape(0).rank().is_dynamic() &&
((dequantization.subtract && ngraph::shape_size(dequantization.subtractConstant->get_shape()) > 1) ||
(dequantization.multiply && ngraph::shape_size(dequantization.multiplyConstant->get_shape()) > 1))) {
return false;
}
return true;
}
bool StridedSliceTransformation::isPrecisionPreserved(std::shared_ptr<Node> layer) const noexcept {

View File

@ -59,8 +59,8 @@ bool WeightableLayerTransformation::canBeTransformed(const TransformationContext
return false;
}
const auto inputPShape = layer->get_input_partial_shape(0);
if (inputPShape.rank().is_dynamic() || inputPShape[1].is_dynamic()) {
// dynamic activations rank and dynamic weights aren't supported
if (layer->get_input_partial_shape(0).rank().is_dynamic() || layer->get_input_partial_shape(1).is_dynamic()) {
return false;
}

View File

@ -134,7 +134,7 @@ const std::vector<bool> addFQ = {
const std::vector<ngraph::PartialShape> shapes = {
{ 1, 3, 72, 48 },
{ Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic() }
{ -1, -1, -1, -1 }
};
const std::vector<AvgPoolTransformationTestValues> testValues = {
@ -326,7 +326,6 @@ INSTANTIATE_TEST_SUITE_P(
namespace testValues2 {
const std::vector<ngraph::PartialShape> shapesWithDynamicChannel = {
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
PartialShape::dynamic()
};

View File

@ -105,7 +105,7 @@ TEST_P(ClampTransformation, CompareFunctions) {
namespace testValues1 {
const std::vector<ngraph::PartialShape> inputShapes = {
ngraph::PartialShape({ 1, 3, 224, 224 }),
ngraph::PartialShape({ Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic() }),
ngraph::PartialShape({ -1, -1, -1, -1 }),
};
const std::vector<ClampTransformationTestValues> testValues = {
@ -475,61 +475,6 @@ INSTANTIATE_TEST_SUITE_P(
} // namespace testValues2
namespace testValues3 {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicChannels = {
ngraph::PartialShape({ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() }),
};
const std::vector<ClampTransformationTestValues> testValues = {
// U8 per tensor quantization
{
LayerTransformation::createParamsU8I8(),
// ActualValues
{
ngraph::element::u8,
{{ngraph::element::f32}, {128.f}, {3.f}}
},
// ExpectedValues
{
ngraph::element::u8,
{{}, {}, {}},
ngraph::element::f32,
{{}, {128.f}, {3.f}}
}
},
// U8 per channel quantization with the same values
{
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{
{ngraph::element::f32},
{{128.f, 128.f, 128.f}},
{{3.f, 3.f, 3.f}}
}
},
{
ngraph::element::u8,
{
{ngraph::element::f32},
{{128.f, 128.f, 128.f}},
{{3.f, 3.f, 3.f}}
},
ngraph::element::f32,
{},
}
},
};
INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
ClampTransformation,
::testing::Combine(
::testing::ValuesIn(inputShapesWithDynamicChannels),
::testing::ValuesIn(testValues)),
ClampTransformation::getTestCaseName);
} // namespace testValues3
namespace testValues4 {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicRank = {
PartialShape::dynamic()
};
@ -560,5 +505,5 @@ INSTANTIATE_TEST_SUITE_P(
::testing::ValuesIn(inputShapesWithDynamicRank),
::testing::ValuesIn(testValues)),
ClampTransformation::getTestCaseName);
} // namespace testValues4
} // namespace testValues3
} // namespace

View File

@ -206,7 +206,7 @@ const std::vector<element::Type> netPrecisions = {
namespace testValues1 {
const std::vector<ngraph::PartialShape> shapes = {
{ 1, 8, 16, 16 },
{ Dimension::dynamic(), 8, Dimension::dynamic(), Dimension::dynamic() }
{ -1, -1, -1, -1 }
};
const std::vector<ConvolutionBackpropDataTransformationTestValues> testValues = {
@ -506,7 +506,6 @@ INSTANTIATE_TEST_SUITE_P(
namespace testValues2 {
const std::vector<ngraph::PartialShape> shapesWithDynamicChannels = {
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
PartialShape::dynamic()
};

View File

@ -109,8 +109,8 @@ namespace testValues1 {
const std::vector<ngraph::PartialShape> suitablePartialShapes = {
ngraph::PartialShape({ 1, 3, 72, 48 }),
ngraph::PartialShape({ 4, 3, 72, 48 }),
ngraph::PartialShape({ Dimension::dynamic(), 3, 72, 48 }),
ngraph::PartialShape({ 1, 3, Dimension::dynamic(), Dimension::dynamic() }),
ngraph::PartialShape({ -1, 3, 72, 48 }),
ngraph::PartialShape({ -1, -1, -1, -1 }),
};
const std::vector<ConvolutionQDqTransformationTestValues> testValues = {
@ -514,7 +514,6 @@ INSTANTIATE_TEST_SUITE_P(
namespace testValues2 {
const std::vector<ngraph::PartialShape> unsuitablePartialShapes = {
ngraph::PartialShape({ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() }),
PartialShape::dynamic(),
};

View File

@ -133,8 +133,8 @@ const std::vector<element::Type> netPrecisions = {
const std::vector<ngraph::PartialShape> suitablePartialShapes = {
ngraph::PartialShape({ 1, 3, 72, 48 }),
ngraph::PartialShape({ 4, 3, 72, 48 }),
ngraph::PartialShape({ Dimension::dynamic(), 3, 72, 48 }),
ngraph::PartialShape({ 1, 3, Dimension::dynamic(), Dimension::dynamic() }),
ngraph::PartialShape({ -1, 3, 72, 48 }),
ngraph::PartialShape({ -1, -1, -1, -1 }),
};
const std::vector<ConvolutionTransformationTestValues> testValues = {
@ -454,7 +454,6 @@ const std::vector<element::Type> netPrecisions = {
};
const std::vector<ngraph::PartialShape> unsuitablePartialShapes = {
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
ngraph::PartialShape::dynamic()
};

View File

@ -109,7 +109,7 @@ TEST_P(DepthToSpaceTransformation, CompareFunctions) {
namespace testValues1 {
const std::vector<ngraph::PartialShape> inputShapesForBlockSize2 = {
{ 1, 4, 3, 3 },
{Dimension::dynamic(), 4, Dimension::dynamic(), Dimension::dynamic()}
{-1, -1, -1, -1}
};
const std::vector<DepthToSpaceTransformationTestValues> testValues = {
@ -231,7 +231,7 @@ INSTANTIATE_TEST_SUITE_P(
namespace testValues2 {
const std::vector<ngraph::PartialShape> inputShapesForBlockSize3 = {
{ 1, 9, 3, 3 },
{Dimension::dynamic(), 9, Dimension::dynamic(), Dimension::dynamic()}
{-1, -1, -1, -1}
};
const std::vector<DepthToSpaceTransformationTestValues> testValues = {
@ -279,62 +279,6 @@ INSTANTIATE_TEST_SUITE_P(
} // namespace testValues2
namespace testValues3 {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicChannel = {
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
};
const std::vector<DepthToSpaceTransformationTestValues> testValues = {
{
DepthToSpace::DepthToSpaceMode::BLOCKS_FIRST,
2,
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{{ngraph::element::f32}, {0.32f}, {0.45f}}
},
{
ngraph::element::u8,
{{}, {}, {}},
ngraph::element::u8,
{{ngraph::element::f32}, {0.32f}, {0.45f}}
}
},
// per-channel dequantizations with the same values
{
DepthToSpace::DepthToSpaceMode::BLOCKS_FIRST,
2,
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{
{ngraph::element::f32},
{{0.32f, 0.32f, 0.32f, 0.32f}},
{{0.1f, 0.1f, 0.1f, 0.1f}}
}
},
{
ngraph::element::u8,
{
{ngraph::element::f32},
{{0.32f, 0.32f, 0.32f, 0.32f}},
{{0.1f, 0.1f, 0.1f, 0.1f}}
},
ngraph::element::f32,
{}
}
},
};
INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
DepthToSpaceTransformation,
::testing::Combine(
::testing::ValuesIn(inputShapesWithDynamicChannel),
::testing::ValuesIn(testValues)),
DepthToSpaceTransformation::getTestCaseName);
} // namespace testValues3
namespace testValues4 {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicRank = {
PartialShape::dynamic(),
};
@ -364,5 +308,5 @@ INSTANTIATE_TEST_SUITE_P(
::testing::ValuesIn(inputShapesWithDynamicRank),
::testing::ValuesIn(testValues)),
DepthToSpaceTransformation::getTestCaseName);
} // namespace testValues4
} // namespace testValues3
} // namespace

View File

@ -143,7 +143,8 @@ const std::vector<bool> updatePrecisions = { true, false };
const std::vector<ngraph::PartialShape> shapes = {
{ 1, 3, 72, 48 },
{ Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic() },
{ -1, -1, -1, -1 },
PartialShape::dynamic(),
// TODO: 3D tensor
};
@ -356,51 +357,3 @@ INSTANTIATE_TEST_SUITE_P(
::testing::ValuesIn(fakeQuantizeTransformationTestValues)),
FakeQuantizeTransformation::getTestCaseName);
} // namespace testValues1
namespace testValues2 {
const std::vector<ngraph::PartialShape> shapesWithDynamicChannel = {
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
PartialShape::dynamic(),
};
const std::vector<FakeQuantizeTransformationTestValues> fakeQuantizeTransformationTestValues = {
{
LayerTransformation::createParamsU8I8(),
{ 256ul, {}, { 0.f }, { 2.55f }, { 0.f }, { 2.55f } },
{ 256ul, {}, { 0.f }, { 2.55f }, { 0.f }, { 255.f } },
ngraph::element::u8,
{
{ ngraph::element::f32, { {ngraph::element::f32}, {}, { 0.01f }} },
}
},
{
LayerTransformation::createParamsU8I8(),
{
256ul,
{{1, 3, 1, 1}, {1, 3, 1, 1}, {1, 3, 1, 1}, {1, 3, 1, 1}},
{ 0.f, 0.f, 0.f }, { 2.55f, 2.55f, 2.55f },
{ 0.f, 0.f, 0.f }, { 2.55f, 25.5f, 255.f }
},
{
256ul,
{{1, 3, 1, 1}, {1, 3, 1, 1}, {1, 3, 1, 1}, {1, 3, 1, 1}},
{ 0.f, 0.f, 0.f }, { 2.55f, 2.55f, 2.55f },
{ 0.f, 0.f, 0.f }, { 2.55f, 25.5f, 255.f }
},
ngraph::element::f32,
{
{ ngraph::element::f32, {} },
}
},
};
INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
FakeQuantizeTransformation,
::testing::Combine(
::testing::Values(ngraph::element::f32),
::testing::ValuesIn(shapesWithDynamicChannel),
::testing::Values(true),
::testing::ValuesIn(fakeQuantizeTransformationTestValues)),
FakeQuantizeTransformation::getTestCaseName);
} // namespace testValues2

View File

@ -137,10 +137,7 @@ TEST_P(GroupConvolutionTransformation, CompareFunctions) {
namespace testValues1 {
const std::vector<std::pair<ngraph::PartialShape, ngraph::PartialShape>> shapesForGroupConv = {
{{ 1, 6, 224, 224 }, { 1, 24, 218, 218 }},
{
{ Dimension::dynamic(), 6, Dimension::dynamic(), Dimension::dynamic() },
{ Dimension::dynamic(), 24, Dimension::dynamic(), Dimension::dynamic() }
}
{{ -1, -1, -1, -1 }, { -1, -1, -1, -1 }}
};
const std::vector<GroupConvolutionTestValues> testValuesGroupConv = {
@ -509,10 +506,7 @@ INSTANTIATE_TEST_SUITE_P(
namespace testValues2 {
const std::vector<std::pair<ngraph::PartialShape, ngraph::PartialShape>> shapesForDepthWiseConv = {
{{ 1, 6, 224, 224 }, { 1, 6, 218, 218 }},
{
{ Dimension::dynamic(), 6, Dimension::dynamic(), Dimension::dynamic() },
{ Dimension::dynamic(), 6, Dimension::dynamic(), Dimension::dynamic() }
}
{{ -1, 6, -1, -1 }, { -1, 6, -1, -1 }},
};
const std::vector<GroupConvolutionTestValues> testValuesForDepthWiseConv = {
@ -720,10 +714,6 @@ INSTANTIATE_TEST_SUITE_P(
namespace testValues3 {
const std::vector<std::pair<ngraph::PartialShape, ngraph::PartialShape>> shapesWithDynamicChannel = {
{
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() }
},
{ PartialShape::dynamic(), PartialShape::dynamic() }
};

View File

@ -227,7 +227,7 @@ const std::vector<InterpolateTransformationTestValues> testValues {
// nearest mode - move dequantization
{
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
{ -1, -1, -1, -1 },
ngraph::Shape{ 1, 4, 32, 32 },
ngraph::Shape{},
LayerTransformation::createParamsU8I8(),
@ -254,7 +254,7 @@ const std::vector<InterpolateTransformationTestValues> testValues {
// per-channel dequantization
{
{ Dimension::dynamic(), 4, Dimension::dynamic(), Dimension::dynamic() },
{ -1, 4, -1, -1 },
ngraph::Shape{ 1, 4, 32, 32 },
ngraph::Shape{},
LayerTransformation::createParamsU8I8(),
@ -281,7 +281,7 @@ const std::vector<InterpolateTransformationTestValues> testValues {
// per-channel dequantization and dynamic channels
{
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
{ -1, -1, -1, -1 },
ngraph::Shape{ 1, 4, 32, 32 },
ngraph::Shape{},
LayerTransformation::createParamsU8I8(),
@ -299,10 +299,10 @@ const std::vector<InterpolateTransformationTestValues> testValues {
{{ngraph::element::f32}, {{-0.32f, -0.31f, 0.31f, 0.32f}}, {{0.1f, 0.2f, 0.3f, 0.4f}}}
},
{
ngraph::element::u8,
{},
ngraph::element::u8,
{{ngraph::element::f32}, {{-0.32f, -0.31f, 0.31f, 0.32f}}, {{0.1f, 0.2f, 0.3f, 0.4f}}},
ngraph::element::f32,
{}
}
},
@ -442,7 +442,7 @@ const std::vector<InterpolateTransformationTestValues> testValues {
// nearest mode - move dequantization
{
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
{ -1, -1, -1, -1 },
ngraph::Shape{ 1, 4, 32, 32 },
ngraph::Shape{ 1, 1, 2, 2 },
LayerTransformation::createParamsU8I8(),
@ -467,7 +467,7 @@ const std::vector<InterpolateTransformationTestValues> testValues {
// per-channel dequantization
{
{ Dimension::dynamic(), 4, Dimension::dynamic(), Dimension::dynamic() },
{ -1, 4, -1, -1 },
ngraph::Shape{ 1, 4, 32, 32 },
ngraph::Shape{ 1, 1, 2, 2 },
LayerTransformation::createParamsU8I8(),
@ -492,7 +492,7 @@ const std::vector<InterpolateTransformationTestValues> testValues {
// per-channel dequantization and dynamic channels
{
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
{ -1, -1, -1, -1 },
ngraph::Shape{ 1, 4, 32, 32 },
ngraph::Shape{ 1, 1, 2, 2 },
LayerTransformation::createParamsU8I8(),
@ -508,10 +508,10 @@ const std::vector<InterpolateTransformationTestValues> testValues {
{{ngraph::element::f32}, {{-0.32f, -0.31f, 0.31f, 0.32f}}, {{0.1f, 0.2f, 0.3f, 0.4f}}}
},
{
ngraph::element::i8,
{},
ngraph::element::i8,
{{ngraph::element::f32}, {{-0.32f, -0.31f, 0.31f, 0.32f}}, {{0.1f, 0.2f, 0.3f, 0.4f}}},
ngraph::element::f32,
{}
}
},

View File

@ -147,10 +147,7 @@ const std::vector<ngraph::element::Type> precisions = {
namespace testValues1 {
const std::vector<std::pair<ngraph::PartialShape, ngraph::PartialShape>> shapes = {
{
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() }
},
{ { -1, -1, -1, -1 }, { -1, -1, -1, -1 } },
{ { 1, 16, 384, 64 }, { 1, 16, 64, 384 } },
{ { 4, 16, 384, 64 }, { 4, 16, 64, 384 } }
};
@ -392,10 +389,7 @@ INSTANTIATE_TEST_SUITE_P(
namespace testValues2 {
const std::vector<std::pair<ngraph::PartialShape, ngraph::PartialShape>> shapes = {
{
{ Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic() },
{ Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic() }
},
{ { -1, -1, -1, -1 }, { -1, -1, -1, -1 } },
{ { 1, 3, 384, 64 }, { 1, 3, 64, 384 } },
};
@ -451,10 +445,6 @@ INSTANTIATE_TEST_SUITE_P(
namespace testValues3 {
const std::vector<std::pair<ngraph::PartialShape, ngraph::PartialShape>> shapesWithDynamicChannels = {
{
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() }
},
{ PartialShape::dynamic(), PartialShape::dynamic() }
};

View File

@ -102,7 +102,7 @@ namespace testValues1 {
const std::vector<ngraph::PartialShape> shapes = {
{ 1, 3, 72, 48 },
{ 4, 3, 72, 48 },
{ Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic() },
{ -1, -1, -1, -1 },
};
const std::vector<MaxPoolTransformationTestValues> testValues = {
@ -239,7 +239,6 @@ INSTANTIATE_TEST_SUITE_P(
namespace testValues2 {
const std::vector<ngraph::PartialShape> shapesWithDynamicChannels = {
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
PartialShape::dynamic()
};

View File

@ -130,7 +130,7 @@ const std::vector<int> opset_version = {
namespace testValues1 {
const std::vector<ngraph::PartialShape> inputShapes = {
{ 1, 4, 16, 16 },
{ Dimension::dynamic(), 4, Dimension::dynamic(), Dimension::dynamic() },
{ -1, -1, -1, -1 },
};
const std::vector<MVNTransformationTestValues> testValues = {
@ -270,7 +270,7 @@ INSTANTIATE_TEST_SUITE_P(
namespace testValues2 {
const std::vector<ngraph::PartialShape> inputShapes = {
{ 1, 2, 2, 2 },
{ Dimension::dynamic(), 2, Dimension::dynamic(), Dimension::dynamic()}
{ -1, -1, -1, -1}
};
const std::vector<MVNTransformationTestValues> testValues = {
@ -332,56 +332,8 @@ INSTANTIATE_TEST_SUITE_P(
MVNTransformation::getTestCaseName);
} // namespace testValues2
namespace testValues3 {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicChannels = {
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic()},
};
const std::vector<MVNTransformationTestValues> testValues = {
{
{1, 2, 3},
true,
LayerTransformation::createParamsU8I8().setSupportAsymmetricQuantization(false),
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {0.45f}}
},
{
ngraph::element::u8,
{ },
ngraph::element::f32,
{{}, {}, {1.f}}
}
},
{
{1, 2, 3},
false,
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {{0.45f, 0.45f}, ngraph::element::f32, ngraph::Shape{ 1, 2, 1, 1 }}}
},
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {{0.45f, 0.45f}, ngraph::element::f32, ngraph::Shape{ 1, 2, 1, 1 }}},
ngraph::element::f32,
{{}, {}, {}}
}
},
};
INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
MVNTransformation,
::testing::Combine(
::testing::ValuesIn(precisions),
::testing::ValuesIn(inputShapesWithDynamicChannels),
::testing::ValuesIn(testValues),
::testing::ValuesIn(opset_version)),
MVNTransformation::getTestCaseName);
} // namespace testValues3
namespace testValues4 {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicRank = {
PartialShape::dynamic(),
};
@ -413,5 +365,5 @@ INSTANTIATE_TEST_SUITE_P(
::testing::ValuesIn(testValues),
::testing::ValuesIn(opset_version)),
MVNTransformation::getTestCaseName);
} // namespace testValues4
} // namespace testValues3
} // namespace

View File

@ -128,7 +128,7 @@ std::vector<std::vector<size_t>> axes = {
namespace testValues1 {
const std::vector<ngraph::PartialShape> shapes = {
{ 1, 3, 16, 16 },
{ Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic()}
{ -1, -1, -1, -1}
};
const std::vector<NormalizeL2TransformationTestValues> normalizeL2TransformationTestValues = {
@ -273,52 +273,6 @@ INSTANTIATE_TEST_SUITE_P(
} // namespace testValues1
namespace testValues2 {
const std::vector<ngraph::PartialShape> shapesWithDynamicChannels = {
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic()}
};
const std::vector<NormalizeL2TransformationTestValues> normalizeL2TransformationTestValues = {
{
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {-12.3f}}
},
{
ngraph::element::u8,
{},
ngraph::element::f32,
{{}, {}, {-1.f}}
}
},
{
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {{12.3f, 12.3f, 12.3f}}}
},
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {{12.3f, 12.3f, 12.3f}}},
ngraph::element::f32,
{}
}
},
};
INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
NormalizeL2Transformation,
::testing::Combine(
::testing::ValuesIn(precisions),
::testing::ValuesIn(shapesWithDynamicChannels),
::testing::ValuesIn(epsMode),
::testing::ValuesIn(axes),
::testing::ValuesIn(normalizeL2TransformationTestValues)),
NormalizeL2Transformation::getTestCaseName);
} // namespace testValues2
namespace testValues3 {
const std::vector<ngraph::PartialShape> shapesWithDynamicChannels = {
PartialShape::dynamic()
};
@ -349,5 +303,5 @@ INSTANTIATE_TEST_SUITE_P(
::testing::ValuesIn(axes),
::testing::ValuesIn(normalizeL2TransformationTestValues)),
NormalizeL2Transformation::getTestCaseName);
} // namespace testValues3
} // namespace testValues2
} // namespace

View File

@ -124,7 +124,7 @@ TEST_P(PadTransformation, CompareFunctions) {
const std::vector<ngraph::PartialShape> inputShapes = {
{1, 3, 6, 6},
{4, 3, 6, 6},
{Dimension::dynamic(), 3, 6, Dimension::dynamic()}
{-1, 3, 6, -1}
};
const std::pair<std::vector<uint64_t>, std::vector<uint64_t>> padsBySpatialDimensions = {
@ -136,6 +136,11 @@ const std::pair<std::vector<uint64_t>, std::vector<uint64_t>> padsBySpatialDimen
// (per-tensor & per-channel quantizations without subtracts, pads by spatial dimensions)
// and test-case without dequantization
namespace commonTestCases {
const std::vector<ngraph::PartialShape> commonInputShapes = {
{4, 3, 6, 6},
{-1, -1, -1, -1}
};
std::vector<ngraph::op::PadMode> allModes = {
ngraph::op::PadMode::EDGE,
ngraph::op::PadMode::REFLECT,
@ -241,7 +246,7 @@ INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
PadTransformation,
::testing::Combine(
::testing::ValuesIn(inputShapes),
::testing::ValuesIn(commonInputShapes),
::testing::Values(padsBySpatialDimensions),
::testing::ValuesIn(allModes),
::testing::Values(0.f),
@ -687,59 +692,6 @@ INSTANTIATE_TEST_SUITE_P(
PadTransformation::getTestCaseName);
} // namespace testCasesForSymetricMode
namespace testCasesWithDynamicChannels {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicChannels = {
{Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic()}
};
std::vector<ngraph::op::PadMode> allModes = {
ngraph::op::PadMode::EDGE,
ngraph::op::PadMode::REFLECT,
ngraph::op::PadMode::SYMMETRIC,
ngraph::op::PadMode::CONSTANT,
};
const std::vector<PadTransformationTestValues> testValuesForDynamicChannels = {
{
LayerTransformation::createParamsI8I8(),
{
ngraph::element::i8,
{{ngraph::element::f32}, {}, {3.f}}
},
{
ngraph::element::i8,
{{}, {}, {}},
ngraph::element::i8,
{{ngraph::element::f32}, {}, {3.f}}
}
},
{
LayerTransformation::createParamsI8I8(),
{
ngraph::element::i8,
{{ngraph::element::f32}, {}, {{3.f, 1.f, 2.f}}}
},
{
ngraph::element::i8,
{{ngraph::element::f32}, {}, {{3.f, 1.f, 2.f}}},
ngraph::element::f32,
{{}, {}, {}},
}
},
};
INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
PadTransformation,
::testing::Combine(
::testing::ValuesIn(inputShapesWithDynamicChannels),
::testing::Values(padsBySpatialDimensions),
::testing::ValuesIn(allModes),
::testing::Values(0.f),
::testing::ValuesIn(testValuesForDynamicChannels)),
PadTransformation::getTestCaseName);
} // namespace testCasesWithDynamicChannels
namespace testCasesWithDynamicRank {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicRank = {
ngraph::PartialShape::dynamic()

View File

@ -103,7 +103,7 @@ TEST_P(PReluTransformation, CompareFunctions) {
namespace testValues1 {
const std::vector<ngraph::PartialShape> shapes = {
{ 1, 3, 16, 16 },
{ Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic() },
{ -1, -1, -1, -1 },
};
const std::vector<PReluTransformationTestValues> testValues = {
@ -175,49 +175,6 @@ INSTANTIATE_TEST_SUITE_P(
} // namespace testValues1
namespace testValues2 {
const std::vector<ngraph::PartialShape> shapesWithDynamicChannels = {
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
};
const std::vector<PReluTransformationTestValues> testValues = {
{
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {0.1f}}
},
{
ngraph::element::u8,
{{}, {}, {}},
ngraph::element::f32,
{{}, {}, {0.1f}}
}
},
{
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {{0.1f, 0.2f, 0.3f}}}
},
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {{0.1f, 0.2f, 0.3f}}},
ngraph::element::f32,
{{}, {}, {}}
}
},
};
INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
PReluTransformation,
::testing::Combine(
::testing::ValuesIn(shapesWithDynamicChannels),
::testing::ValuesIn(testValues)),
PReluTransformation::getTestCaseName);
} // namespace testValues2
namespace testValues3 {
const std::vector<ngraph::PartialShape> shapesWithDynamicRank = {
PartialShape::dynamic()
};
@ -245,6 +202,6 @@ INSTANTIATE_TEST_SUITE_P(
::testing::ValuesIn(shapesWithDynamicRank),
::testing::ValuesIn(testValues)),
PReluTransformation::getTestCaseName);
} // namespace testValues3
} // namespace testValues2
} // namespace

View File

@ -50,7 +50,7 @@ namespace testValues1 {
const std::vector<ngraph::PartialShape> inputShapes = {
{1, 3, 16, 16},
{4, 3, 16, 16},
{Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic()}
{-1, -1, -1, -1}
};
const std::vector<ReduceTransformationTestValues> reduceMaxTransformationTestValues = {
@ -314,53 +314,6 @@ INSTANTIATE_TEST_SUITE_P(
} // namespace testValues1
namespace testValues2 {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicChannels = {
{Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic()}
};
const std::vector<ReduceTransformationTestValues> reduceMaxTransformationTestValues = {
{
LayerTransformation::createParamsU8I8(),
{2, 3},
true,
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {{0.1f, 1.f, 10.f}, ngraph::element::f32, {1, 3, 1, 1}}}
},
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {{0.1f, 1.f, 10.f}, ngraph::element::f32, {1, 3, 1, 1}}},
ngraph::element::f32,
{}
}
},
{
LayerTransformation::createParamsU8I8(),
{-2},
false,
{
ngraph::element::u8,
{{ngraph::element::f32}, {128.f}, {0.1f}}
},
{
ngraph::element::u8,
{},
ngraph::element::u8,
{{ngraph::element::f32}, {128.f}, {0.1f}}
}
},
};
INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
ReduceMaxTransformation,
::testing::Combine(
::testing::ValuesIn(inputShapesWithDynamicChannels),
::testing::ValuesIn(reduceMaxTransformationTestValues)),
ReduceMaxTransformation::getTestCaseName);
} // namespace testValues2
namespace testValues3 {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicRank = {
PartialShape::dynamic()
};
@ -390,5 +343,5 @@ INSTANTIATE_TEST_SUITE_P(
::testing::ValuesIn(inputShapesWithDynamicRank),
::testing::ValuesIn(reduceMaxTransformationTestValues)),
ReduceMaxTransformation::getTestCaseName);
} // namespace testValues3
} // namespace testValues2
} // namespace

View File

@ -50,7 +50,7 @@ namespace testValues1 {
const std::vector<ngraph::PartialShape> inputShapes = {
{1, 3, 16, 16},
{4, 3, 16, 16},
{Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic()}
{-1, -1, -1, -1}
};
const std::vector<ReduceTransformationTestValues> reduceMeanTransformationTestValues = {
@ -282,53 +282,6 @@ INSTANTIATE_TEST_SUITE_P(
} // namespace testValues1
namespace testValues2 {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicChannels = {
{Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic()}
};
const std::vector<ReduceTransformationTestValues> reduceMeanTransformationTestValues = {
{
LayerTransformation::createParamsU8I8(),
{-2},
false,
{
ngraph::element::u8,
{{ngraph::element::f32}, {128.f}, {0.1f}}
},
{
ngraph::element::u8,
{},
ngraph::element::f32,
{{}, {128.f}, {0.1f}}
}
},
{
LayerTransformation::createParamsU8I8(),
{0},
true,
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {{0.1f, 1.f, 10.f}, ngraph::element::f32, {1, 3, 1, 1}}}
},
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {{0.1f, 1.f, 10.f}, ngraph::element::f32, {1, 3, 1, 1}}},
ngraph::element::f32,
{}
}
}
};
INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
ReduceMeanTransformation,
::testing::Combine(
::testing::ValuesIn(inputShapesWithDynamicChannels),
::testing::ValuesIn(reduceMeanTransformationTestValues)),
ReduceMeanTransformation::getTestCaseName);
} // namespace testValues2
namespace testValues3 {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicRank = {
PartialShape::dynamic()
};
@ -358,5 +311,5 @@ INSTANTIATE_TEST_SUITE_P(
::testing::ValuesIn(inputShapesWithDynamicRank),
::testing::ValuesIn(reduceMeanTransformationTestValues)),
ReduceMeanTransformation::getTestCaseName);
} // namespace testValues3
} // namespace testValues2
} // namespace

View File

@ -50,7 +50,7 @@ namespace testValues1 {
const std::vector<ngraph::PartialShape> inputShapes = {
{1, 3, 16, 16},
{4, 3, 16, 16},
{Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic()}
{-1, -1, -1, -1}
};
const std::vector<ReduceTransformationTestValues> reduceMinTransformationTestValues = {
@ -314,53 +314,6 @@ INSTANTIATE_TEST_SUITE_P(
} // namespace testValues1
namespace testValues2 {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicChannels = {
{Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic()}
};
const std::vector<ReduceTransformationTestValues> reduceMeanTransformationTestValues = {
{
LayerTransformation::createParamsU8I8(),
{-2},
false,
{
ngraph::element::u8,
{{ngraph::element::f32}, {128.f}, {0.1f}}
},
{
ngraph::element::u8,
{},
ngraph::element::u8,
{{ngraph::element::f32}, {128.f}, {0.1f}}
}
},
{
LayerTransformation::createParamsU8I8(),
{0},
true,
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {{0.1f, 1.f, 10.f}, ngraph::element::f32, {1, 3, 1, 1}}}
},
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {{0.1f, 1.f, 10.f}, ngraph::element::f32, {1, 3, 1, 1}}},
ngraph::element::f32,
{}
}
}
};
INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
ReduceMinTransformation,
::testing::Combine(
::testing::ValuesIn(inputShapesWithDynamicChannels),
::testing::ValuesIn(reduceMeanTransformationTestValues)),
ReduceMinTransformation::getTestCaseName);
} // namespace testValues2
namespace testValues3 {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicRank = {
PartialShape::dynamic()
};
@ -390,5 +343,5 @@ INSTANTIATE_TEST_SUITE_P(
::testing::ValuesIn(inputShapesWithDynamicRank),
::testing::ValuesIn(reduceMinTransformationTestValues)),
ReduceMinTransformation::getTestCaseName);
} // namespace testValues3
} // namespace testValues2
} // namespace

View File

@ -50,7 +50,7 @@ namespace testValues1 {
const std::vector<ngraph::PartialShape> inputShapes = {
{1, 3, 16, 16},
{4, 3, 16, 16},
{Dimension::dynamic(), 3, 16, 16}
{-1, -1, 16, 16}
};
const std::vector<ReduceTransformationTestValues> reduceSumTransformationTestValues = {
@ -306,68 +306,6 @@ INSTANTIATE_TEST_SUITE_P(
} // namespace testValues1
namespace testValues2 {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicChannels = {
{Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic()}
};
const std::vector<ReduceTransformationTestValues> reduceSumTransformationTestValues = {
{
LayerTransformation::createParamsU8I8(),
{-2},
false,
{
ngraph::element::u8,
{{ngraph::element::f32}, {128.f}, {0.1f}}
},
{
ngraph::element::u8,
{{ngraph::element::f32}, {128.f}, {0.1f}},
ngraph::element::f32,
{}
}
},
{
LayerTransformation::createParamsU8I8(),
{2, 3},
false,
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {0.1f}}
},
{
ngraph::element::u8,
{},
ngraph::element::f32,
{{}, {}, {0.1f}}
}
},
{
LayerTransformation::createParamsU8I8(),
{2, 3},
false,
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {{0.1f, 1.f, 10.f}}}
},
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {{0.1f, 1.f, 10.f}}},
ngraph::element::f32,
{}
}
},
};
INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
ReduceSumTransformation,
::testing::Combine(
::testing::ValuesIn(inputShapesWithDynamicChannels),
::testing::ValuesIn(reduceSumTransformationTestValues)),
ReduceSumTransformation::getTestCaseName);
} // namespace testValues2
namespace testValues3 {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicRank = {
PartialShape::dynamic()
};
@ -397,5 +335,5 @@ INSTANTIATE_TEST_SUITE_P(
::testing::ValuesIn(inputShapesWithDynamicRank),
::testing::ValuesIn(reduceSumTransformationTestValues)),
ReduceSumTransformation::getTestCaseName);
} // namespace testValues3
} // namespace testValues2
} // namespace

View File

@ -103,7 +103,7 @@ TEST_P(ReluTransformation, CompareFunctions) {
namespace testValues1 {
const std::vector<ngraph::PartialShape> shapes = {
{ 1, 3, 16, 16 },
{ Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic() },
{ -1, -1, -1, -1 },
};
const std::vector<ReluTransformationTestValues> testValues = {
@ -245,49 +245,6 @@ INSTANTIATE_TEST_SUITE_P(
} // namespace testValues1
namespace testValues2 {
const std::vector<ngraph::PartialShape> shapesWithDynamicChannels = {
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
};
const std::vector<ReluTransformationTestValues> testValues = {
{
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {0.1f}}
},
{
ngraph::element::u8,
{{}, {}, {}},
ngraph::element::u8,
{{ngraph::element::f32}, {}, {0.1f}}
}
},
{
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {{0.1f, 0.2f, 0.3f}}}
},
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {{0.1f, 0.2f, 0.3f}}},
ngraph::element::f32,
{{}, {}, {}}
}
},
};
INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
ReluTransformation,
::testing::Combine(
::testing::ValuesIn(shapesWithDynamicChannels),
::testing::ValuesIn(testValues)),
ReluTransformation::getTestCaseName);
}// namespace testValues2
namespace testValues3 {
const std::vector<ngraph::PartialShape> shapesWithDynamicRank = {
PartialShape::dynamic()
};
@ -315,5 +272,5 @@ INSTANTIATE_TEST_SUITE_P(
::testing::ValuesIn(shapesWithDynamicRank),
::testing::ValuesIn(testValues)),
ReluTransformation::getTestCaseName);
} // namespace testValues3
} // namespace testValues2
} // namespace

View File

@ -116,7 +116,7 @@ const std::vector<ReshapeTransformationTestValues> testValues = {
},
// U8: 3D -> 4D: dynamic shape
{
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
{ -1, -1, -1 },
{ 0, 384, 16, 64 },
LayerTransformation::createParamsU8I8(),
{
@ -252,7 +252,7 @@ const std::vector<ReshapeTransformationTestValues> testValues = {
},
// U8: with subtract 3D -> 4D: channels are not affected, dynamic batch
{
{ Dimension::dynamic(), 3, 20 },
{ -1, 3, 20 },
{ 0, 3, 4, 5},
LayerTransformation::createParamsU8I8(),
{
@ -276,7 +276,7 @@ const std::vector<ReshapeTransformationTestValues> testValues = {
},
// U8: with subtract 3D -> 4D: channels are not affected, dynamic shape
{
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
{ -1, -1, -1 },
{ 0, 3, 4, 5},
LayerTransformation::createParamsU8I8(),
{
@ -288,14 +288,14 @@ const std::vector<ReshapeTransformationTestValues> testValues = {
}
},
{
ngraph::element::u8,
{},
ngraph::element::u8,
{
{ngraph::element::f32},
{{32, 64, 128}, ngraph::element::f32, {1, 3, 1}},
{{0.1f, 0.2f, 0.3f}, ngraph::element::f32, {1, 3, 1}}
},
ngraph::element::f32,
{}
{{32, 64, 128}, ngraph::element::f32, {1, 3, 1, 1}},
{{0.1f, 0.2f, 0.3f}, ngraph::element::f32, {1, 3, 1, 1}}
}
}
},
// U8: no subtract 3D -> 4D: channels are not affected: with subtract
@ -612,7 +612,7 @@ const std::vector<ReshapeTransformationTestValues> testValues = {
},
// U8: 4D -> 2D: per channel dq and dynamic batch
{
{ Dimension::dynamic(), 3, 2, 2 },
{ -1, 3, 2, 2 },
{ 0, -1 },
LayerTransformation::createParamsU8I8(),
{
@ -780,7 +780,7 @@ const std::vector<ReshapeTransformationTestValues> testValues = {
},
// U8: no subtract 4D -> 2D: channels are not affected, dynamic batch
{
{ Dimension::dynamic(), 2048, 1, 1 },
{ -1, 2048, 1, 1 },
{ 0, -1},
LayerTransformation::createParamsU8I8(),
{
@ -924,7 +924,7 @@ const std::vector<ReshapeTransformationTestValues> testValues = {
},
// U8: without subtract 2D -> 2D
{
{ Dimension::dynamic(), 2 },
{ -1, 2 },
{ -1, 6 },
LayerTransformation::createParamsU8I8(),
{

View File

@ -103,7 +103,7 @@ namespace testValues1 {
const std::vector<ngraph::PartialShape> inputShapes = {
{ 1, 3, 8, 10 },
{ 4, 3, 8, 10 },
{ Dimension::dynamic(), 3, 8, Dimension::dynamic() }
{ -1, -1, -1, -1 }
};
const std::vector<ShuffleChannelsTransformationTestValues> testValues = {
@ -295,55 +295,6 @@ INSTANTIATE_TEST_SUITE_P(
} // namespace testValues1
namespace testValues2 {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicChannels = {
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
};
const std::vector<ShuffleChannelsTransformationTestValues> testValues = {
// U8 per tensor quantization
{
LayerTransformation::createParamsU8I8(),
1, // axis
1, // group
{
ngraph::element::u8,
{{ngraph::element::f32}, {128.f}, {0.02f}}
},
{
ngraph::element::u8,
{},
ngraph::element::u8,
{{ngraph::element::f32}, {128.f}, {0.02f}}
}
},
// U8 per channel quantization
{
LayerTransformation::createParamsU8I8(),
1,
1,
{
ngraph::element::u8,
{{ngraph::element::f32}, {{128.f, 64.f, 32.f}}, {{0.01f, 0.02f, 0.03f}}}
},
{
ngraph::element::u8,
{{ngraph::element::f32}, {{128.f, 64.f, 32.f}}, {{0.01f, 0.02f, 0.03f}}},
ngraph::element::f32,
{}
}
},
};
INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
ShuffleChannelsTransformation,
::testing::Combine(
::testing::ValuesIn(inputShapesWithDynamicChannels),
::testing::ValuesIn(testValues)),
ShuffleChannelsTransformation::getTestCaseName);
} // namespace testValues2
namespace testValues3 {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicRank = {
ngraph::PartialShape::dynamic()
};
@ -374,5 +325,5 @@ INSTANTIATE_TEST_SUITE_P(
::testing::ValuesIn(inputShapesWithDynamicRank),
::testing::ValuesIn(testValues)),
ShuffleChannelsTransformation::getTestCaseName);
} // namespace testValues3
} // namespace testValues2
} // namespace

View File

@ -137,7 +137,7 @@ const std::vector<SplitTransformationTestValues> testValues = {
}
},
{
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() }, std::int64_t{2}, size_t{2},
{ -1, -1, -1, -1 }, std::int64_t{2}, size_t{2},
LayerTransformation::createParamsU8I8(),
// ActualValues
{
@ -212,7 +212,7 @@ const std::vector<SplitTransformationTestValues> testValues = {
},
// U8 per channel quantization with different values and dynamic shapes
{
{ Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic() }, std::int64_t{1}, size_t{3},
{ -1, 3, -1, -1 }, std::int64_t{1}, size_t{3},
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
@ -233,7 +233,7 @@ const std::vector<SplitTransformationTestValues> testValues = {
},
// U8 per channel quantization with different values and dynamic shapes (dynamic channels)
{
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() }, std::int64_t{1}, size_t{3},
{ -1, -1, -1, -1 }, std::int64_t{1}, size_t{3},
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
@ -243,11 +243,13 @@ const std::vector<SplitTransformationTestValues> testValues = {
},
{
ngraph::element::u8,
{{ngraph::element::f32},
{{1.f, 2.f, 3.f}, ngraph::element::f32, {1, 3, 1, 1}},
{{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}},
ngraph::element::f32,
{}
{},
ngraph::element::u8,
{
{{ngraph::element::f32}, {1.f}, {11.f}},
{{ngraph::element::f32}, {2.f}, {22.f}},
{{ngraph::element::f32}, {3.f}, {33.f}},
}
}
},
// U8 per channel quantization with different values (constants without batch)
@ -423,7 +425,7 @@ const std::vector<SplitTransformationTestValues> testValues = {
},
// U8 without subtract, dynamic shape
{
{ Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic() },
{ -1, 3, -1, -1 },
std::int64_t{-3}, size_t{3},
LayerTransformation::createParamsU8I8(),
{
@ -445,7 +447,7 @@ const std::vector<SplitTransformationTestValues> testValues = {
},
// U8 without subtract, dynamic shape (dynamic channels)
{
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
{ -1, -1, -1, -1 },
std::int64_t{-3}, size_t{3},
LayerTransformation::createParamsU8I8(),
{
@ -456,11 +458,13 @@ const std::vector<SplitTransformationTestValues> testValues = {
},
{
ngraph::element::u8,
{{ngraph::element::f32},
{},
{{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}},
ngraph::element::f32,
{}
ngraph::element::u8,
{
{{ngraph::element::f32}, {}, {11.f}},
{{ngraph::element::f32}, {}, {22.f}},
{{ngraph::element::f32}, {}, {33.f}},
}
}
},
// I8 without subtract
@ -558,7 +562,7 @@ const std::vector<SplitTransformationTestValues> testValues = {
},
// issue #56781: unsupported Concat after Split, dynamic channels
{
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
{ -1, -1, -1, -1 },
std::int64_t{2}, size_t{3},
LayerTransformation::createParamsU8I8(),
{

View File

@ -183,7 +183,7 @@ StridedSliceTransformationTestValues::LayerParams sliceWithAdditionalAxis = {
namespace testValues1 {
const std::vector<ngraph::PartialShape> inputShapes = {
{1, 3, 24, 24},
{Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic()}
{-1, -1, -1, -1}
};
const std::vector<StridedSliceTransformationTestValues> stridedSliceTransformationTestValues = {
@ -504,7 +504,7 @@ INSTANTIATE_TEST_SUITE_P(
namespace testValues2 {
const std::vector<ngraph::PartialShape> inputShapes = {
{ Dimension::dynamic(), Dimension::dynamic(), 4, Dimension::dynamic() },
{ -1, -1, -1, -1 },
{ 1, 3, 4, 4 }
};
@ -545,7 +545,6 @@ INSTANTIATE_TEST_SUITE_P(
namespace testValues3 {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicChannels = {
{Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic()},
PartialShape::dynamic()
};

View File

@ -103,7 +103,7 @@ TEST_P(TransposeTransformation, CompareFunctions) {
namespace testValues1 {
const std::vector<ngraph::PartialShape> inputShapes4D = {
{ 1, 3, 16, 16 },
{ Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic() }
{ -1, -1, -1, -1 }
};
const std::vector<TransposeTransformationTestValues> testValues = {
@ -197,7 +197,7 @@ INSTANTIATE_TEST_SUITE_P(
namespace testValues2 {
const std::vector<ngraph::PartialShape> inputShapes3D = {
{ 1, 16, 512 },
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic()}
{ -1, -1, -1}
};
const std::vector<TransposeTransformationTestValues> testValues = {
@ -227,68 +227,6 @@ INSTANTIATE_TEST_SUITE_P(
} // namespace testValues2
namespace testValues3 {
const std::vector<ngraph::PartialShape> inputShapes4DWithDynamicChannels = {
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic()}
};
const std::vector<TransposeTransformationTestValues> testValues = {
{
{ 0, 1, 3, 2 },
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{
{ngraph::element::f32},
{ {128}, ngraph::element::f32, {}, true, 1, ngraph::element::u8, true },
{0.1f}
}
},
{
ngraph::element::u8,
{{}, {}, {}},
ngraph::element::u8,
{
{ngraph::element::f32},
{ {128}, ngraph::element::f32, {}, true, 1, ngraph::element::u8, true },
{0.1f}
}
}
},
// U8: per-channel quantization
{
{ 0, 1, 3, 2 },
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{
{ ngraph::element::f32 },
{{ 128, 64, 32 }, ngraph::element::f32, { 1, 3, 1, 1 }},
{{ 0.3f, 0.2f, 0.1f }, ngraph::element::f32, { 1, 3, 1, 1 }}
}
},
{
ngraph::element::u8,
{
{ ngraph::element::f32 },
{{ 128, 64, 32 }, ngraph::element::f32, { 1, 3, 1, 1 }},
{{ 0.3f, 0.2f, 0.1f }, ngraph::element::f32, { 1, 3, 1, 1 }}
},
ngraph::element::f32,
{{}, {}, {}}
}
},
};
INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
TransposeTransformation,
::testing::Combine(
::testing::ValuesIn(inputShapes4DWithDynamicChannels),
::testing::ValuesIn(testValues)),
TransposeTransformation::getTestCaseName);
} // namespace testValues3
namespace testValues4 {
const std::vector<ngraph::PartialShape> inputShapesWithDynamicRank = {
PartialShape::dynamic()
};
@ -325,36 +263,36 @@ INSTANTIATE_TEST_SUITE_P(
::testing::ValuesIn(inputShapesWithDynamicRank),
::testing::ValuesIn(testValues)),
TransposeTransformation::getTestCaseName);
} // namespace testValues4
namespace testValues5 {
const std::vector<ngraph::PartialShape> inputShapes6D = {
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(),
Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() }
};
} // namespace testValues3
const std::vector<TransposeTransformationTestValues> testValues = {
namespace testValues4 {
const std::vector<ngraph::PartialShape> inputShapes6D = {
{ -1, -1, -1, -1, -1, -1 }
};
const std::vector<TransposeTransformationTestValues> testValues = {
{
{ 0, 1, 2, 3, 4, 5},
LayerTransformation::createParamsU8I8(),
{
{ 0, 1, 2, 3, 4, 5},
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{{ngraph::element::f32}, {128}, {0.1f}}
},
{
ngraph::element::u8,
{{}, {}, {}},
ngraph::element::u8,
{{ngraph::element::f32}, {128}, {0.1f}}
}
ngraph::element::u8,
{{ngraph::element::f32}, {128}, {0.1f}}
},
};
{
ngraph::element::u8,
{{}, {}, {}},
ngraph::element::u8,
{{ngraph::element::f32}, {128}, {0.1f}}
}
},
};
INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
TransposeTransformation,
::testing::Combine(
::testing::ValuesIn(inputShapes6D),
::testing::ValuesIn(testValues)),
TransposeTransformation::getTestCaseName);
} // namespace testValues5
INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
TransposeTransformation,
::testing::Combine(
::testing::ValuesIn(inputShapes6D),
::testing::ValuesIn(testValues)),
TransposeTransformation::getTestCaseName);
} // namespace testValues4
} // namespace

View File

@ -118,7 +118,7 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
},
// U8 per tensor quantization
{
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
{ -1, -1, -1, -1 },
std::int64_t{2}, std::vector<size_t>{ 10, 6 },
LayerTransformation::createParamsU8I8(),
// ActualValues
@ -198,7 +198,7 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
},
// U8 per channel quantization with different values, dynamic shape
{
{ Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic() },
{ -1, 3, -1, -1 },
std::int64_t{1}, std::vector<size_t>{ 2, 1 },
LayerTransformation::createParamsU8I8(),
{
@ -223,7 +223,7 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
},
// U8 per channel quantization with different values, dynamic shape (dynamic channels)
{
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
{ -1, -1, -1, -1 },
std::int64_t{1}, std::vector<size_t>{ 2, 1 },
LayerTransformation::createParamsU8I8(),
{
@ -234,11 +234,16 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
},
{
ngraph::element::u8,
{{ngraph::element::f32},
{{1.f, 2.f, 3.f}, ngraph::element::f32, {1, 3, 1, 1}},
{{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}},
ngraph::element::f32,
{}
{},
ngraph::element::u8,
{
{
{ngraph::element::f32},
{{1.f, 2.f}, ngraph::element::f32, {1, 2, 1, 1}},
{{11.f, 22.f}, ngraph::element::f32, {1, 2, 1, 1}}
},
{{ngraph::element::f32}, {3.f}, {33.f}}
}
}
},
// U8 per channel quantization with different values (constants without batch)
@ -350,7 +355,7 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
},
// U8 split second dimension, dynamic shape
{
{ Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic() },
{ -1, -1, -1, -1 },
std::int64_t{-1}, std::vector<size_t>{ 10, 4, 2 },
LayerTransformation::createParamsU8I8(),
{