Enable warnings for transformation tests (#14699)

* Remove warning suppression from tests

* Fix warnings MSVC ov_transformations_tests

* Fix warnings MSVC ov_lp_transformations_tests

* Fix code style
This commit is contained in:
Oleg Pipikin authored and GitHub committed 2022-12-17 01:54:24 +03:00
1 parent 8e3c3f5c04
commit b808fb7f4f
31 files changed
+215 -180

No files matched your search

@@ -4,26 +4,6 @@
set(TARGET_NAME ov_lp_transformations_tests)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
ie_add_compiler_flags(/wd4244)
ie_add_compiler_flags(/wd4267)
ie_add_compiler_flags(/wd4305)
ie_add_compiler_flags(/wd4018)
ie_add_compiler_flags(/wd4050)
ie_add_compiler_flags(/wd4250)
ie_add_compiler_flags(/wd4334)
ie_add_compiler_flags(/wd4661)
ie_add_compiler_flags(/wd4273)
ie_add_compiler_flags(/wd4309)
ie_add_compiler_flags(/wd4804)
endif()
if(NOT MSVC)
ie_add_compiler_flags(-Wno-missing-declarations)
ie_add_compiler_flags(-Wno-sign-compare)
ie_add_compiler_flags(-Wno-odr)
ie_add_compiler_flags(-Wno-all)
endif()
ov_add_test_target(
NAME ${TARGET_NAME}
ROOT ${CMAKE_CURRENT_SOURCE_DIR}
@@ -187,9 +187,9 @@ const std::vector<ClampTransformationTestValues> testValues = {
{{}, {}, {}}}},
// per channel quantization with small values
{LayerTransformation::createParamsU8I8(),
{ngraph::element::u8, {{ngraph::element::f32}, {{1e-14, 1e-12, 1e-15}}, {{1e-14, 1e-12, 1e-15}}}},
{ngraph::element::u8, {{ngraph::element::f32}, {{1e-14f, 1e-12f, 1e-15f}}, {{1e-14f, 1e-12f, 1e-15f}}}},
{ngraph::element::u8,
{{ngraph::element::f32}, {{1e-14, 1e-12, 1e-15}}, {{1e-14, 1e-12, 1e-15}}},
{{ngraph::element::f32}, {{1e-14f, 1e-12f, 1e-15f}}, {{1e-14f, 1e-12f, 1e-15f}}},
ngraph::element::f32,
{{}, {}, {}}}},
// without dequantization
@@ -988,7 +988,7 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{0.f, 0.f, 0.f},
{2.55f / 1.f, 2.55f / 2.f, 2.55f / 3.f},
{0.f, 0.f, 0.f},
{2.55f, 2.55f, 2.55}},
{2.55f, 2.55f, 2.55f}},
{},
{},
{256ul,
@@ -352,7 +352,7 @@ const std::vector<GroupConvolutionTestValues> testValuesGroupConv = {
{{ngraph::element::f32}, {}, {{0.02f, 0.02f, 0.04f, 0.04f, 0.08f, 0.08f}, ngraph::element::f32, {1, 6, 1, 1}}},
op::Constant::create(ngraph::element::i8, ngraph::Shape{}, std::vector<float>{2.f}),
{},
{ngraph::element::f32, {}, {0.01}}},
{ngraph::element::f32, {}, {0.01f}}},
// ExpectedValues
{
ngraph::element::u8,
@@ -405,7 +405,7 @@ const std::vector<GroupConvolutionTestValues> testValuesGroupConv = {
{{0.02f, 0.02f, 0.04f, 0.04f, 0.08f, 0.08f}, ngraph::element::f32, {1, 6, 1, 1}}},
op::Constant::create(ngraph::element::i8, ngraph::Shape{}, std::vector<float>{2.f}),
{},
{ngraph::element::f32, {{127}, ngraph::element::f32, {}, true, 1, ngraph::element::i8, true}, {0.01}}},
{ngraph::element::f32, {{127}, ngraph::element::f32, {}, true, 1, ngraph::element::i8, true}, {0.01f}}},
// ExpectedValues
{
ngraph::element::u8,
@@ -102,7 +102,7 @@ const std::vector<IsAsymmetricOnWeightsDequantizationTestValues> testValues = {
{{ngraph::element::f32}, {128.f}, {0.02f}},
op::Constant::create(ngraph::element::i8, ngraph::Shape{}, std::vector<float>{2.f}),
{{ngraph::element::f32},
{{0, 0, 1.e-7, 0, 0, 0}, ngraph::element::f32, {6, 1, 1, 1}},
{{0, 0, 1.e-7f, 0, 0, 0}, ngraph::element::f32, {6, 1, 1, 1}},
{{1, 2, 3, 4, 5, 6}, ngraph::element::f32, {6, 1, 1, 1}}},
false}};
@@ -393,7 +393,7 @@ TEST(LPT, AvoidDequantizationToShapeOfPropagationNormalizeL2Transformation) {
auto mul = std::make_shared<opset1::Multiply>(convert, opset1::Constant::create(element::f32, {}, {2.f}));
auto axes = opset1::Constant::create(element::i32, {2}, {2, 3});
auto normalize = std::make_shared<opset1::NormalizeL2>(mul, axes, 0.01, ov::op::EpsMode::ADD);
auto normalize = std::make_shared<opset1::NormalizeL2>(mul, axes, 0.01f, ov::op::EpsMode::ADD);
auto shapeOf = std::make_shared<opset1::ShapeOf>(normalize);
auto result1 = std::make_shared<opset1::Result>(normalize);
@@ -148,7 +148,7 @@ std::vector<MatMullTransformationTestValues> testValues = {
{ngraph::element::u8,
{ngraph::element::f32, {}, {0.02f}},
{std::vector<float>(1024 * 1024, 1.f), ngraph::element::f32, ngraph::Shape{1024, 1024}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7f}},
{}},
{ngraph::element::u8,
{},
@@ -194,7 +194,7 @@ std::vector<MatMullTransformationTestValues> testValues = {
{ngraph::element::u8,
{ngraph::element::f32, {}, {{0.01f, 0.02f, 0.03f}}},
{std::vector<float>(4 * 4, 1.f), ngraph::element::f32, ngraph::Shape{4, 4}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7f}},
{}},
{ngraph::element::u8,
{},
@@ -209,7 +209,7 @@ std::vector<MatMullTransformationTestValues> testValues = {
{ngraph::element::u8,
{ngraph::element::f32, {128.f}, {0.01f}},
{std::vector<float>(4 * 4, 1.f), ngraph::element::f32, ngraph::Shape{4, 4}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7f}},
{}},
{ngraph::element::u8,
{},
@@ -276,14 +276,14 @@ std::vector<MatMullTransformationTestValues> testValues = {
{ngraph::element::u8,
{ngraph::element::f32, {}, {{0.01f, 0.02f, 0.03f, 0.01f}, ngraph::element::f32, ngraph::Shape{1, 1, 4}}},
{std::vector<float>(4 * 4, 1.f), ngraph::element::f32, ngraph::Shape{4, 4}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7f}},
{}},
{ngraph::element::u8,
{ngraph::element::f32, {}, {{0.01f, 0.02f, 0.03f, 0.01f}, ngraph::element::f32, ngraph::Shape{1, 1, 4}}},
{std::vector<float>(4 * 4, 1.f), ngraph::element::f32, ngraph::Shape{4, 4}},
ngraph::element::f32,
{},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7f}},
{}}},
// U8 & I8: dequantization by rows in second input: can't be transformed
@@ -358,7 +358,7 @@ std::vector<MatMullTransformationTestValues> testValues = {
{ngraph::element::u8,
{ngraph::element::f32, {}, {0.02f}},
{std::vector<float>(2048 * 1000, 1.f), ngraph::element::f32, ngraph::Shape{2048, 1000}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7f}},
{}},
{ngraph::element::u8,
{{}, {}, {}},
@@ -388,7 +388,7 @@ std::vector<MatMullTransformationTestValues> testValues = {
{ngraph::element::i8,
{ngraph::element::f32, {}, {0.02f}},
{std::vector<float>(2048 * 1000, 1.f), ngraph::element::f32, ngraph::Shape{2048, 1000}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7f}},
{}},
{ngraph::element::i8,
{{}, {}, {}},
@@ -433,7 +433,7 @@ std::vector<MatMullTransformationTestValues> testValues = {
{ngraph::element::f32,
{{}, {}, {0.02f}},
{std::vector<float>(2048 * 1000, 1.f), ngraph::element::f32, ngraph::Shape{2048, 1000}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7f}},
{}},
{ngraph::element::f32,
{{}, {}, {}},
@@ -474,27 +474,27 @@ std::vector<MatMullTransformationTestValues> testValues = {
{ngraph::element::u8,
{ngraph::element::f32, {}, {0.02f}},
{std::vector<float>(1024 * 1024, 1.f), ngraph::element::f32, ngraph::Shape{1024, 1024}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7f}},
{}},
{ngraph::element::u8,
{ngraph::element::f32, {}, {0.02f}},
{std::vector<float>(1024 * 1024, 1.f), ngraph::element::f32, ngraph::Shape{1024, 1024}},
ngraph::element::f32,
{},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7f}},
{}}},
{LayerTransformation::createParamsU8I8(),
{ngraph::element::u8,
{ngraph::element::f32, {}, {{0.01f, 0.02f, 0.03f}}},
{std::vector<float>(4 * 4, 1.f), ngraph::element::f32, ngraph::Shape{4, 4}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7f}},
{}},
{ngraph::element::u8,
{ngraph::element::f32, {}, {{0.01f, 0.02f, 0.03f}}},
{std::vector<float>(4 * 4, 1.f), ngraph::element::f32, ngraph::Shape{4, 4}},
ngraph::element::f32,
{},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7}},
{255, {1, 1}, {0.f}, {254.f}, {-12.7f}, {12.7f}},
{}}},
};
@@ -392,7 +392,7 @@ const std::vector<MoveFakeQuantizeTransformationTestValues> testValues = {
{}},
{
2,
{{256ul, {{}, {}, {1, 1, 1, 1}, {1, 1, 1, 1}}, {-2.6}, {2.6f}, {-31.7f}, {277.8f}},
{{256ul, {{}, {}, {1, 1, 1, 1}, {1, 1, 1, 1}}, {-2.6f}, {2.6f}, {-31.7f}, {277.8f}},
{256ul, {{}, {}, {1, 2, 1, 1}, {1, 2, 1, 1}}, {-2.6f}, {2.6f}, {-35.7f, -49.1f}, {267.f, 254.9f}}},
{},
{},
@@ -421,7 +421,7 @@ const std::vector<MoveFakeQuantizeTransformationTestValues> testValues = {
{}},
{
2,
{{256ul, {{1, 1, 1, 1}, {1, 1, 1, 1}, {}, {}}, {-31.7f}, {277.8f}, {-2.6}, {2.6f}},
{{256ul, {{1, 1, 1, 1}, {1, 1, 1, 1}, {}, {}}, {-31.7f}, {277.8f}, {-2.6f}, {2.6f}},
{256ul, {{1, 2, 1, 1}, {1, 2, 1, 1}, {}, {}}, {-35.7f, -49.1f}, {267.f, 254.9f}, {-2.6f}, {2.6f}}},
{},
{},
@@ -467,7 +467,7 @@ const std::vector<MoveFakeQuantizeTransformationTestValues> testValues = {
{}},
{
2,
{{256ul, {{1, 1}, {1, 1}, {}, {}}, {-31.7f}, {277.8f}, {-2.6}, {2.6f}},
{{256ul, {{1, 1}, {1, 1}, {}, {}}, {-31.7f}, {277.8f}, {-2.6f}, {2.6f}},
{256ul, {{1, 2}, {1, 2}, {}, {}}, {-35.7f, -49.1f}, {267.f, 254.9f}, {-2.6f}, {2.6f}}},
{},
{},
@@ -132,13 +132,13 @@ const std::vector<TransposeTransformationTestValues> testValues = {
{ngraph::element::u8,
{{ngraph::element::f32},
{{128.f}, element::undefined, {1, 3, 1, 1}, false, 1ul, element::u8, true},
{{0.1}, ngraph::element::f32, {1, 3, 1, 1}}}},
{{0.1f}, ngraph::element::f32, {1, 3, 1, 1}}}},
{ngraph::element::u8,
{{}, {}, {}},
ngraph::element::u8,
{{ngraph::element::f32},
{{128.f}, element::undefined, {1, 1, 3, 1}, false, 1ul, element::u8, true},
{{0.1}, ngraph::element::f32, {1, 1, 3, 1}}}}},
{{0.1f}, ngraph::element::f32, {1, 1, 3, 1}}}}},
// U8: per-tensor quantization, transpose channel dimension
{{0, 3, 1, 2},
LayerTransformation::createParamsU8I8(),
@@ -81,6 +81,6 @@ TEST(LPT_CalculateLevelsTestTransformation, calculateLevels_0) {
TEST(LPT_CalculateLevelsTestTransformation, calculateLevels_3) {
const auto levels =
calculateLevels(0.f, ngraph::pass::low_precision::DataPrecision::getMaxValue(256ul), 0.f, 2.55, 0.f, 0.0255f);
calculateLevels(0.f, ngraph::pass::low_precision::DataPrecision::getMaxValue(256ul), 0.f, 2.55f, 0.f, 0.0255f);
ASSERT_EQ(4ul, levels);
}