Skip to content

Commit

Permalink
LPT ngraph cleanup (openvinotoolkit#22265)
Browse files Browse the repository at this point in the history
  • Loading branch information
vurusovs authored Jan 19, 2024
1 parent 635665a commit c8f9033
Show file tree
Hide file tree
Showing 73 changed files with 736 additions and 737 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,60 +16,60 @@ const std::vector<ov::element::Type> netPrecisions = {

const std::vector<LayerTestsDefinitions::AddTestValues> params = {
{
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -12.8f }, { 12.7f } },
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -12.8f }, { 12.7f } },
false,
{ngraph::element::i8}, {ngraph::element::f32, ngraph::element::i8}
{ov::element::i8}, {ov::element::f32, ov::element::i8}
},
{
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -128.f }, { 127.f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -128.f }, { 127.f } },
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
false,
{ngraph::element::i8}, {ngraph::element::f32, ngraph::element::i8}
{ov::element::i8}, {ov::element::f32, ov::element::i8}
},
{
{ 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 }, { -128.f }, { 127.f } },
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } },
true,
{ngraph::element::i8}, {ngraph::element::i8, ngraph::element::f32}
{ov::element::i8}, {ov::element::i8, ov::element::f32}
},
{
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -12.8f }, { 12.7f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -12.8f }, { 12.7f } },
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
true,
{ngraph::element::i8}, {ngraph::element::i8, ngraph::element::f32}
{ov::element::i8}, {ov::element::i8, ov::element::f32}
},
{
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -12.7f }, { 12.8f } },
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -12.7f }, { 12.8f } },
false,
{ngraph::element::u8}, {ngraph::element::f32, ngraph::element::u8}
{ov::element::u8}, {ov::element::f32, ov::element::u8}
},
{
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -128.f }, { 127.f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -128.f }, { 127.f } },
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
false,
{ngraph::element::u8}, {ngraph::element::f32, ngraph::element::u8}
{ov::element::u8}, {ov::element::f32, ov::element::u8}
},
{
{ 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 }, { -127.f }, { 128.f } },
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -127.f }, { 128.f } },
true,
{ngraph::element::u8}, {ngraph::element::u8, ngraph::element::f32}
{ov::element::u8}, {ov::element::u8, ov::element::f32}
},
{
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -12.8f }, { 12.7f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -12.8f }, { 12.7f } },
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
true,
{ngraph::element::u8}, {ngraph::element::u8, ngraph::element::f32}
{ov::element::u8}, {ov::element::u8, ov::element::f32}
},
{ {}, {}, false }, { {}, {}, true },
};

INSTANTIATE_TEST_SUITE_P(smoke_LPT, AddTransformation,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })),
::testing::Values(ov::PartialShape({ 1, 3, 16, 16 })),
::testing::Values(ov::test::utils::DEVICE_CPU),
::testing::ValuesIn(params)),
AddTransformation::getTestCaseName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ const std::vector<ov::pass::low_precision::LayerTransformation::Params> trasform
const std::vector<LayerTestsDefinitions::AssignAndReadValueTransformationParam> params{
// u8
{
{ 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 12.8f } },
{ 256ul, ov::Shape{ 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 12.8f } },
},
// u16
{
{ 65536ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 12.8f } },
{ 65536ul, ov::Shape{ 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 12.8f } },
},
// u32
{
{ 4294967296ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 12.8f } },
{ 4294967296ul, ov::Shape{ 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 12.8f } },
},
};

INSTANTIATE_TEST_SUITE_P(smoke_LPT, AssignAndReadValueTransformation,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })),
::testing::Values(ov::PartialShape({ 1, 3, 16, 16 })),
::testing::ValuesIn(opsetVersions),
::testing::Values(ov::test::utils::DEVICE_CPU),
::testing::ValuesIn(trasformationParamValues),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const std::vector<BatchToSpaceTransformationParam> params = {
{
{ 4, 3, 50, 86 },
{ 1, 1, 2, 2 }, { 0, 0, 0, 0 }, { 0, 0, 0, 1 },
{ 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 2.55f }, { 0.f }, { 2.55f } },
{ 256ul, ov::Shape{ 1, 1, 1, 1 }, { 0.f }, { 2.55f }, { 0.f }, { 2.55f } },
"BatchToSpace",
"u8"
},
Expand All @@ -29,7 +29,7 @@ const std::vector<BatchToSpaceTransformationParam> params = {
{ 1, 1, 2, 2 }, { 0, 0, 0, 0 }, { 0, 0, 0, 1 },
{
256ul,
ngraph::Shape{ 1, 3, 1, 1 },
ov::Shape{ 1, 3, 1, 1 },
{ 0.f, 0.f, 0.f },
{ 255.f, 255.f/2.f, 255.f/3.f },
{ 0.f, 0.f, 0.f },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const std::vector<ov::pass::low_precision::LayerTransformation::Params> trasform
const std::vector<LayerTestsDefinitions::ClampTransformationParam> params{
// tensor quantization
{
{ 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 12.8f } },
{ 256ul, ov::Shape{ 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 12.8f } },
{
{},
{{0.f, 0.f, 0.f}},
Expand All @@ -37,7 +37,7 @@ const std::vector<LayerTestsDefinitions::ClampTransformationParam> params{
},
// tensor quantization
{
{ 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { -12.8f }, { 12.7f } },
{ 256ul, ov::Shape{ 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { -12.8f }, { 12.7f } },
{
{},
{{0.f, 0.f, 0.f}},
Expand All @@ -49,7 +49,7 @@ const std::vector<LayerTestsDefinitions::ClampTransformationParam> params{
// per-channel quantization with the same values
{
{
256ul, ngraph::Shape{ 1, 3, 1, 1 },
256ul, ov::Shape{ 1, 3, 1, 1 },
{ -127.f, -127.f, -127.f },
{ 128.f, 128.f, 128.f },
{ 0.f, 0.f, 0.f },
Expand All @@ -63,7 +63,7 @@ const std::vector<LayerTestsDefinitions::ClampTransformationParam> params{
{
{
256ul,
ngraph::Shape{ 1, 3, 1, 1 },
ov::Shape{ 1, 3, 1, 1 },
{ -127.f, 0.f, 128.f / 2.f },
{ 128.f / 4.f, 128.f / 2.f, 128.f },
{ 0.f, 0.f, 0.f },
Expand All @@ -78,7 +78,7 @@ const std::vector<LayerTestsDefinitions::ClampTransformationParam> params{
INSTANTIATE_TEST_SUITE_P(smoke_LPT, ClampTransformation,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })),
::testing::Values(ov::PartialShape({ 1, 3, 16, 16 })),
::testing::Values(ov::test::utils::DEVICE_CPU),
::testing::ValuesIn(trasformationParamValues),
::testing::ValuesIn(params)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,71 +18,71 @@ const std::vector<ConcatTransformationTestValues> testValues = {
// U8
{
{},
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, ov::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{},
{},
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, ov::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{}
},
// I8
{
{},
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} },
{ 256ul, ov::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} },
{},
{},
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} },
{ 256ul, ov::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} },
{}
},
// mixed: U8 + I8
{
{},
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, ov::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{},
{},
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} },
{ 256ul, ov::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} },
{}
},
// mixed: I8 + U8
{
{},
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} },
{ 256ul, ov::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} },
{},
{},
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, ov::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{}
},
// FQ with unexpected quantizationLevels
{
{},
{ 14ul, ngraph::Shape({}), {0.f}, {15.f}, {0.f}, {1.5f} },
{ 14ul, ov::Shape({}), {0.f}, {15.f}, {0.f}, {1.5f} },
{},
{},
{ 14ul, ngraph::Shape({}), {0.f}, {15.f}, {0.f}, {1.5f} },
{ 14ul, ov::Shape({}), {0.f}, {15.f}, {0.f}, {1.5f} },
{}
},
// FQ with INT4 quantizationLevels
{
{},
{ 16ul, ngraph::Shape({}), {0.f}, {15.f}, {0.f}, {1.5f} },
{ 16ul, ov::Shape({}), {0.f}, {15.f}, {0.f}, {1.5f} },
{},
{},
{ 16ul, ngraph::Shape({}), {0.f}, {15.f}, {0.f}, {1.5f} },
{ 16ul, ov::Shape({}), {0.f}, {15.f}, {0.f}, {1.5f} },
{}
},
// FQ with INT4+INT8 quantizationLevels
{
{},
{ 16ul, ngraph::Shape({}), {0.f}, {15.f}, {0.f}, {1.5f} },
{ 16ul, ov::Shape({}), {0.f}, {15.f}, {0.f}, {1.5f} },
{},
{},
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, ov::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{}
},
};

const std::vector<ngraph::PartialShape> shapes = {
ngraph::Shape({ 1, 3, 16, 16 }),
ngraph::Shape({ 4, 3, 16, 16 })
const std::vector<ov::PartialShape> shapes = {
ov::Shape({ 1, 3, 16, 16 }),
ov::Shape({ 4, 3, 16, 16 })
};

INSTANTIATE_TEST_SUITE_P(smoke_LPT, ConcatTransformation,
Expand All @@ -96,15 +96,15 @@ INSTANTIATE_TEST_SUITE_P(smoke_LPT, ConcatTransformation,

namespace concat_transformation_mixed {

const std::vector<ngraph::element::Type> precisions = {
ngraph::element::f16
const std::vector<ov::element::Type> precisions = {
ov::element::f16
};

const std::vector<ConcatTransformationTestValues> testValues = {
// mixed dequantization: FP32 & FP16
{
{},
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, ov::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{},
std::make_shared<ov::op::v0::Constant>(ov::element::u8, ov::Shape{1, 3, 16, 16}, std::vector<float>(3 * 16 * 16, 1.0)),
{},
Expand All @@ -119,7 +119,7 @@ const std::vector<ConcatTransformationTestValues> testValues = {
INSTANTIATE_TEST_SUITE_P(smoke_LPT, ConcatTransformation,
::testing::Combine(
::testing::ValuesIn(precisions),
::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })),
::testing::Values(ov::PartialShape({ 1, 3, 16, 16 })),
::testing::Values(ov::test::utils::DEVICE_CPU),
::testing::ValuesIn(testValues)),
ConcatTransformation::getTestCaseName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,30 @@ const std::vector<ov::pass::low_precision::LayerTransformation::Params> trasform
const std::vector<ConcatWithChildAndOutputTransformationParam> testValues = {
// U8
{
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f / 2.f} }
{ 256ul, ov::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, ov::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f / 2.f} }
},
// I8
{
{ 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} }
{ 256ul, ov::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} },
{ 256ul, ov::Shape({}), {-1.28f}, {1.27f}, {-1.28f / 2.f}, {1.27f / 2.f} }
},
// mixed: U8 + I8
{
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} }
{ 256ul, ov::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, ov::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} }
},
// mixed: I8 + U8
{
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} },
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} }
{ 256ul, ov::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} },
{ 256ul, ov::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} }
}
};

INSTANTIATE_TEST_SUITE_P(smoke_LPT, ConcatWithChildAndOutputTransformation,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(ngraph::PartialShape({ 1, 6, 10, 10 })),
::testing::Values(ov::PartialShape({ 1, 6, 10, 10 })),
::testing::Values(ov::test::utils::DEVICE_CPU),
::testing::ValuesIn(testValues),
::testing::ValuesIn(trasformationParamValues)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,39 +22,39 @@ const std::vector<ConcatWithDifferentChildrenTransformationParam> 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} }
{ 256ul, ov::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, ov::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} }
{ 256ul, ov::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, ov::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} }
{ 256ul, ov::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} },
{ 256ul, ov::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} }
{ 256ul, ov::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, ov::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} }
{ 256ul, ov::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} },
{ 256ul, ov::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} }
}
};

INSTANTIATE_TEST_SUITE_P(smoke_LPT, ConcatWithDifferentChildrenTransformation,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(ngraph::PartialShape({ 1, 6, 10, 10 })),
::testing::Values(ov::PartialShape({ 1, 6, 10, 10 })),
::testing::Values(ov::test::utils::DEVICE_CPU),
::testing::ValuesIn(testValues),
::testing::ValuesIn(trasformationParamValues)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const std::vector<ov::pass::low_precision::LayerTransformation::Params> trasform
const std::vector<bool> transparentIntermediateValues = { true, false };
const std::vector<bool> multiChannelValues = { /*true,*/ false };

const std::vector<ngraph::PartialShape> shapes = {
const std::vector<ov::PartialShape> shapes = {
{ 1, 3, 16, 16 },
{ 4, 3, 16, 16 }
};
Expand Down
Loading

0 comments on commit c8f9033

Please sign in to comment.