diff --git a/inference-engine/src/transformations/src/transformations/serialize.cpp b/inference-engine/src/transformations/src/transformations/serialize.cpp index 03e872267c2..7a9a2b8f16e 100644 --- a/inference-engine/src/transformations/src/transformations/serialize.cpp +++ b/inference-engine/src/transformations/src/transformations/serialize.cpp @@ -276,6 +276,12 @@ public: ngraph::ValueAccessor& adapter) override { m_xml_node.append_attribute(name.c_str()).set_value(adapter.get()); } + void on_adapter( + const std::string& name, + ngraph::ValueAccessor>& adapter) override { + m_xml_node.append_attribute(name.c_str()) + .set_value(create_atribute_list(adapter).c_str()); + } void on_adapter( const std::string& name, ngraph::ValueAccessor>& adapter) override { diff --git a/inference-engine/tests/functional/inference_engine/serialization/single_layer/detection_output.cpp b/inference-engine/tests/functional/inference_engine/serialization/single_layer/detection_output.cpp new file mode 100644 index 00000000000..f333e181229 --- /dev/null +++ b/inference-engine/tests/functional/inference_engine/serialization/single_layer/detection_output.cpp @@ -0,0 +1,74 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include "shared_test_classes/single_layer/detection_output.hpp" +#include "common_test_utils/test_constants.hpp" + +using namespace LayerTestsDefinitions; + +namespace { + TEST_P(DetectionOutputLayerTest, Serialize) { + Serialize(); + } + + const std::vector netPrecisions = { + InferenceEngine::Precision::FP32, + InferenceEngine::Precision::FP16 + }; + + /* =============== Detection Output =============== */ + + const int numClasses = 11; + const int backgroundLabelId = 0; + const std::vector topK = {75}; + const std::vector> keepTopK = { {50}, {100} }; + const std::vector codeType = {"caffe.PriorBoxParameter.CORNER", "caffe.PriorBoxParameter.CENTER_SIZE"}; + const float nmsThreshold = 0.5f; + const float confidenceThreshold = 0.3f; + const std::vector clipAfterNms = {true, false}; + const std::vector clipBeforeNms = {true, false}; + const std::vector decreaseLabelId = {true, false}; + const std::vector numberBatch = {1, 2}; + const float objectnessScore = 0.4f; + + const auto commonAttributes = ::testing::Combine( + ::testing::Values(numClasses), + ::testing::Values(backgroundLabelId), + ::testing::ValuesIn(topK), + ::testing::ValuesIn(keepTopK), + ::testing::ValuesIn(codeType), + ::testing::Values(nmsThreshold), + ::testing::Values(confidenceThreshold), + ::testing::ValuesIn(clipAfterNms), + ::testing::ValuesIn(clipBeforeNms), + ::testing::ValuesIn(decreaseLabelId)); + + /* =============== 3 inputs cases =============== */ + + const std::vector specificParams3In = { + ParamsWhichSizeDepends{true, true, true, 1, 1, {1, 60}, {1, 165}, {1, 1, 60}, {}, {}}, + ParamsWhichSizeDepends{true, false, true, 1, 1, {1, 660}, {1, 165}, {1, 1, 60}, {}, {}}, + ParamsWhichSizeDepends{false, true, true, 1, 1, {1, 60}, {1, 165}, {1, 2, 60}, {}, {}}, + ParamsWhichSizeDepends{false, false, true, 1, 1, {1, 660}, {1, 165}, {1, 2, 60}, {}, {}}, + + ParamsWhichSizeDepends{true, true, false, 10, 10, {1, 60}, {1, 165}, {1, 1, 75}, {}, {}}, + ParamsWhichSizeDepends{true, false, false, 10, 10, {1, 660}, {1, 165}, {1, 1, 75}, {}, {}}, + ParamsWhichSizeDepends{false, true, false, 10, 10, {1, 60}, {1, 165}, {1, 2, 75}, {}, {}}, + ParamsWhichSizeDepends{false, false, false, 10, 10, {1, 660}, {1, 165}, {1, 2, 75}, {}, {}}}; + + const auto params3Inputs = ::testing::Combine( + commonAttributes, + ::testing::ValuesIn(specificParams3In), + ::testing::ValuesIn(numberBatch), + ::testing::Values(objectnessScore), + ::testing::Values(CommonTestUtils::DEVICE_CPU)); + +INSTANTIATE_TEST_CASE_P( + smoke_DetectionOutput3In, + DetectionOutputLayerTest, + params3Inputs, + DetectionOutputLayerTest::getTestCaseName); +} // namespace diff --git a/inference-engine/tests/functional/inference_engine/serialization/single_layer/pooling.cpp b/inference-engine/tests/functional/inference_engine/serialization/single_layer/pooling.cpp new file mode 100644 index 00000000000..e333d290d5c --- /dev/null +++ b/inference-engine/tests/functional/inference_engine/serialization/single_layer/pooling.cpp @@ -0,0 +1,92 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include "shared_test_classes/single_layer/pooling.hpp" +#include "common_test_utils/test_constants.hpp" + +using namespace LayerTestsDefinitions; + +namespace { + TEST_P(PoolingLayerTest, Serialize) { + Serialize(); + } + + const std::vector netPrecisions = { + InferenceEngine::Precision::FP32, + InferenceEngine::Precision::FP16 + }; + + /* ============= POOLING ============= */ + const std::vector> kernels = {{3, 3}, + {3, 5}}; + const std::vector> strides = {{1, 1}, + {1, 2}}; + const std::vector> padBegins = {{0, 0}, + {0, 2}}; + const std::vector> padEnds = {{0, 0}, + {0, 2}}; + + const std::vector roundingTypes = { + ngraph::op::RoundingType::FLOOR, + ngraph::op::RoundingType::CEIL + }; + + const std::vector padTypes = { + ngraph::op::PadType::EXPLICIT, + ngraph::op::PadType::SAME_UPPER, + ngraph::op::PadType::VALID + }; + + const std::vector inputShape = {511, 11, 13, 15}; + const std::vector excludePad = {true, false}; + + /* ============= AVERAGE POOLING ============= */ + + const auto avgExcludePadParams = ::testing::Combine( + ::testing::Values(ngraph::helpers::PoolingTypes::AVG), + ::testing::ValuesIn(kernels), + ::testing::ValuesIn(strides), + ::testing::ValuesIn(padBegins), + ::testing::ValuesIn(padEnds), + ::testing::ValuesIn(roundingTypes), + ::testing::ValuesIn(padTypes), + ::testing::Values(excludePad[0])); + + INSTANTIATE_TEST_CASE_P(smoke_AvgPoolExcluePad, PoolingLayerTest, + ::testing::Combine( + avgExcludePadParams, + ::testing::ValuesIn(netPrecisions), + ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), + ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), + ::testing::Values(InferenceEngine::Layout::ANY), + ::testing::Values(InferenceEngine::Layout::ANY), + ::testing::Values(inputShape), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + PoolingLayerTest::getTestCaseName); + + const auto avgPadParams = ::testing::Combine( + ::testing::Values(ngraph::helpers::PoolingTypes::AVG), + ::testing::ValuesIn(kernels), + ::testing::ValuesIn(strides), + ::testing::ValuesIn(padBegins), + ::testing::ValuesIn(padEnds), + ::testing::ValuesIn(roundingTypes), + ::testing::ValuesIn(padTypes), + ::testing::Values(excludePad[1])); + + INSTANTIATE_TEST_CASE_P(smoke_AvgPool, PoolingLayerTest, + ::testing::Combine( + avgPadParams, + ::testing::ValuesIn(netPrecisions), + ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), + ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), + ::testing::Values(InferenceEngine::Layout::ANY), + ::testing::Values(InferenceEngine::Layout::ANY), + ::testing::Values(inputShape), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + PoolingLayerTest::getTestCaseName); +} // namespace + diff --git a/inference-engine/tests/functional/inference_engine/serialization/single_layer/prior_box_clustered.cpp b/inference-engine/tests/functional/inference_engine/serialization/single_layer/prior_box_clustered.cpp new file mode 100644 index 00000000000..28a4aac5518 --- /dev/null +++ b/inference-engine/tests/functional/inference_engine/serialization/single_layer/prior_box_clustered.cpp @@ -0,0 +1,77 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include "shared_test_classes/single_layer/prior_box_clustered.hpp" +#include "common_test_utils/test_constants.hpp" + +using namespace LayerTestsDefinitions; + +namespace { + TEST_P(PriorBoxClusteredLayerTest, Serialize) { + Serialize(); + } + + const std::vector netPrecisions = { + InferenceEngine::Precision::FP32, + InferenceEngine::Precision::FP16 + }; + + const std::vector> widths = { + { 5.12f, 14.6f, 13.5f }, + { 7.0f, 8.2f, 33.39f } + }; + + const std::vector> heights = { + { 15.12f, 15.6f, 23.5f }, + { 10.0f, 16.2f, 36.2f } + }; + + const std::vector step_widths = { + 0.0f, 2.0f + }; + + const std::vector step_heights = { + 0.0f, 1.5f + }; + + const std::vector offsets = { + 0.5f + }; + + const std::vector> variances = { + { 0.1f, 0.1f, 0.2f, 0.2f } + }; + + const std::vector clips = { + true, false + }; + + const std::vector inputShape = {4, 4}; + const std::vector imageShape = {50, 50}; + + const auto layerSpeficParams = ::testing::Combine( + ::testing::ValuesIn(widths), + ::testing::ValuesIn(heights), + ::testing::ValuesIn(clips), + ::testing::ValuesIn(step_widths), + ::testing::ValuesIn(step_heights), + ::testing::ValuesIn(offsets), + ::testing::ValuesIn(variances)); + + INSTANTIATE_TEST_CASE_P(smoke_PriorBoxClustered_Basic, PriorBoxClusteredLayerTest, + ::testing::Combine( + layerSpeficParams, + ::testing::ValuesIn(netPrecisions), + ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), + ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), + ::testing::Values(InferenceEngine::Layout::ANY), + ::testing::Values(InferenceEngine::Layout::ANY), + ::testing::Values(inputShape), + ::testing::Values(imageShape), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + PriorBoxClusteredLayerTest::getTestCaseName); + +} // namespace diff --git a/inference-engine/tests/functional/shared_test_classes/src/single_layer/pooling.cpp b/inference-engine/tests/functional/shared_test_classes/src/single_layer/pooling.cpp index f768a27d954..8a4a51f1212 100644 --- a/inference-engine/tests/functional/shared_test_classes/src/single_layer/pooling.cpp +++ b/inference-engine/tests/functional/shared_test_classes/src/single_layer/pooling.cpp @@ -38,9 +38,7 @@ std::string PoolingLayerTest::getTestCaseName(testing::TestParamInfo