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 2022-12-16 23:54:24 +01:00 committed by GitHub
parent 8e3c3f5c04
commit b808fb7f4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 215 additions and 180 deletions

View File

@ -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}

View File

@ -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

View File

@ -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,

View File

@ -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,

View File

@ -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}};

View File

@ -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);

View File

@ -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}},
{}}},
};

View File

@ -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}}},
{},
{},

View File

@ -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(),

View File

@ -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);
}

View File

@ -4,26 +4,6 @@
set(TARGET_NAME ov_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}

View File

@ -67,7 +67,7 @@ TEST(TransformationTests, ConvToBinaryConvOutputLowZeroOutputHighOne) {
CoordinateDiff{0, 0},
Strides{1, 1},
opset5::BinaryConvolution::BinaryConvolutionMode::XNOR_POPCOUNT,
-1,
-1.0f,
op::PadType::EXPLICIT);
auto add = std::make_shared<opset5::Add>(conv, opset5::Constant::create(element::f32, Shape{1, 1, 1}, {0.7f}));
auto mul = std::make_shared<opset5::Multiply>(add, opset5::Constant::create(element::f32, Shape{}, {0.2f}));
@ -126,7 +126,7 @@ TEST(TransformationTests, ConvToBinaryConvOutputLowMinusOneOutputHighOne) {
CoordinateDiff{0, 0},
Strides{1, 1},
opset5::BinaryConvolution::BinaryConvolutionMode::XNOR_POPCOUNT,
0,
0.0f,
op::PadType::EXPLICIT);
f_ref = std::make_shared<Function>(NodeVector{conv}, ParameterVector{data});

View File

@ -19,7 +19,7 @@ using namespace ov;
constexpr float normalized_fp16_min = 6.103515625e-05f; // fp16 minimal normalized value
TEST_F(TransformationTestsF, DivisionByZeroMinimalPattern) {
const float eps_value = 1.e-12;
const float eps_value = 1.e-12f;
{
auto input_1 = std::make_shared<opset4::Parameter>(element::f32, PartialShape::dynamic(3));
auto input_2 = std::make_shared<opset4::Parameter>(element::f32, PartialShape::dynamic(3));
@ -46,7 +46,7 @@ TEST_F(TransformationTestsF, DivisionByZeroMinimalPattern) {
}
TEST_F(TransformationTestsF, PowWithNegativeExponent) {
const float eps_value = 1.e-12;
const float eps_value = 1.e-12f;
{
auto input_1 = std::make_shared<opset4::Parameter>(element::f32, PartialShape::dynamic(3));
auto input_2 = std::make_shared<opset4::Parameter>(element::f32, PartialShape::dynamic(3));
@ -78,7 +78,7 @@ TEST_F(TransformationTestsF, PowWithNegativeExponent) {
TEST_F(TransformationTestsF, PowWithPositiveExponent) {
// graph should be left unchanged
const float eps_value = 1.e-12;
const float eps_value = 1.e-12f;
{
auto input_1 = std::make_shared<opset4::Parameter>(element::f32, PartialShape::dynamic(3));
auto input_2 = std::make_shared<opset4::Parameter>(element::f32, PartialShape::dynamic(3));
@ -137,7 +137,7 @@ TEST_F(TransformationTestsF, DivisionByZeroMinimalPatternUnchanged) {
}
TEST_F(TransformationTestsF, DivisionByZeroInL2NormWithSqrtAndWithMax) {
const float eps_value = 1.e-12;
const float eps_value = 1.e-12f;
{
auto input = std::make_shared<opset4::Parameter>(element::f32, PartialShape::dynamic(3));
auto exp = opset4::Constant::create(element::f32, Shape{}, {2.f});
@ -172,7 +172,7 @@ TEST_F(TransformationTestsF, DivisionByZeroInL2NormWithSqrtAndWithMax) {
}
TEST_F(TransformationTestsF, DivisionByZeroInL2NormWithSqrtAndWithAdd) {
const float eps_value = 1.e-12;
const float eps_value = 1.e-12f;
{
auto input = std::make_shared<opset4::Parameter>(element::f32, PartialShape::dynamic(3));
auto exp = opset4::Constant::create(element::f32, Shape{}, {2.f});

View File

@ -40,7 +40,7 @@ public:
const auto fq = std::make_shared<ngraph::opset4::FakeQuantize>(data, in_low, in_high, out_low, out_high, 255);
std::vector<float> mul_const(shape_size(mul_const_shape));
std::iota(mul_const.begin(), mul_const.end(), 0);
std::iota(mul_const.begin(), mul_const.end(), 0.0f);
const auto mul_value =
ngraph::opset4::Constant::create(ngraph::element::Type_t::f32, mul_const_shape, mul_const);
const auto mul = std::make_shared<ngraph::opset4::Multiply>(fq, mul_value);

View File

@ -46,7 +46,8 @@ TEST_F(TransformationTestsF, MVNFusionTestOutside) {
{
auto input = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
auto axes = ngraph::opset6::Constant::create(ngraph::element::i32, ngraph::Shape{3}, {1, 2, 3});
auto mvn = std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9, ngraph::op::MVNEpsMode::OUTSIDE_SQRT);
auto mvn =
std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9f, ngraph::op::MVNEpsMode::OUTSIDE_SQRT);
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{mvn}, ngraph::ParameterVector{input});
}
@ -78,7 +79,8 @@ TEST_F(TransformationTestsF, MVNFusionTestReuseSub) {
{
auto input = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
auto axes = ngraph::opset6::Constant::create(ngraph::element::i32, ngraph::Shape{3}, {1, 2, 3});
auto mvn = std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9, ngraph::op::MVNEpsMode::OUTSIDE_SQRT);
auto mvn =
std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9f, ngraph::op::MVNEpsMode::OUTSIDE_SQRT);
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{mvn}, ngraph::ParameterVector{input});
}
@ -111,7 +113,8 @@ TEST_F(TransformationTestsF, MVNFusionTestWithConvert) {
{
auto input = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
auto axes = ngraph::opset6::Constant::create(ngraph::element::i32, ngraph::Shape{3}, {1, 2, 3});
auto mvn = std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9, ngraph::op::MVNEpsMode::OUTSIDE_SQRT);
auto mvn =
std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9f, ngraph::op::MVNEpsMode::OUTSIDE_SQRT);
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{mvn}, ngraph::ParameterVector{input});
}
@ -142,7 +145,8 @@ TEST_F(TransformationTestsF, MVNFusionTestSqrt) {
{
auto input = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
auto axes = ngraph::opset6::Constant::create(ngraph::element::i32, ngraph::Shape{3}, {1, 2, 3});
auto mvn = std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9, ngraph::op::MVNEpsMode::OUTSIDE_SQRT);
auto mvn =
std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9f, ngraph::op::MVNEpsMode::OUTSIDE_SQRT);
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{mvn}, ngraph::ParameterVector{input});
}
@ -172,7 +176,8 @@ TEST_F(TransformationTestsF, MVNFusionTestAltDiv) {
{
auto input = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
auto axes = ngraph::opset6::Constant::create(ngraph::element::i32, ngraph::Shape{3}, {1, 2, 3});
auto mvn = std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9, ngraph::op::MVNEpsMode::OUTSIDE_SQRT);
auto mvn =
std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9f, ngraph::op::MVNEpsMode::OUTSIDE_SQRT);
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{mvn}, ngraph::ParameterVector{input});
}
@ -207,7 +212,7 @@ TEST_F(TransformationTestsF, MVNFusionTestInsideSqrt) {
{
auto input = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
auto axes = ngraph::opset6::Constant::create(ngraph::element::i32, ngraph::Shape{3}, {1, 2, 3});
auto mvn = std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9, ngraph::op::MVNEpsMode::INSIDE_SQRT);
auto mvn = std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9f, ngraph::op::MVNEpsMode::INSIDE_SQRT);
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{mvn}, ngraph::ParameterVector{input});
}
@ -239,7 +244,7 @@ TEST_F(TransformationTestsF, MVNFusionTestReuseSubInsideSqrt) {
{
auto input = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
auto axes = ngraph::opset6::Constant::create(ngraph::element::i32, ngraph::Shape{3}, {1, 2, 3});
auto mvn = std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9, ngraph::op::MVNEpsMode::INSIDE_SQRT);
auto mvn = std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9f, ngraph::op::MVNEpsMode::INSIDE_SQRT);
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{mvn}, ngraph::ParameterVector{input});
}
@ -272,7 +277,7 @@ TEST_F(TransformationTestsF, MVNFusionTestWithConvertInsideSqrt) {
{
auto input = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
auto axes = ngraph::opset6::Constant::create(ngraph::element::i32, ngraph::Shape{3}, {1, 2, 3});
auto mvn = std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9, ngraph::op::MVNEpsMode::INSIDE_SQRT);
auto mvn = std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9f, ngraph::op::MVNEpsMode::INSIDE_SQRT);
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{mvn}, ngraph::ParameterVector{input});
}
@ -303,7 +308,7 @@ TEST_F(TransformationTestsF, MVNFusionTestSqrtInsideSqrt) {
{
auto input = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
auto axes = ngraph::opset6::Constant::create(ngraph::element::i32, ngraph::Shape{3}, {1, 2, 3});
auto mvn = std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9, ngraph::op::MVNEpsMode::INSIDE_SQRT);
auto mvn = std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9f, ngraph::op::MVNEpsMode::INSIDE_SQRT);
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{mvn}, ngraph::ParameterVector{input});
}
@ -333,7 +338,7 @@ TEST_F(TransformationTestsF, MVNFusionTestAltDivInsideSqrt) {
{
auto input = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
auto axes = ngraph::opset6::Constant::create(ngraph::element::i32, ngraph::Shape{3}, {1, 2, 3});
auto mvn = std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9, ngraph::op::MVNEpsMode::INSIDE_SQRT);
auto mvn = std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9f, ngraph::op::MVNEpsMode::INSIDE_SQRT);
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{mvn}, ngraph::ParameterVector{input});
}
@ -367,7 +372,7 @@ TEST_F(TransformationTestsF, MVNFusionTestWithParametersInside) {
{
auto input = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224});
auto axes = ngraph::opset6::Constant::create(ngraph::element::i32, ngraph::Shape{1}, {2});
auto mvn = std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9, ngraph::op::MVNEpsMode::INSIDE_SQRT);
auto mvn = std::make_shared<ngraph::opset6::MVN>(input, axes, true, 1e-9f, ngraph::op::MVNEpsMode::INSIDE_SQRT);
auto gamma = ngraph::opset6::Constant::create(ngraph::element::f32, ngraph::Shape{}, {1});
auto mul_gamma = std::make_shared<ngraph::opset6::Multiply>(mvn, gamma);
auto beta = ngraph::opset6::Constant::create(ngraph::element::f32, ngraph::Shape{}, {-1});

View File

@ -292,8 +292,15 @@ TEST(nop_elimination, squeeze_unsqueeze_overlap_elimination) {
shared_ptr<Node> sq_axes;
shared_ptr<Node> unsq_axes;
if (i32) {
std::vector<int32_t> sq_axes_val_i32(sq_axes_val.begin(), sq_axes_val.end());
std::vector<int32_t> unsq_axes_val_i32(unsq_axes_val.begin(), unsq_axes_val.end());
std::vector<int32_t> sq_axes_val_i32(sq_axes_val.size());
std::vector<int32_t> unsq_axes_val_i32(unsq_axes_val.size());
std::transform(sq_axes_val.begin(), sq_axes_val.end(), sq_axes_val_i32.begin(), [](int64_t x) {
return (int32_t)x;
});
std::transform(unsq_axes_val.begin(), unsq_axes_val.end(), unsq_axes_val_i32.begin(), [](int64_t x) {
return (int32_t)x;
});
sq_axes = op::Constant::create<int32_t>(element::i32, Shape{sq_axes_val.size()}, sq_axes_val_i32);
unsq_axes = op::Constant::create<int32_t>(element::i32, Shape{unsq_axes_val.size()}, unsq_axes_val_i32);
} else {
@ -795,7 +802,10 @@ TEST(nop_elimination, gather_3d_indices_constant_axis_1) {
shared_ptr<Node> indices;
shared_ptr<Node> axis;
if (i32) {
std::vector<int32_t> indices_val_i32(indices_val.begin(), indices_val.end());
std::vector<int32_t> indices_val_i32(indices_val.size());
std::transform(indices_val.begin(), indices_val.end(), indices_val_i32.begin(), [](int64_t x) {
return (int32_t)x;
});
indices = op::Constant::create<int32_t>(element::i32, Shape{indices_val.size()}, indices_val_i32);
axis = op::Constant::create<int32_t>(element::i32, Shape{}, {(int32_t)axis_val});
} else {

View File

@ -35,10 +35,10 @@ std::shared_ptr<Convolution> create_conv(Output<Node> input, Output<Node> weight
std::shared_ptr<Constant> create_weights(const Shape& weigts_shape) {
std::vector<float> values(ov::shape_size(weigts_shape));
float cur_value = 0.01;
float cur_value = 0.01f;
for (auto& value : values) {
value = cur_value;
cur_value += 0.01;
cur_value += 0.01f;
}
return Constant::create(element::f32, weigts_shape, values);
}
@ -751,7 +751,7 @@ TEST_F(TransformationTestsF, FuseScaleValue) {
using namespace ov::preprocess;
PrePostProcessor p(function);
p.input(0).tensor().set_layout("NHWC");
p.input(0).preprocess().scale(1.3);
p.input(0).preprocess().scale(1.3f);
p.build();
manager.register_pass<pass::MOCTransformations>(false);
@ -780,7 +780,7 @@ TEST_F(TransformationTestsF, FuseScaleValues) {
using namespace ov::preprocess;
PrePostProcessor p(function);
p.input(0).tensor().set_layout("NHWC");
p.input(0).preprocess().scale({1.3, 0.2, 4.1});
p.input(0).preprocess().scale({1.3f, 0.2f, 4.1f});
p.build();
manager.register_pass<pass::MOCTransformations>(false);

View File

@ -138,7 +138,7 @@ std::shared_ptr<ov::Model> CreateFunctionTransposeAfter(UnaryFactoryPtr unary_fa
}
static NodePtr CreateReshape(NodePtr parent_node, const ov::Shape& input_shape) {
const size_t mul = std::accumulate(input_shape.begin(), input_shape.end(), 1, std::multiplies<size_t>());
const size_t mul = std::accumulate(input_shape.begin(), input_shape.end(), (size_t)1, std::multiplies<size_t>());
auto reshape_const = std::make_shared<ov::opset9::Constant>(ov::element::u64, ov::Shape{1}, ov::Shape{mul});
return std::make_shared<ov::opset9::Reshape>(parent_node, reshape_const, false);
}

View File

@ -176,7 +176,10 @@ TEST(TransformationTests, replace_transpose_with_reshape) {
shared_ptr<Node> perm;
if (i32) {
std::vector<int32_t> perm_val_i32(perm_val.begin(), perm_val.end());
std::vector<int32_t> perm_val_i32(perm_val.size());
std::transform(perm_val.begin(), perm_val.end(), perm_val_i32.begin(), [](int64_t x) {
return (int32_t)x;
});
perm = op::Constant::create<int32_t>(element::i32, Shape{perm_val.size()}, perm_val_i32);
} else {
perm = op::Constant::create<int64_t>(element::i64, Shape{perm_val.size()}, perm_val);

View File

@ -20,9 +20,9 @@ TEST(TransformationTests, ConstFoldingMVN) {
shared_ptr<ov::Model> fun(nullptr);
{
const auto in = make_shared<opset10::Parameter>(element::f32, Shape{6});
const auto mvn_in = make_shared<opset10::Constant>(element::f32, Shape{6}, vector<float>(6, 0.0));
const auto mvn_in = make_shared<opset10::Constant>(element::f32, Shape{6}, vector<float>(6, 0.0f));
const auto axes = make_shared<opset10::Constant>(element::i32, Shape{1}, vector<int>{0});
auto mvn = make_shared<opset10::MVN>(mvn_in, axes, false, 1e-9, op::MVNEpsMode::OUTSIDE_SQRT);
auto mvn = make_shared<opset10::MVN>(mvn_in, axes, false, 1e-9f, op::MVNEpsMode::OUTSIDE_SQRT);
auto add = make_shared<opset10::Add>(in, mvn);
fun = make_shared<ov::Model>(NodeVector{add}, ParameterVector{in});
@ -34,7 +34,7 @@ TEST(TransformationTests, ConstFoldingMVN) {
shared_ptr<ov::Model> f_ref(nullptr);
{
const auto in = make_shared<opset10::Parameter>(element::f32, Shape{6});
const auto mvn_const = make_shared<opset10::Constant>(element::f32, Shape{6}, vector<float>(6, 0.0));
const auto mvn_const = make_shared<opset10::Constant>(element::f32, Shape{6}, vector<float>(6, 0.0f));
auto add = make_shared<opset10::Add>(in, mvn_const);
f_ref = make_shared<ov::Model>(NodeVector{add}, ParameterVector{in});

View File

@ -51,10 +51,10 @@ TEST(TransformationTests, ConstFoldingPriorBox) {
ngraph::element::f32,
ngraph::Shape{2, 16},
{
-0.426667, -0.426667, 0.426667, 0.426667, -0.473286, -0.473286, 0.473286, 0.473286,
-0.603398, -0.301699, 0.603398, 0.301699, -0.301699, -0.603398, 0.301699, 0.603398,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
-0.426667f, -0.426667f, 0.426667f, 0.426667f, -0.473286f, -0.473286f, 0.473286f, 0.473286f,
-0.603398f, -0.301699f, 0.603398f, 0.301699f, -0.301699f, -0.603398f, 0.301699f, 0.603398f,
0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f,
0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f,
});
auto res = std::make_shared<ngraph::opset3::Result>(const_prior_box);
f_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{res}, ngraph::ParameterVector{layer_shape});
@ -100,18 +100,18 @@ TEST(TransformationTests, ConstFoldingPriorBoxClustered) {
auto const_prior_box = ngraph::opset3::Constant::create<float>(
ngraph::element::f32,
ngraph::Shape{2, 48},
{-0.00666667, -0.00166667, 0.00666667, 0.00166667, -0.00333333, -0.00333333, 0.00333333, 0.00333333,
-0.00533333, -0.00183333, 0.00533333, 0.00183333, -0.00333333, -0.00166667, 0.01, 0.00166667,
0, -0.00333333, 0.00666667, 0.00333333, -0.002, -0.00183333, 0.00866667, 0.00183333,
-0.00666667, 0.00166667, 0.00666667, 0.005, -0.00333333, 0, 0.00333333, 0.00666667,
-0.00533333, 0.0015, 0.00533333, 0.00516667, -0.00333333, 0.00166667, 0.01, 0.005,
0, 0, 0.00666667, 0.00666667, -0.002, 0.0015, 0.00866667, 0.00516667,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0});
{-0.00666667f, -0.00166667f, 0.00666667f, 0.00166667f, -0.00333333f, -0.00333333f, 0.00333333f, 0.00333333f,
-0.00533333f, -0.00183333f, 0.00533333f, 0.00183333f, -0.00333333f, -0.00166667f, 0.01f, 0.00166667f,
0.0f, -0.00333333f, 0.00666667f, 0.00333333f, -0.002f, -0.00183333f, 0.00866667f, 0.00183333f,
-0.00666667f, 0.00166667f, 0.00666667f, 0.005f, -0.00333333f, 0.0f, 0.00333333f, 0.00666667f,
-0.00533333f, 0.0015f, 0.00533333f, 0.00516667f, -0.00333333f, 0.00166667f, 0.01f, 0.005f,
0.0f, 0.0f, 0.00666667f, 0.00666667f, -0.002f, 0.0015f, 0.00866667f, 0.00516667f,
0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f,
0.1f, 0.1f, 0.1f, 0.1f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f});
auto res = std::make_shared<ngraph::opset3::Result>(const_prior_box);
f_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{res}, ngraph::ParameterVector{layer_shape});
}
@ -176,10 +176,10 @@ TEST(TransformationTests, ConstFoldingPriorBoxSubgraph) {
auto const_prior_box = ngraph::opset3::Constant::create<float>(
ngraph::element::f32,
ngraph::Shape{2, 16},
{-0.426667, -0.426667, 0.426667, 0.426667, -0.473286, -0.473286, 0.473286, 0.473286,
-0.603398, -0.301699, 0.603398, 0.301699, -0.301699, -0.603398, 0.301699, 0.603398,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1});
{-0.426667f, -0.426667f, 0.426667f, 0.426667f, -0.473286f, -0.473286f, 0.473286f, 0.473286f,
-0.603398f, -0.301699f, 0.603398f, 0.301699f, -0.301699f, -0.603398f, 0.301699f, 0.603398f,
0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f,
0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f});
auto res = std::make_shared<ngraph::opset3::Result>(const_prior_box);
f_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{res}, ngraph::ParameterVector{layer_shape});
}
@ -240,18 +240,18 @@ TEST(TransformationTests, ConstFoldingPriorBoxClusteredSubgraph) {
auto const_prior_box = ngraph::opset3::Constant::create<float>(
ngraph::element::f32,
ngraph::Shape{2, 48},
{-0.00666667, -0.00166667, 0.00666667, 0.00166667, -0.00333333, -0.00333333, 0.00333333, 0.00333333,
-0.00533333, -0.00183333, 0.00533333, 0.00183333, -0.00333333, -0.00166667, 0.01, 0.00166667,
0, -0.00333333, 0.00666667, 0.00333333, -0.002, -0.00183333, 0.00866667, 0.00183333,
-0.00666667, 0.00166667, 0.00666667, 0.005, -0.00333333, 0, 0.00333333, 0.00666667,
-0.00533333, 0.0015, 0.00533333, 0.00516667, -0.00333333, 0.00166667, 0.01, 0.005,
0, 0, 0.00666667, 0.00666667, -0.002, 0.0015, 0.00866667, 0.00516667,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0});
{-0.00666667f, -0.00166667f, 0.00666667f, 0.00166667f, -0.00333333f, -0.00333333f, 0.00333333f, 0.00333333f,
-0.00533333f, -0.00183333f, 0.00533333f, 0.00183333f, -0.00333333f, -0.00166667f, 0.01f, 0.00166667f,
0.0f, -0.00333333f, 0.00666667f, 0.00333333f, -0.002f, -0.00183333f, 0.00866667f, 0.00183333f,
-0.00666667f, 0.00166667f, 0.00666667f, 0.005f, -0.00333333f, 0.0f, 0.00333333f, 0.00666667f,
-0.00533333f, 0.0015f, 0.00533333f, 0.00516667f, -0.00333333f, 0.00166667f, 0.01f, 0.005f,
0.0f, 0.0f, 0.00666667f, 0.00666667f, -0.002f, 0.0015f, 0.00866667f, 0.00516667f,
0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f,
0.1f, 0.1f, 0.1f, 0.1f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f});
auto res = std::make_shared<ngraph::opset3::Result>(const_prior_box);
f_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{res}, ngraph::ParameterVector{layer_shape});
}
@ -298,14 +298,17 @@ TEST(TransformationTests, ConstFoldingPriorBox8) {
auto const_prior_box = ngraph::opset8::Constant::create<float>(
ngraph::element::f32,
ngraph::Shape{2, 48},
{0.15, 0.15, 0.35, 0.35, 0.127526, 0.16835, 0.372474, 0.33165, 0.0918861, 0.0918861, 0.408114, 0.408114,
0.65, 0.15, 0.85, 0.35, 0.627526, 0.16835, 0.872474, 0.33165, 0.591886, 0.0918861, 0.908114, 0.408114,
0.15, 0.65, 0.35, 0.85, 0.127526, 0.66835, 0.372474, 0.83165, 0.0918861, 0.591886, 0.408114, 0.908114,
0.65, 0.65, 0.85, 0.85, 0.627526, 0.66835, 0.872474, 0.83165, 0.591886, 0.591886, 0.908114, 0.908114,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1});
{0.15f, 0.15f, 0.35f, 0.35f, 0.127526f, 0.16835f, 0.372474f, 0.33165f, 0.0918861f,
0.0918861f, 0.408114f, 0.408114f, 0.65f, 0.15f, 0.85f, 0.35f, 0.627526f, 0.16835f,
0.872474f, 0.33165f, 0.591886f, 0.0918861f, 0.908114f, 0.408114f, 0.15f, 0.65f, 0.35f,
0.85f, 0.127526f, 0.66835f, 0.372474f, 0.83165f, 0.0918861f, 0.591886f, 0.408114f, 0.908114f,
0.65f, 0.65f, 0.85f, 0.85f, 0.627526f, 0.66835f, 0.872474f, 0.83165f, 0.591886f,
0.591886f, 0.908114f, 0.908114f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f,
0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f,
0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f,
0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f,
0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f,
0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f});
auto res = std::make_shared<ngraph::opset8::Result>(const_prior_box);
f_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{res}, ngraph::ParameterVector{layer_shape});
}
@ -370,14 +373,17 @@ TEST(TransformationTests, ConstFoldingPriorBox8Subgraph) {
auto const_prior_box = ngraph::opset8::Constant::create<float>(
ngraph::element::f32,
ngraph::Shape{2, 48},
{0.15, 0.15, 0.35, 0.35, 0.127526, 0.16835, 0.372474, 0.33165, 0.0918861, 0.0918861, 0.408114, 0.408114,
0.65, 0.15, 0.85, 0.35, 0.627526, 0.16835, 0.872474, 0.33165, 0.591886, 0.0918861, 0.908114, 0.408114,
0.15, 0.65, 0.35, 0.85, 0.127526, 0.66835, 0.372474, 0.83165, 0.0918861, 0.591886, 0.408114, 0.908114,
0.65, 0.65, 0.85, 0.85, 0.627526, 0.66835, 0.872474, 0.83165, 0.591886, 0.591886, 0.908114, 0.908114,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1});
{0.15f, 0.15f, 0.35f, 0.35f, 0.127526f, 0.16835f, 0.372474f, 0.33165f, 0.0918861f,
0.0918861f, 0.408114f, 0.408114f, 0.65f, 0.15f, 0.85f, 0.35f, 0.627526f, 0.16835f,
0.872474f, 0.33165f, 0.591886f, 0.0918861f, 0.908114f, 0.408114f, 0.15f, 0.65f, 0.35f,
0.85f, 0.127526f, 0.66835f, 0.372474f, 0.83165f, 0.0918861f, 0.591886f, 0.408114f, 0.908114f,
0.65f, 0.65f, 0.85f, 0.85f, 0.627526f, 0.66835f, 0.872474f, 0.83165f, 0.591886f,
0.591886f, 0.908114f, 0.908114f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f,
0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f,
0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f,
0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f,
0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f,
0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f});
auto res = std::make_shared<ngraph::opset8::Result>(const_prior_box);
f_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{res}, ngraph::ParameterVector{layer_shape});
}

View File

@ -34,7 +34,7 @@ int numberOfInputsForLayerInCNNNetwork(const InferenceEngine::CNNNetwork& networ
for (auto it = details::CNNNetworkIterator(network); it != details::CNNNetworkIterator(); it++) {
InferenceEngine::CNNLayerPtr layer = *it;
if (layer->type == layerType) {
numberOfInputs = layer->insData.size();
numberOfInputs = (int)layer->insData.size();
break;
}
}

View File

@ -108,7 +108,7 @@ public:
scale = mul_const.value;
if (!add_const.skip)
shift = add_const.value;
auto pow = std::make_shared<ngraph::op::PowerIE>(input, 1., scale, shift);
auto pow = std::make_shared<ngraph::op::PowerIE>(input, 1.f, scale, shift);
auto relu = std::make_shared<ngraph::opset1::Relu>(pow);
return std::make_shared<ngraph::Function>(ngraph::NodeVector{relu}, ngraph::ParameterVector{input});
}

View File

@ -32,7 +32,7 @@ TEST_F(TransformationTestsF, ConvertMVN1ToMVN6) {
auto data = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{1, 2, 3, 4});
auto axes_const = ngraph::opset6::Constant::create(ngraph::element::i64, ngraph::Shape{2}, {2, 3});
auto mvn =
std::make_shared<ngraph::op::v6::MVN>(data, axes_const, true, 1e-5, ngraph::op::MVNEpsMode::INSIDE_SQRT);
std::make_shared<ngraph::op::v6::MVN>(data, axes_const, true, 1e-5f, ngraph::op::MVNEpsMode::INSIDE_SQRT);
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{mvn}, ngraph::ParameterVector{data});
}
@ -52,7 +52,7 @@ TEST_F(TransformationTestsF, ConvertMVN1ToMVN6_across_channels) {
auto data = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{1, 2, 3, 4});
auto axes_const = ngraph::opset6::Constant::create(ngraph::element::i64, ngraph::Shape{3}, {1, 2, 3});
auto mvn =
std::make_shared<ngraph::op::v6::MVN>(data, axes_const, true, 1e-5, ngraph::op::MVNEpsMode::INSIDE_SQRT);
std::make_shared<ngraph::op::v6::MVN>(data, axes_const, true, 1e-5f, ngraph::op::MVNEpsMode::INSIDE_SQRT);
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{mvn}, ngraph::ParameterVector{data});
}
@ -72,7 +72,7 @@ TEST_F(TransformationTestsF, ConvertMVN1ToMVN6_5D) {
auto data = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{1, 2, 3, 4, 5});
auto axes_const = ngraph::opset6::Constant::create(ngraph::element::i64, ngraph::Shape{3}, {2, 3, 4});
auto mvn =
std::make_shared<ngraph::op::v6::MVN>(data, axes_const, true, 1e-5, ngraph::op::MVNEpsMode::INSIDE_SQRT);
std::make_shared<ngraph::op::v6::MVN>(data, axes_const, true, 1e-5f, ngraph::op::MVNEpsMode::INSIDE_SQRT);
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{mvn}, ngraph::ParameterVector{data});
}

View File

@ -34,7 +34,7 @@ std::shared_ptr<ngraph::Function> get_initial_function(const ngraph::PartialShap
auto axis_const = ngraph::opset3::Constant::create(ngraph::element::i64, {1}, {axis});
auto broadcast_len = broadcast_shape.rank().get_length();
if (std::numeric_limits<size_t>::max() < broadcast_len) {
if (std::numeric_limits<size_t>::max() < (size_t)broadcast_len) {
throw ngraph::ngraph_error("broadcast_len cannot be represented in size_t");
}

View File

@ -69,7 +69,7 @@ TEST(TransformationTests, DetectionOutput8ToDetectionOutput1) {
opset8::DetectionOutput::Attributes attributes_v8 = attrs_v8_vector[ind];
opset1::DetectionOutput::Attributes attributes_v1 = attrs_v1_vector[ind];
if (num_classes.is_static()) {
attributes_v1.num_classes = num_classes.get_length();
attributes_v1.num_classes = (int)num_classes.get_length();
}
Dimension num_loc_classes = attributes_v8.share_location ? 1 : num_classes;
@ -131,7 +131,7 @@ TEST(TransformationTests, DetectionOutput8ToDetectionOutput1FiveArguments) {
opset8::DetectionOutput::Attributes attributes_v8 = attrs_v8_vector[ind];
opset1::DetectionOutput::Attributes attributes_v1 = attrs_v1_vector[ind];
if (num_classes.is_static()) {
attributes_v1.num_classes = num_classes.get_length();
attributes_v1.num_classes = (int)num_classes.get_length();
}
Dimension num_loc_classes = attributes_v8.share_location ? 1 : num_classes;

View File

@ -67,7 +67,7 @@ TEST(TransformationTests, DetectionOutput1ToDetectionOutput8) {
opset8::DetectionOutput::Attributes attributes_v8 = attrs_v8_vector[ind];
opset1::DetectionOutput::Attributes attributes_v1 = attrs_v1_vector[ind];
if (num_classes.is_static()) {
attributes_v1.num_classes = num_classes.get_length();
attributes_v1.num_classes = (int)num_classes.get_length();
}
Dimension num_loc_classes = attributes_v8.share_location ? 1 : num_classes;
@ -128,7 +128,7 @@ TEST(TransformationTests, DetectionOutput1ToDetectionOutput8FiveArguments) {
opset8::DetectionOutput::Attributes attributes_v8 = attrs_v8_vector[ind];
opset1::DetectionOutput::Attributes attributes_v1 = attrs_v1_vector[ind];
if (num_classes.is_static()) {
attributes_v1.num_classes = num_classes.get_length();
attributes_v1.num_classes = (int)num_classes.get_length();
}
Dimension num_loc_classes = attributes_v8.share_location ? 1 : num_classes;

View File

@ -22,7 +22,7 @@ TEST_F(TransformationTestsF, MVN6Decomposition_No_Variance) {
auto data = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{1, 2, 3, 4});
auto axes_const = ngraph::opset6::Constant::create(ngraph::element::i64, ngraph::Shape{2}, {2, 3});
auto mvn =
std::make_shared<ngraph::opset6::MVN>(data, axes_const, false, 1e-5, ngraph::op::MVNEpsMode::INSIDE_SQRT);
std::make_shared<ngraph::opset6::MVN>(data, axes_const, false, 1e-5f, ngraph::op::MVNEpsMode::INSIDE_SQRT);
function = std::make_shared<ngraph::Function>(ngraph::NodeVector{mvn}, ngraph::ParameterVector{data});
@ -45,7 +45,7 @@ TEST_F(TransformationTestsF, MVN6Decomposition_Inside_Sqrt) {
auto data = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{1, 2, 3, 4});
auto axes_const = ngraph::opset6::Constant::create(ngraph::element::i64, ngraph::Shape{2}, {2, 3});
auto mvn =
std::make_shared<ngraph::opset6::MVN>(data, axes_const, true, 1e-5, ngraph::op::MVNEpsMode::INSIDE_SQRT);
std::make_shared<ngraph::opset6::MVN>(data, axes_const, true, 1e-5f, ngraph::op::MVNEpsMode::INSIDE_SQRT);
function = std::make_shared<ngraph::Function>(ngraph::NodeVector{mvn}, ngraph::ParameterVector{data});
@ -77,7 +77,7 @@ TEST_F(TransformationTestsF, MVN6Decomposition_Outside_Sqrt) {
auto data = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{1, 2, 3, 4});
auto axes_const = ngraph::opset6::Constant::create(ngraph::element::i64, ngraph::Shape{2}, {2, 3});
auto mvn =
std::make_shared<ngraph::opset6::MVN>(data, axes_const, true, 1e-5, ngraph::op::MVNEpsMode::OUTSIDE_SQRT);
std::make_shared<ngraph::opset6::MVN>(data, axes_const, true, 1e-5f, ngraph::op::MVNEpsMode::OUTSIDE_SQRT);
function = std::make_shared<ngraph::Function>(ngraph::NodeVector{mvn}, ngraph::ParameterVector{data});

View File

@ -30,7 +30,7 @@ TEST(SmartReshapeTests, Proposal1Scales) {
attrs.feat_stride = 8;
attrs.framework = "tensorflow";
attrs.min_size = 1;
attrs.nms_thresh = 0.699999988079;
attrs.nms_thresh = 0.699999988079f;
attrs.normalize = true;
attrs.post_nms_topn = 300;
attrs.pre_nms_topn = 2147483647;
@ -69,7 +69,7 @@ TEST(SmartReshapeTests, Proposal1Scales_WithConvert) {
attrs.feat_stride = 8;
attrs.framework = "tensorflow";
attrs.min_size = 1;
attrs.nms_thresh = 0.699999988079;
attrs.nms_thresh = 0.699999988079f;
attrs.normalize = true;
attrs.post_nms_topn = 300;
attrs.pre_nms_topn = 2147483647;
@ -107,7 +107,7 @@ TEST(SmartReshapeTests, Proposal4Scales) {
attrs.feat_stride = 8;
attrs.framework = "tensorflow";
attrs.min_size = 1;
attrs.nms_thresh = 0.699999988079;
attrs.nms_thresh = 0.699999988079f;
attrs.normalize = true;
attrs.post_nms_topn = 300;
attrs.pre_nms_topn = 2147483647;
@ -148,7 +148,7 @@ TEST(SmartReshapeTests, Proposal4Scales_WithConvert) {
attrs.feat_stride = 8;
attrs.framework = "tensorflow";
attrs.min_size = 1;
attrs.nms_thresh = 0.699999988079;
attrs.nms_thresh = 0.699999988079f;
attrs.normalize = true;
attrs.post_nms_topn = 300;
attrs.pre_nms_topn = 2147483647;

View File

@ -70,30 +70,50 @@ class CompressQuantizeWeightsTests : public testing::WithParamInterface<Compress
TEST_P(CompressQuantizeWeightsTests, FusionTest) {}
static std::vector<CompressQuantizeWeightsParams> params = {
{Shape{2, 3, 1, 1}, {-1, 2, 3, 4, 5, 11}, 0, 10, -1, 5, 3, element::i4, {-1, -1, 0, 0, 0, 1}, 3, -0.666667},
{Shape{2, 3, 1, 1}, {-1, 2, 3, 4, 5, 11}, 0, 10, -1, 4, 16, element::i4, {-8, -5, -4, -2, 0, 7}, 0.333333, -5},
{Shape{2, 3, 1, 1},
{-1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 11.0f},
0.0f,
10.0f,
-1.0f,
5.0f,
3,
element::i4,
{-1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f},
3.0f,
-0.666667f},
{Shape{2, 3, 1, 1},
{-1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 11.0f},
0.0f,
10.0f,
-1.0f,
4.0f,
16,
element::i4,
{-8.0f, -5.0f, -4.0f, -2.0f, 0.0f, 7.0f},
0.333333f,
-5.0f},
{Shape{2, 4, 1, 1},
{-1, 0, 1, 2, 3, 4, 5, 11},
1,
9,
-2,
6,
{-1.0f, 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 11.0f},
1.0f,
9.0f,
-2.0f,
6.0f,
17,
element::i8,
{-8, -8, -8, -6, -4, -2, 0, 8},
0.5,
-4},
{-8.0f, -8.0f, -8.0f, -6.0f, -4.0f, -2.0f, 0.0f, 8.0f},
0.5f,
-4.0f},
{Shape{2, 4, 1, 1},
{-1, 0, 1, 2, 3, 4, 5, 11},
1,
9,
-2,
6,
{-1.0f, 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 11.0f},
1.0f,
9.0f,
-2.0f,
6.0f,
256,
element::i8,
{-128, -128, -128, -96, -64, -32, 0, 127},
0.0313725,
-64.25},
{-128.0f, -128.0f, -128.0f, -96.0f, -64.0f, -32.0f, 0.0f, 127.0f},
0.0313725f,
-64.25f},
};
INSTANTIATE_TEST_SUITE_P(TransformationTests, CompressQuantizeWeightsTests, ::testing::ValuesIn(params));

View File

@ -12,6 +12,37 @@
#include "ngraph/opsets/opset4.hpp"
namespace ov {
namespace op {
namespace util {
template <>
bool has_constant_value<bool>(const std::shared_ptr<Node>& node, const bool value, bool epsilon) {
if (!node) {
return false;
}
auto constant = std::dynamic_pointer_cast<opset4::Constant>(node);
if (!constant) {
return false;
}
const bool is_scalar_or_single_elem = is_scalar(constant->get_shape()) || shape_size(constant->get_shape()) == 1;
if (!is_scalar_or_single_elem) {
return false;
}
const auto data = constant->cast_vector<bool>();
if (data[0] != value) {
return false;
}
return true;
}
} // namespace util
} // namespace op
} // namespace ov
TEST(TransformationTests, HasConstantValueHelper) {
auto float32_scalar = ngraph::opset4::Constant::create(ngraph::element::f32, ngraph::Shape{}, {1.234f});
ASSERT_TRUE(ngraph::op::util::has_constant_value<float>(float32_scalar, 1.234f));
@ -25,7 +56,7 @@ TEST(TransformationTests, HasConstantValueHelper) {
ASSERT_TRUE(ngraph::op::util::has_constant_value<int64_t>(int64_scalar, 12));
auto bool_scalar = ngraph::opset4::Constant::create(ngraph::element::boolean, ngraph::Shape{}, {true});
ASSERT_TRUE(ngraph::op::util::has_constant_value<bool>(int64_scalar, true));
ASSERT_TRUE(ngraph::op::util::has_constant_value<bool>(bool_scalar, true));
ASSERT_FALSE(ngraph::op::util::has_constant_value<int8_t>(nullptr, 0));