From 9866bc4d3785914914f74bce3884c92258cf4df5 Mon Sep 17 00:00:00 2001 From: Xuejun Zhai Date: Fri, 8 Dec 2023 17:22:10 +0800 Subject: [PATCH] [CPU tests] migrate single layer test cases to be API 2.0 - part 2 (#21441) * [CPU tests] migrate single layer test cases to be API 2.0 - part 2 Signed-off-by: Zhai, Xuejun * [CPU][Single layer test] fix tests error Signed-off-by: Zhai, Xuejun * Update augru_sequence.cpp --------- Signed-off-by: Zhai, Xuejun --- .../single_layer_tests/adaptive_pooling.cpp | 548 ++++---- .../single_layer_tests/augru_cell.cpp | 216 ++-- .../single_layer_tests/augru_sequence.cpp | 489 +++---- .../single_layer_tests/batch_to_space.cpp | 541 ++++---- .../single_layer_tests/broadcast.cpp | 510 ++++---- .../single_layer_tests/bucketize.cpp | 41 +- .../functional/single_layer_tests/concat.cpp | 1148 +++++++++-------- .../convert_to_plugin_specific_node.cpp | 91 +- 8 files changed, 1786 insertions(+), 1798 deletions(-) diff --git a/src/plugins/intel_cpu/tests/functional/single_layer_tests/adaptive_pooling.cpp b/src/plugins/intel_cpu/tests/functional/single_layer_tests/adaptive_pooling.cpp index 575d8031216..6b0a97a84a5 100644 --- a/src/plugins/intel_cpu/tests/functional/single_layer_tests/adaptive_pooling.cpp +++ b/src/plugins/intel_cpu/tests/functional/single_layer_tests/adaptive_pooling.cpp @@ -2,49 +2,42 @@ // SPDX-License-Identifier: Apache-2.0 // -#include +#include "common_test_utils/ov_tensor_utils.hpp" +#include "ov_models/utils/ov_helpers.hpp" #include "shared_test_classes/base/ov_subgraph.hpp" #include "test_utils/cpu_test_utils.hpp" -#include "ov_models/builders.hpp" -#include "ov_models/utils/ov_helpers.hpp" -using namespace InferenceEngine; using namespace CPUTestUtils; -using namespace ov::test; -namespace CPULayerTestsDefinitions { -namespace { - std::vector pooledSpatialShape; - std::string mode; - std::vector inputShape; -} // namespace +namespace ov { +namespace test { -using AdaPoolSpecificParams = std::tuple< - std::vector, // pooled vector - std::vector>; // feature map shape +using AdaPoolSpecificParams = std::tuple, // pooled vector + std::vector>; // feature map shape -using AdaPoolLayerTestParams = std::tuple< - AdaPoolSpecificParams, - std::string, // mode - bool, // second Input is Constant - ElementType, // Net precision - TargetDevice>; // Device name +using AdaPoolLayerTestParams = std::tuple; // Device name -using AdaPoolLayerCPUTestParamsSet = std::tuple< - CPULayerTestsDefinitions::AdaPoolLayerTestParams, - CPUSpecificParams>; +using AdaPoolLayerCPUTestParamsSet = std::tuple; class AdaPoolLayerCPUTest : public testing::WithParamInterface, - virtual public SubgraphBaseTest, public CPUTestsBase { + virtual public SubgraphBaseTest, + public CPUTestsBase { public: static std::string getTestCaseName(testing::TestParamInfo obj) { - CPULayerTestsDefinitions::AdaPoolLayerTestParams basicParamsSet; + AdaPoolLayerTestParams basicParamsSet; CPUSpecificParams cpuParams; std::tie(basicParamsSet, cpuParams) = obj.param; std::string td; ElementType netPr; bool isStatic; AdaPoolSpecificParams adaPar; + std::vector pooledSpatialShape; + std::vector inputShape; + std::string mode; std::tie(adaPar, mode, isStatic, netPr, td) = basicParamsSet; std::tie(pooledSpatialShape, inputShape) = adaPar; std::ostringstream result; @@ -66,22 +59,24 @@ public: result << std::to_string(obj.index); return result.str(); } + protected: void SetUp() override { - CPULayerTestsDefinitions::AdaPoolLayerTestParams basicParamsSet; + AdaPoolLayerTestParams basicParamsSet; CPUSpecificParams cpuParams; std::tie(basicParamsSet, cpuParams) = this->GetParam(); std::tie(inFmts, outFmts, priority, selectedType) = cpuParams; - CPULayerTestsDefinitions::AdaPoolSpecificParams adaPoolParams; + AdaPoolSpecificParams adaPoolParams; ElementType netPrecision; bool isStatic; + std::vector inputShape; std::tie(adaPoolParams, mode, isStatic, netPrecision, targetDevice) = basicParamsSet; std::tie(pooledVector, inputShape) = adaPoolParams; init_input_shapes(inputShape); if (!isStatic) { - for (auto &target : targetStaticShapes) { + for (auto& target : targetStaticShapes) { target.push_back({pooledVector.size()}); } } @@ -105,34 +100,36 @@ protected: } } - std::shared_ptr createFunction(bool secondInputConst) { - ov::ParameterVector params{std::make_shared(ngraph::element::f32, inputDynamicShapes[0])}; + std::shared_ptr createFunction(bool secondInputConst) { + ov::ParameterVector params{std::make_shared(ov::element::f32, inputDynamicShapes[0])}; params.front()->set_friendly_name("ParamsInput"); std::shared_ptr secondInput; if (secondInputConst) { - secondInput = ngraph::op::Constant::create(ngraph::element::i32, ngraph::Shape{pooledVector.size()}, pooledVector); + secondInput = ov::op::v0::Constant::create(ov::element::i32, ov::Shape{pooledVector.size()}, pooledVector); } else { - auto pooledParam = std::make_shared(ngraph::element::i32, ngraph::Shape{pooledVector.size()}); + auto pooledParam = + std::make_shared(ov::element::i32, ov::Shape{pooledVector.size()}); pooledParam->set_friendly_name("ParamSecondInput"); params.push_back(pooledParam); secondInput = pooledParam; } - auto adapoolMax = std::make_shared(params[0], secondInput, ngraph::element::i32); + auto adapoolMax = std::make_shared(params[0], secondInput, ov::element::i32); adapoolMax->get_rt_info() = getCPUInfo(); - auto adapoolAvg = std::make_shared(params[0], secondInput); + auto adapoolAvg = std::make_shared(params[0], secondInput); adapoolAvg->get_rt_info() = getCPUInfo(); - auto function = (mode == "max" ? std::make_shared(adapoolMax->outputs(), params, "AdaPoolMax") : - std::make_shared(adapoolAvg->outputs(), params, "AdaPoolAvg")); + auto function = (mode == "max" ? std::make_shared(adapoolMax->outputs(), params, "AdaPoolMax") + : std::make_shared(adapoolAvg->outputs(), params, "AdaPoolAvg")); return function; } void validate() override { auto actualOutputs = get_plugin_outputs(); if (function->get_parameters().size() == 2) { - auto pos = std::find_if(inputs.begin(), inputs.end(), - [](const std::pair, ov::Tensor> ¶ms) { + auto pos = std::find_if(inputs.begin(), + inputs.end(), + [](const std::pair, ov::Tensor>& params) { return params.first->get_friendly_name() == "ParamSecondInput"; }); OPENVINO_ASSERT(pos != inputs.end()); @@ -140,10 +137,10 @@ protected: } auto expectedOutputs = calculate_refs(); if (expectedOutputs.empty()) { - return; + return; } ASSERT_EQ(actualOutputs.size(), expectedOutputs.size()) - << "nGraph interpreter has " << expectedOutputs.size() << " outputs, while IE " << actualOutputs.size(); + << "model interpreter has " << expectedOutputs.size() << " outputs, while IE " << actualOutputs.size(); compare(expectedOutputs, actualOutputs); } @@ -157,12 +154,16 @@ protected: if (i == 1) { tensor = ov::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i]); - auto *dataPtr = tensor.data(); + auto* dataPtr = tensor.data(); for (size_t i = 0; i < pooledVector.size(); i++) { dataPtr[i] = pooledVector[i]; } } else { - tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), targetInputStaticShapes[i], 2560, 0, 256); + tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), + targetInputStaticShapes[i], + 2560, + 0, + 256); } inputs.insert({funcInput.get_node_shared_ptr(), tensor}); } @@ -170,6 +171,7 @@ protected: private: std::vector pooledVector; + std::string mode; }; TEST_P(AdaPoolLayerCPUTest, CompareWithRefs) { @@ -238,329 +240,275 @@ std::vector filterCPUInfoForDevice(std::string dims = "3D", s return resCPUParams; } -const std::vector netPrecisions = { - ElementType::f32, - ElementType::bf16 -}; +const std::vector netPrecisions = {ElementType::f32, ElementType::bf16}; -const std::vector> pooled3DVector = { - { 1 }, - { 3 }, - { 5 } -}; -const std::vector> pooled4DVector = { - { 1, 1 }, - { 3, 5 }, - { 5, 5 } -}; +const std::vector> pooled3DVector = {{1}, {3}, {5}}; +const std::vector> pooled4DVector = {{1, 1}, {3, 5}, {5, 5}}; const std::vector> pooled5DVector = { - { 1, 1, 1 }, - { 3, 5, 1 }, - { 3, 5, 3 }, + {1, 1, 1}, + {3, 5, 1}, + {3, 5, 3}, }; std::vector> staticInput3DShapeVector = {{{1, 17, 3}, {3, 7, 5}}}; const std::vector> input3DShapeVector = { - { - {{{-1, 17, -1}, {{1, 17, 3}, {3, 17, 5}, {3, 17, 5}}}}, - {{{{1, 10}, 20, {1, 10}}, {{1, 20, 5}, {2, 20, 4}, {3, 20, 6}}}} - } -}; + {{{{-1, 17, -1}, {{1, 17, 3}, {3, 17, 5}, {3, 17, 5}}}}, + {{{{1, 10}, 20, {1, 10}}, {{1, 20, 5}, {2, 20, 4}, {3, 20, 6}}}}}}; std::vector> staticInput4DShapeVector = {{{1, 3, 1, 1}, {3, 17, 5, 2}}}; const std::vector> input4DShapeVector = { - { - {{{-1, 3, -1, -1}, {{1, 3, 1, 1}, {3, 3, 5, 2}, {3, 3, 5, 2}}}}, - {{{{1, 10}, 3, {1, 10}, {1, 10}}, {{2, 3, 10, 6}, {3, 3, 6, 5}, {3, 3, 6, 5}}}} - } -}; + {{{{-1, 3, -1, -1}, {{1, 3, 1, 1}, {3, 3, 5, 2}, {3, 3, 5, 2}}}}, + {{{{1, 10}, 3, {1, 10}, {1, 10}}, {{2, 3, 10, 6}, {3, 3, 6, 5}, {3, 3, 6, 5}}}}}}; -std::vector> staticInput5DShapeVector = {{{ 1, 17, 2, 5, 2}, {3, 17, 4, 5, 4}}}; +std::vector> staticInput5DShapeVector = {{{1, 17, 2, 5, 2}, {3, 17, 4, 5, 4}}}; const std::vector> input5DShapeVector = { - { - {{{-1, 17, -1, -1, -1}, {{1, 17, 2, 5, 2}, {3, 17, 4, 5, 4}, {3, 17, 4, 5, 4}}}}, - {{{{1, 10}, 3, {1, 10}, {1, 10}, {1, 10}}, {{3, 3, 2, 5, 2}, {1, 3, 4, 5, 4}, {1, 3, 4, 5, 4}}}} - } -}; + {{{{-1, 17, -1, -1, -1}, {{1, 17, 2, 5, 2}, {3, 17, 4, 5, 4}, {3, 17, 4, 5, 4}}}}, + {{{{1, 10}, 3, {1, 10}, {1, 10}, {1, 10}}, {{3, 3, 2, 5, 2}, {1, 3, 4, 5, 4}, {1, 3, 4, 5, 4}}}}}}; -const auto adaPool3DParams = ::testing::Combine( - ::testing::ValuesIn(pooled3DVector), // output spatial shape - ::testing::ValuesIn(input3DShapeVector) // feature map shape +const auto adaPool3DParams = ::testing::Combine(::testing::ValuesIn(pooled3DVector), // output spatial shape + ::testing::ValuesIn(input3DShapeVector) // feature map shape ); -const auto adaPool4DParams = ::testing::Combine( - ::testing::ValuesIn(pooled4DVector), // output spatial shape - ::testing::ValuesIn(input4DShapeVector) // feature map shape +const auto adaPool4DParams = ::testing::Combine(::testing::ValuesIn(pooled4DVector), // output spatial shape + ::testing::ValuesIn(input4DShapeVector) // feature map shape ); -const auto adaPool5DParams = ::testing::Combine( - ::testing::ValuesIn(pooled5DVector), // output spatial shape - ::testing::ValuesIn(input5DShapeVector) // feature map shape +const auto adaPool5DParams = ::testing::Combine(::testing::ValuesIn(pooled5DVector), // output spatial shape + ::testing::ValuesIn(input5DShapeVector) // feature map shape ); const auto staticAdaPool3DParams = ::testing::Combine( - ::testing::ValuesIn(pooled3DVector), // output spatial shape - ::testing::ValuesIn(static_shapes_to_test_representation(staticInput3DShapeVector)) // feature map shape + ::testing::ValuesIn(pooled3DVector), // output spatial shape + ::testing::ValuesIn(static_shapes_to_test_representation(staticInput3DShapeVector)) // feature map shape ); const auto staticAdaPool4DParams = ::testing::Combine( - ::testing::ValuesIn(pooled4DVector), // output spatial shape - ::testing::ValuesIn(static_shapes_to_test_representation(staticInput4DShapeVector)) // feature map shape + ::testing::ValuesIn(pooled4DVector), // output spatial shape + ::testing::ValuesIn(static_shapes_to_test_representation(staticInput4DShapeVector)) // feature map shape ); const auto staticAdaPool5DParams = ::testing::Combine( - ::testing::ValuesIn(pooled5DVector), // output spatial shape - ::testing::ValuesIn(static_shapes_to_test_representation(staticInput5DShapeVector)) // feature map shape + ::testing::ValuesIn(pooled5DVector), // output spatial shape + ::testing::ValuesIn(static_shapes_to_test_representation(staticInput5DShapeVector)) // feature map shape ); -INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolAvg3DLayoutTest, AdaPoolLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - adaPool3DParams, - ::testing::Values("avg"), - ::testing::Values(false), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::ValuesIn(filterCPUInfoForDevice("3D", "avg"))), +INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolAvg3DLayoutTest, + AdaPoolLayerCPUTest, + ::testing::Combine(::testing::Combine(adaPool3DParams, + ::testing::Values("avg"), + ::testing::Values(false), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice("3D", "avg"))), AdaPoolLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolAvg4DLayoutTest, AdaPoolLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - adaPool4DParams, - ::testing::Values("avg"), - ::testing::Values(false), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::ValuesIn(filterCPUInfoForDevice("4D", "avg"))), +INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolAvg4DLayoutTest, + AdaPoolLayerCPUTest, + ::testing::Combine(::testing::Combine(adaPool4DParams, + ::testing::Values("avg"), + ::testing::Values(false), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice("4D", "avg"))), AdaPoolLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolAvg5DLayoutTest, AdaPoolLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - adaPool5DParams, - ::testing::Values("avg"), - ::testing::Values(false), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::ValuesIn(filterCPUInfoForDevice("5D", "avg"))), +INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolAvg5DLayoutTest, + AdaPoolLayerCPUTest, + ::testing::Combine(::testing::Combine(adaPool5DParams, + ::testing::Values("avg"), + ::testing::Values(false), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice("5D", "avg"))), AdaPoolLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolMax3DLayoutTest, AdaPoolLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - adaPool3DParams, - ::testing::Values("max"), - ::testing::Values(false), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::ValuesIn(filterCPUInfoForDevice("3D", "max"))), +INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolMax3DLayoutTest, + AdaPoolLayerCPUTest, + ::testing::Combine(::testing::Combine(adaPool3DParams, + ::testing::Values("max"), + ::testing::Values(false), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice("3D", "max"))), AdaPoolLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolMax4DLayoutTest, AdaPoolLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - adaPool4DParams, - ::testing::Values("max"), - ::testing::Values(false), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::ValuesIn(filterCPUInfoForDevice("4D", "max"))), +INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolMax4DLayoutTest, + AdaPoolLayerCPUTest, + ::testing::Combine(::testing::Combine(adaPool4DParams, + ::testing::Values("max"), + ::testing::Values(false), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice("4D", "max"))), AdaPoolLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolMax5DLayoutTest, AdaPoolLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - adaPool5DParams, - ::testing::Values("max"), - ::testing::Values(false), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::ValuesIn(filterCPUInfoForDevice("5D", "max"))), +INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolMax5DLayoutTest, + AdaPoolLayerCPUTest, + ::testing::Combine(::testing::Combine(adaPool5DParams, + ::testing::Values("max"), + ::testing::Values(false), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice("5D", "max"))), AdaPoolLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolAvg3DLayoutTest, AdaPoolLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - staticAdaPool3DParams, - ::testing::Values("avg"), - ::testing::Values(true), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::ValuesIn(filterCPUInfoForDevice("3D", "avg"))), +INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolAvg3DLayoutTest, + AdaPoolLayerCPUTest, + ::testing::Combine(::testing::Combine(staticAdaPool3DParams, + ::testing::Values("avg"), + ::testing::Values(true), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice("3D", "avg"))), AdaPoolLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolAvg4DLayoutTest, AdaPoolLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - staticAdaPool4DParams, - ::testing::Values("avg"), - ::testing::Values(true), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::ValuesIn(filterCPUInfoForDevice("4D", "avg"))), +INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolAvg4DLayoutTest, + AdaPoolLayerCPUTest, + ::testing::Combine(::testing::Combine(staticAdaPool4DParams, + ::testing::Values("avg"), + ::testing::Values(true), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice("4D", "avg"))), AdaPoolLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolAvg5DLayoutTest, AdaPoolLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - staticAdaPool5DParams, - ::testing::Values("avg"), - ::testing::Values(true), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::ValuesIn(filterCPUInfoForDevice("5D", "avg"))), +INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolAvg5DLayoutTest, + AdaPoolLayerCPUTest, + ::testing::Combine(::testing::Combine(staticAdaPool5DParams, + ::testing::Values("avg"), + ::testing::Values(true), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice("5D", "avg"))), AdaPoolLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolMax3DLayoutTest, AdaPoolLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - staticAdaPool3DParams, - ::testing::Values("max"), - ::testing::Values(true), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::ValuesIn(filterCPUInfoForDevice("3D", "max"))), +INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolMax3DLayoutTest, + AdaPoolLayerCPUTest, + ::testing::Combine(::testing::Combine(staticAdaPool3DParams, + ::testing::Values("max"), + ::testing::Values(true), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice("3D", "max"))), AdaPoolLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolMax4DLayoutTest, AdaPoolLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - staticAdaPool4DParams, - ::testing::Values("max"), - ::testing::Values(true), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::ValuesIn(filterCPUInfoForDevice("4D", "max"))), +INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolMax4DLayoutTest, + AdaPoolLayerCPUTest, + ::testing::Combine(::testing::Combine(staticAdaPool4DParams, + ::testing::Values("max"), + ::testing::Values(true), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice("4D", "max"))), AdaPoolLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolMax5DLayoutTest, AdaPoolLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - staticAdaPool5DParams, - ::testing::Values("max"), - ::testing::Values(true), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::ValuesIn(filterCPUInfoForDevice("5D", "max"))), +INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolMax5DLayoutTest, + AdaPoolLayerCPUTest, + ::testing::Combine(::testing::Combine(staticAdaPool5DParams, + ::testing::Values("max"), + ::testing::Values(true), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice("5D", "max"))), AdaPoolLayerCPUTest::getTestCaseName); - -// in 1-channel cases {..., 1, 1, 1} shape cannot be correctly resolved on oneDnn level, so it was removed from instances +// in 1-channel cases {..., 1, 1, 1} shape cannot be correctly resolved on oneDnn level, so it was removed from +// instances const std::vector> input3DShape1Channel = { - { - {{{-1, -1, -1}, {{1, 1, 2}, {1, 1, 2}, {1, 1, 2}}}}, - {{{{1, 10}, {1, 10}, {1, 10}}, {{1, 1, 2}, {2, 1, 2}, {2, 1, 2}}}} - } -}; + {{{{-1, -1, -1}, {{1, 1, 2}, {1, 1, 2}, {1, 1, 2}}}}, + {{{{1, 10}, {1, 10}, {1, 10}}, {{1, 1, 2}, {2, 1, 2}, {2, 1, 2}}}}}}; const std::vector> input4DShape1Channel = { - { - {{{-1, -1, -1, -1}, {{1, 1, 1, 2}, {2, 1, 2, 1}, {2, 1, 2, 1}}}}, - {{{{1, 10}, {1, 10}, {1, 10}, {1, 10}}, {{1, 1, 1, 2}, {1, 1, 1, 2}, {2, 1, 2, 1}}}} - } -}; + {{{{-1, -1, -1, -1}, {{1, 1, 1, 2}, {2, 1, 2, 1}, {2, 1, 2, 1}}}}, + {{{{1, 10}, {1, 10}, {1, 10}, {1, 10}}, {{1, 1, 1, 2}, {1, 1, 1, 2}, {2, 1, 2, 1}}}}}}; const std::vector> input5DShape1Channel = { - { - {{{-1, -1, -1, -1, -1}, {{1, 1, 1, 1, 2}, {1, 1, 1, 1, 2}, {2, 1, 1, 2, 1}}}}, - {{{{1, 10}, {1, 10}, {1, 10}, {1, 10}, {1, 10}}, {{1, 1, 1, 1, 2}, {1, 1, 1, 1, 2}, {2, 1, 1, 2, 1}}}} - } -}; + {{{{-1, -1, -1, -1, -1}, {{1, 1, 1, 1, 2}, {1, 1, 1, 1, 2}, {2, 1, 1, 2, 1}}}}, + {{{{1, 10}, {1, 10}, {1, 10}, {1, 10}, {1, 10}}, {{1, 1, 1, 1, 2}, {1, 1, 1, 1, 2}, {2, 1, 1, 2, 1}}}}}}; -INSTANTIATE_TEST_SUITE_P(smoke_AdaPool_1ch_Avg3DLayoutTest, AdaPoolLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - ::testing::Combine( - ::testing::ValuesIn(std::vector> { - {1}, {2}}), - ::testing::ValuesIn(input3DShape1Channel)), - ::testing::Values("avg"), - ::testing::Values(true), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::Values(CPUSpecificParams{{ncw, x}, {ncw}, {}, {}})), - AdaPoolLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P( + smoke_AdaPool_1ch_Avg3DLayoutTest, + AdaPoolLayerCPUTest, + ::testing::Combine(::testing::Combine(::testing::Combine(::testing::ValuesIn(std::vector>{{1}, + {2}}), + ::testing::ValuesIn(input3DShape1Channel)), + ::testing::Values("avg"), + ::testing::Values(true), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::Values(CPUSpecificParams{{ncw, x}, {ncw}, {}, {}})), + AdaPoolLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_AdaPool_1ch_Avg4DLayoutTest, AdaPoolLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - ::testing::Combine( - ::testing::ValuesIn(std::vector> { - {1, 1}, - {2, 2} - }), - ::testing::ValuesIn(input4DShape1Channel)), - ::testing::Values("avg"), - ::testing::Values(true), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::Values(CPUSpecificParams{{nchw, x}, {nchw}, {}, {}})), - AdaPoolLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P( + smoke_AdaPool_1ch_Avg4DLayoutTest, + AdaPoolLayerCPUTest, + ::testing::Combine(::testing::Combine(::testing::Combine(::testing::ValuesIn(std::vector>{{1, 1}, + {2, 2}}), + ::testing::ValuesIn(input4DShape1Channel)), + ::testing::Values("avg"), + ::testing::Values(true), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::Values(CPUSpecificParams{{nchw, x}, {nchw}, {}, {}})), + AdaPoolLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_AdaPool_1ch_Avg5DLayoutTest, AdaPoolLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - ::testing::Combine( - ::testing::ValuesIn(std::vector> { - {1, 1, 1}, {2, 2, 2}}), - ::testing::ValuesIn(input5DShape1Channel)), - ::testing::Values("avg"), - ::testing::Values(true), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::Values(CPUSpecificParams{{ncdhw, x}, {ncdhw}, {}, {}})), - AdaPoolLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P( + smoke_AdaPool_1ch_Avg5DLayoutTest, + AdaPoolLayerCPUTest, + ::testing::Combine( + ::testing::Combine(::testing::Combine(::testing::ValuesIn(std::vector>{{1, 1, 1}, {2, 2, 2}}), + ::testing::ValuesIn(input5DShape1Channel)), + ::testing::Values("avg"), + ::testing::Values(true), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::Values(CPUSpecificParams{{ncdhw, x}, {ncdhw}, {}, {}})), + AdaPoolLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P( + smoke_AdaPool_1ch_Max3DLayoutTest, + AdaPoolLayerCPUTest, + ::testing::Combine(::testing::Combine(::testing::Combine(::testing::ValuesIn(std::vector>{{1}, + {2}}), + ::testing::ValuesIn(input3DShape1Channel)), + ::testing::Values("max"), + ::testing::Values(true), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::Values(CPUSpecificParams{{ncw, x}, {ncw}, {}, {}})), + AdaPoolLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_AdaPool_1ch_Max3DLayoutTest, AdaPoolLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - ::testing::Combine( - ::testing::ValuesIn(std::vector> { - {1}, {2}}), - ::testing::ValuesIn(input3DShape1Channel)), - ::testing::Values("max"), - ::testing::Values(true), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::Values(CPUSpecificParams{{ncw, x}, {ncw}, {}, {}})), - AdaPoolLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P( + smoke_AdaPool_1ch_Max4DLayoutTest, + AdaPoolLayerCPUTest, + ::testing::Combine(::testing::Combine(::testing::Combine(::testing::ValuesIn(std::vector>{{1, 1}, + {2, 2}}), + ::testing::ValuesIn(input4DShape1Channel)), + ::testing::Values("max"), + ::testing::Values(true), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::Values(CPUSpecificParams{{nchw, x}, {nchw}, {}, {}})), + AdaPoolLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_AdaPool_1ch_Max4DLayoutTest, AdaPoolLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - ::testing::Combine( - ::testing::ValuesIn(std::vector> { - {1, 1}, {2, 2}}), - ::testing::ValuesIn(input4DShape1Channel)), - ::testing::Values("max"), - ::testing::Values(true), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::Values(CPUSpecificParams{{nchw, x}, {nchw}, {}, {}})), - AdaPoolLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P( + smoke_AdaPool_1ch_Max5DLayoutTest, + AdaPoolLayerCPUTest, + ::testing::Combine( + ::testing::Combine(::testing::Combine(::testing::ValuesIn(std::vector>{{1, 1, 1}, {2, 2, 2}}), + ::testing::ValuesIn(input5DShape1Channel)), + ::testing::Values("max"), + ::testing::Values(true), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::Values(CPUSpecificParams{{ncdhw, x}, {ncdhw}, {}, {}})), + AdaPoolLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_AdaPool_1ch_Max5DLayoutTest, AdaPoolLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - ::testing::Combine( - ::testing::ValuesIn(std::vector> { - {1, 1, 1}, - {2, 2, 2} - }), - ::testing::ValuesIn(input5DShape1Channel)), - ::testing::Values("max"), - ::testing::Values(true), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::Values(CPUSpecificParams{{ncdhw, x}, {ncdhw}, {}, {}})), - AdaPoolLayerCPUTest::getTestCaseName); - -} // namespace -} // namespace CPULayerTestsDefinitions +} // namespace +} // namespace test +} // namespace ov diff --git a/src/plugins/intel_cpu/tests/functional/single_layer_tests/augru_cell.cpp b/src/plugins/intel_cpu/tests/functional/single_layer_tests/augru_cell.cpp index bc407ef7e19..2c5f131cbbe 100644 --- a/src/plugins/intel_cpu/tests/functional/single_layer_tests/augru_cell.cpp +++ b/src/plugins/intel_cpu/tests/functional/single_layer_tests/augru_cell.cpp @@ -2,39 +2,47 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "shared_test_classes/base/ov_subgraph.hpp" #include "common_test_utils/node_builders/augru_cell.hpp" + +#include "shared_test_classes/base/ov_subgraph.hpp" #include "test_utils/cpu_test_utils.hpp" using namespace CPUTestUtils; -using namespace ov::test; -namespace CPULayerTestsDefinitions { +namespace ov { +namespace test { -using AUGRUCellCpuSpecificParams = typename std::tuple< - std::vector, // Shapes - bool, // Using decompose to sub-ops transformation - std::vector, // Activations - float, // Clip - bool, // Linear before reset - ElementType, // Network precision - CPUSpecificParams, // CPU specific params - std::map // Additional config ->; +using AUGRUCellCpuSpecificParams = typename std::tuple, // Shapes + bool, // Using decompose to sub-ops transformation + std::vector, // Activations + float, // Clip + bool, // Linear before reset + ElementType, // Network precision + CPUSpecificParams, // CPU specific params + ov::AnyMap // Additional config + >; class AUGRUCellCPUTest : public testing::WithParamInterface, - virtual public ov::test::SubgraphBaseTest, public CPUTestsBase { + virtual public ov::test::SubgraphBaseTest, + public CPUTestsBase { public: - static std::string getTestCaseName(const testing::TestParamInfo &obj) { + static std::string getTestCaseName(const testing::TestParamInfo& obj) { std::vector inputShapes; bool decompose, linearBeforeReset; std::vector activations; float clip = 0.f; ElementType netPrecision; CPUSpecificParams cpuParams; - std::map additionalConfig; + ov::AnyMap additionalConfig; - std::tie(inputShapes, decompose, activations, clip, linearBeforeReset, netPrecision, cpuParams, additionalConfig) = obj.param; + std::tie(inputShapes, + decompose, + activations, + clip, + linearBeforeReset, + netPrecision, + cpuParams, + additionalConfig) = obj.param; std::ostringstream result; result << "IS=("; @@ -50,7 +58,7 @@ public: result << "}_"; } result << "decompose=" << decompose << "_"; - result << "activations=" << ov::test::utils::vec2str(activations) << "_"; + result << "activations=" << ov::test::utils::vec2str(activations) << "_"; result << "clip=" << clip << "_"; result << "linear=" << linearBeforeReset << "_"; result << "netPrec=" << netPrecision << "_"; @@ -58,9 +66,9 @@ public: if (!additionalConfig.empty()) { result << "_PluginConf"; - for (auto &item : additionalConfig) { - if (item.second == InferenceEngine::PluginConfigParams::YES) - result << "_" << item.first << "=" << item.second; + for (auto& item : additionalConfig) { + if (item.second == ov::element::bf16) + result << "_" << item.first << "=" << ov::element::bf16.get_type_name(); } } return result.str(); @@ -74,9 +82,16 @@ protected: float clip = 0.f; ElementType netPrecision; CPUSpecificParams cpuParams; - std::map additionalConfig; + ov::AnyMap additionalConfig; - std::tie(inputShapes, decompose, activations, clip, linearBeforeReset, netPrecision, cpuParams, additionalConfig) = this->GetParam(); + std::tie(inputShapes, + decompose, + activations, + clip, + linearBeforeReset, + netPrecision, + cpuParams, + additionalConfig) = this->GetParam(); std::tie(inFmts, outFmts, priority, selectedType) = cpuParams; targetDevice = ov::test::utils::DEVICE_CPU; @@ -87,7 +102,7 @@ protected: configuration.insert(additionalConfig.begin(), additionalConfig.end()); - if (additionalConfig[InferenceEngine::PluginConfigParams::KEY_ENFORCE_BF16] == InferenceEngine::PluginConfigParams::YES) { + if (additionalConfig[ov::hint::inference_precision.name()] == ov::element::bf16) { selectedType = makeSelectedTypeStr(selectedType, ElementType::bf16); } else { selectedType = makeSelectedTypeStr(selectedType, netPrecision); @@ -100,8 +115,11 @@ protected: params.push_back(param); paramsOuts.push_back(param); } - std::vector WRB = {{3 * hiddenSize, inputSize}, {3 * hiddenSize, hiddenSize}, {(linearBeforeReset ? 4 : 3) * hiddenSize}}; - auto augruCellOp = ov::test::utils::make_augru(paramsOuts, WRB, hiddenSize/*, activations, {}, {}, clip, linearBeforeReset*/); + std::vector WRB = {{3 * hiddenSize, inputSize}, + {3 * hiddenSize, hiddenSize}, + {(linearBeforeReset ? 4 : 3) * hiddenSize}}; + auto augruCellOp = + ov::test::utils::make_augru(paramsOuts, WRB, hiddenSize /*, activations, {}, {}, clip, linearBeforeReset*/); function = makeNgraphFunction(netPrecision, params, augruCellOp, "AUGRUCell"); } @@ -114,9 +132,8 @@ TEST_P(AUGRUCellCPUTest, CompareWithRefs) { namespace { /* CPU PARAMS */ -std::vector> additionalConfig - = {{{InferenceEngine::PluginConfigParams::KEY_ENFORCE_BF16, InferenceEngine::PluginConfigParams::NO}}, - {{InferenceEngine::PluginConfigParams::KEY_ENFORCE_BF16, InferenceEngine::PluginConfigParams::YES}}}; +std::vector additionalConfig = {{ov::hint::inference_precision(ov::element::f32)}, + {ov::hint::inference_precision(ov::element::bf16)}}; CPUSpecificParams cpuParams{{nc, nc}, {nc}, {"ref_any"}, "ref_any"}; @@ -127,79 +144,80 @@ std::vector> activations = {{"sigmoid", "tanh"}}; std::vector clip = {0.f}; // dev_api::augrucell does not support lbr so far. std::vector linearBeforeReset = {false}; -std::vector netPrecisions = { ElementType::f32 }; +std::vector netPrecisions = {ElementType::f32}; -const std::vector> staticShapes = { - { { {}, { {1, 1} } }, // Static shapes - { {}, { {1, 1} } }, - { {}, { {1, 1} } } }, - { { {}, { {1, 1} } }, // Static shapes - { {}, { {1, 10} } }, - { {}, { {1, 1} } } }, - { { {}, { {1, 30} } }, // Static shapes - { {}, { {1, 10} } }, - { {}, { {1, 1} } } }, - { { {}, { {1, 30} } }, // Static shapes - { {}, { {1, 1} } }, - { {}, { {1, 1} } } }, - { { {}, { {3, 1} } }, // Static shapes - { {}, { {3, 1} } }, - { {}, { {3, 1} } } }, - { { {}, { {5, 1} } }, // Static shapes - { {}, { {5, 1} } }, - { {}, { {5, 1} } } }, - { { {}, { {5, 30} } }, // Static shapes - { {}, { {5, 10} } }, - { {}, { {5, 1} } } } -}; +const std::vector> staticShapes = {{{{}, {{1, 1}}}, // Static shapes + {{}, {{1, 1}}}, + {{}, {{1, 1}}}}, + {{{}, {{1, 1}}}, // Static shapes + {{}, {{1, 10}}}, + {{}, {{1, 1}}}}, + {{{}, {{1, 30}}}, // Static shapes + {{}, {{1, 10}}}, + {{}, {{1, 1}}}}, + {{{}, {{1, 30}}}, // Static shapes + {{}, {{1, 1}}}, + {{}, {{1, 1}}}}, + {{{}, {{3, 1}}}, // Static shapes + {{}, {{3, 1}}}, + {{}, {{3, 1}}}}, + {{{}, {{5, 1}}}, // Static shapes + {{}, {{5, 1}}}, + {{}, {{5, 1}}}}, + {{{}, {{5, 30}}}, // Static shapes + {{}, {{5, 10}}}, + {{}, {{5, 1}}}}}; -INSTANTIATE_TEST_SUITE_P(smoke_static, AUGRUCellCPUTest, - ::testing::Combine(::testing::ValuesIn(staticShapes), - ::testing::ValuesIn(shouldDecompose), - ::testing::ValuesIn(activations), - ::testing::ValuesIn(clip), - ::testing::ValuesIn(linearBeforeReset), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(cpuParams), - ::testing::ValuesIn(additionalConfig)), - AUGRUCellCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_static, + AUGRUCellCPUTest, + ::testing::Combine(::testing::ValuesIn(staticShapes), + ::testing::ValuesIn(shouldDecompose), + ::testing::ValuesIn(activations), + ::testing::ValuesIn(clip), + ::testing::ValuesIn(linearBeforeReset), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(cpuParams), + ::testing::ValuesIn(additionalConfig)), + AUGRUCellCPUTest::getTestCaseName); const std::vector> dynamicShapes = { - { { { {-1}, 1 }, // Dynamic shape 0 - { {1, 1}, {3, 1}, {5, 1} } }, // Target shapes - { { {-1}, 1 }, // Dynamic shape 1 - { {1, 1}, {3, 1}, {5, 1} } }, // Target shapes - { { {-1}, 1 }, // Dynamic shape 2 - { {1, 1}, {3, 1}, {5, 1} } } }, // Target shapes - { { { {1, 10}, 30 }, // Dynamic shape 0 - { {2, 30}, {5, 30}, {8, 30} } }, // Target shapes - { { {1, 10}, 10 }, // Dynamic shape 1 - { {2, 10}, {5, 10}, {8, 10} } }, // Target shapes - { { {1, 10}, 1 }, // Dynamic shape 2 - { {2, 1}, {5, 1}, {8, 1} } } }, // Target shapes - { { { {1, 10}, {25, 35} }, // Dynamic shape 0 - { {2, 30}, {5, 30}, {8, 30} } }, // Target shapes - { { {1, 10}, -1 }, // Dynamic shape 1 - { {2, 10}, {5, 10}, {8, 10} } }, // Target shapes - { { {1, 10}, 1 }, // Dynamic shape 2 - { {2, 1}, {5, 1}, {8, 1} } } }, // Target shapes - { { { {1, 10}, {25, 35} }, // Dynamic shape 0 - { {2, 30}, {5, 30}, {8, 30}, {2, 30}, {5, 30}, {8, 30} } }, // Target shapes - { { {1, 10}, -1 }, // Dynamic shape 1 - { {2, 10}, {5, 10}, {8, 10}, {2, 10}, {5, 10}, {8, 10} } }, // Target shapes - { { {1, 10}, 1 }, // Dynamic shape 2 - { {2, 1}, {5, 1}, {8, 1}, {2, 1}, {5, 1}, {8, 1} } } } // Target shapes + {{{{-1}, 1}, // Dynamic shape 0 + {{1, 1}, {3, 1}, {5, 1}}}, // Target shapes + {{{-1}, 1}, // Dynamic shape 1 + {{1, 1}, {3, 1}, {5, 1}}}, // Target shapes + {{{-1}, 1}, // Dynamic shape 2 + {{1, 1}, {3, 1}, {5, 1}}}}, // Target shapes + {{{{1, 10}, 30}, // Dynamic shape 0 + {{2, 30}, {5, 30}, {8, 30}}}, // Target shapes + {{{1, 10}, 10}, // Dynamic shape 1 + {{2, 10}, {5, 10}, {8, 10}}}, // Target shapes + {{{1, 10}, 1}, // Dynamic shape 2 + {{2, 1}, {5, 1}, {8, 1}}}}, // Target shapes + {{{{1, 10}, {25, 35}}, // Dynamic shape 0 + {{2, 30}, {5, 30}, {8, 30}}}, // Target shapes + {{{1, 10}, -1}, // Dynamic shape 1 + {{2, 10}, {5, 10}, {8, 10}}}, // Target shapes + {{{1, 10}, 1}, // Dynamic shape 2 + {{2, 1}, {5, 1}, {8, 1}}}}, // Target shapes + {{{{1, 10}, {25, 35}}, // Dynamic shape 0 + {{2, 30}, {5, 30}, {8, 30}, {2, 30}, {5, 30}, {8, 30}}}, // Target shapes + {{{1, 10}, -1}, // Dynamic shape 1 + {{2, 10}, {5, 10}, {8, 10}, {2, 10}, {5, 10}, {8, 10}}}, // Target shapes + {{{1, 10}, 1}, // Dynamic shape 2 + {{2, 1}, {5, 1}, {8, 1}, {2, 1}, {5, 1}, {8, 1}}}} // Target shapes }; -INSTANTIATE_TEST_SUITE_P(smoke_dynamic, AUGRUCellCPUTest, - ::testing::Combine(::testing::ValuesIn(dynamicShapes), - ::testing::ValuesIn(shouldDecompose), - ::testing::ValuesIn(activations), - ::testing::ValuesIn(clip), - ::testing::ValuesIn(linearBeforeReset), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(cpuParams), - ::testing::ValuesIn(additionalConfig)), - AUGRUCellCPUTest::getTestCaseName); -} // namespace -} // namespace CPULayerTestsDefinitions +INSTANTIATE_TEST_SUITE_P(smoke_dynamic, + AUGRUCellCPUTest, + ::testing::Combine(::testing::ValuesIn(dynamicShapes), + ::testing::ValuesIn(shouldDecompose), + ::testing::ValuesIn(activations), + ::testing::ValuesIn(clip), + ::testing::ValuesIn(linearBeforeReset), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(cpuParams), + ::testing::ValuesIn(additionalConfig)), + AUGRUCellCPUTest::getTestCaseName); +} // namespace +} // namespace test +} // namespace ov diff --git a/src/plugins/intel_cpu/tests/functional/single_layer_tests/augru_sequence.cpp b/src/plugins/intel_cpu/tests/functional/single_layer_tests/augru_sequence.cpp index 0765b65907d..3940d3bd77b 100644 --- a/src/plugins/intel_cpu/tests/functional/single_layer_tests/augru_sequence.cpp +++ b/src/plugins/intel_cpu/tests/functional/single_layer_tests/augru_sequence.cpp @@ -2,44 +2,53 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "shared_test_classes/base/ov_subgraph.hpp" #include "common_test_utils/node_builders/augru_cell.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" #include "test_utils/cpu_test_utils.hpp" #include "transformations/op_conversions/bidirectional_sequences_decomposition.hpp" #include "transformations/op_conversions/convert_sequences_to_tensor_iterator.hpp" using namespace CPUTestUtils; -using namespace ov::test; -namespace CPULayerTestsDefinitions { +namespace ov { +namespace test { -using AUGRUSequenceCpuSpecificParams = typename std::tuple< - std::vector, // Shapes - ngraph::helpers::SequenceTestsMode, // Pure Sequence or TensorIterator - std::vector, // Activations - float, // Clip - bool, // Linear_before_reset - ov::op::RecurrentSequenceDirection, // Direction - ElementType, // Network precision - CPUSpecificParams, // CPU specific params - std::map // Additional config ->; +using AUGRUSequenceCpuSpecificParams = + typename std::tuple, // Shapes + ov::test::utils::SequenceTestsMode, // Pure Sequence or TensorIterator + std::vector, // Activations + float, // Clip + bool, // Linear_before_reset + ov::op::RecurrentSequenceDirection, // Direction + ElementType, // Network precision + CPUSpecificParams, // CPU specific params + ov::AnyMap // Additional config + >; class AUGRUSequenceCPUTest : public testing::WithParamInterface, - virtual public ov::test::SubgraphBaseTest, public CPUTestsBase { + virtual public ov::test::SubgraphBaseTest, + public CPUTestsBase { public: - static std::string getTestCaseName(const testing::TestParamInfo &obj) { + static std::string getTestCaseName(const testing::TestParamInfo& obj) { std::vector inputShapes; - ngraph::helpers::SequenceTestsMode seqMode; + ov::test::utils::SequenceTestsMode seqMode; std::vector activations; float clip; bool linearBeforeRest; ov::op::RecurrentSequenceDirection direction; ElementType netPrecision; CPUSpecificParams cpuParams; - std::map additionalConfig; + ov::AnyMap additionalConfig; - std::tie(inputShapes, seqMode, activations, clip, linearBeforeRest, direction, netPrecision, cpuParams, additionalConfig) = obj.param; + std::tie(inputShapes, + seqMode, + activations, + clip, + linearBeforeRest, + direction, + netPrecision, + cpuParams, + additionalConfig) = obj.param; std::ostringstream result; result << "IS=("; @@ -55,7 +64,7 @@ public: result << "}_"; } result << "seqMode=" << seqMode << "_"; - result << "activations=" << ov::test::utils::vec2str(activations) << "_"; + result << "activations=" << ov::test::utils::vec2str(activations) << "_"; result << "clip=" << clip << "_"; result << "linear=" << linearBeforeRest << "_"; result << "direction=" << direction << "_"; @@ -64,9 +73,9 @@ public: if (!additionalConfig.empty()) { result << "_PluginConf"; - for (auto &item : additionalConfig) { - if (item.second == InferenceEngine::PluginConfigParams::YES) - result << "_" << item.first << "=" << item.second; + for (auto& item : additionalConfig) { + if (item.second == ov::element::bf16) + result << "_" << item.first << "=" << ov::element::bf16.get_type_name(); } } return result.str(); @@ -75,21 +84,30 @@ public: protected: void SetUp() override { std::vector inputShapes; - ngraph::helpers::SequenceTestsMode seqMode; + ov::test::utils::SequenceTestsMode seqMode; std::vector activations; float clip; bool linearBeforeReset; ov::op::RecurrentSequenceDirection direction; ElementType netPrecision; CPUSpecificParams cpuParams; - std::map additionalConfig; + ov::AnyMap additionalConfig; - std::tie(inputShapes, seqMode, activations, clip, linearBeforeReset, direction, netPrecision, cpuParams, additionalConfig) = this->GetParam(); + std::tie(inputShapes, + seqMode, + activations, + clip, + linearBeforeReset, + direction, + netPrecision, + cpuParams, + additionalConfig) = this->GetParam(); std::tie(inFmts, outFmts, priority, selectedType) = cpuParams; targetDevice = ov::test::utils::DEVICE_CPU; init_input_shapes(inputShapes); - if (inputDynamicShapes.size() == 2 && inputDynamicShapes[0][0].is_dynamic() && inputDynamicShapes[1][0].is_dynamic()) + if (inputDynamicShapes.size() == 2 && inputDynamicShapes[0][0].is_dynamic() && + inputDynamicShapes[1][0].is_dynamic()) throw std::runtime_error("Invalid test case. If 3rd input is constant, batch dimension must be static."); configuration.insert(additionalConfig.begin(), additionalConfig.end()); @@ -98,7 +116,7 @@ protected: const size_t inputSize = targetStaticShapes.front()[0][2]; const size_t numDirections = direction == ov::op::RecurrentSequenceDirection::BIDIRECTIONAL ? 2 : 1; - if (additionalConfig[InferenceEngine::PluginConfigParams::KEY_ENFORCE_BF16] == InferenceEngine::PluginConfigParams::YES) { + if (additionalConfig[ov::hint::inference_precision.name()] == ov::element::bf16) { selectedType = makeSelectedTypeStr(selectedType, ElementType::bf16); } else { selectedType = makeSelectedTypeStr(selectedType, netPrecision); @@ -108,23 +126,24 @@ protected: for (auto&& shape : inputDynamicShapes) { params.push_back(std::make_shared(netPrecision, shape)); } - const size_t batchSize = inputDynamicShapes[0][0].is_static() ? inputDynamicShapes[0][0].get_length() : - inputDynamicShapes[1][0].is_static() ? inputDynamicShapes[1][0].get_length() : - inputDynamicShapes.size() > 2 && inputDynamicShapes[2][0].is_static() ? inputDynamicShapes[2][0].get_length() : - 1lu; - /** - * There are 2 options to paramter "in" when "make_sequence" is true. - * 0 1 2 3 - * X init_hidden_state attention seq_length - * or, - * 0 1 2 - * X init_hidden_state attention - * - */ + const size_t batchSize = inputDynamicShapes[0][0].is_static() ? inputDynamicShapes[0][0].get_length() + : inputDynamicShapes[1][0].is_static() ? inputDynamicShapes[1][0].get_length() + : inputDynamicShapes.size() > 2 && inputDynamicShapes[2][0].is_static() + ? inputDynamicShapes[2][0].get_length() + : 1lu; + /** + * There are 2 options to paramter "in" when "make_sequence" is true. + * 0 1 2 3 + * X init_hidden_state attention seq_length + * or, + * 0 1 2 + * X init_hidden_state attention + * + */ if (inputDynamicShapes.size() > 3) { if (!inputDynamicShapes[3].is_dynamic() && - seqMode != ngraph::helpers::SequenceTestsMode::CONVERT_TO_TI_MAX_SEQ_LEN_PARAM && - seqMode != ngraph::helpers::SequenceTestsMode::CONVERT_TO_TI_RAND_SEQ_LEN_PARAM) { + seqMode != ov::test::utils::SequenceTestsMode::CONVERT_TO_TI_MAX_SEQ_LEN_PARAM && + seqMode != ov::test::utils::SequenceTestsMode::CONVERT_TO_TI_RAND_SEQ_LEN_PARAM) { params.pop_back(); } else { params[3]->set_element_type(ElementType::i64); @@ -134,18 +153,15 @@ protected: for (const auto& param : params) paramsOuts.push_back(param); - std::vector WRB = {{numDirections, 3 * hiddenSize, inputSize}, {numDirections, 3 * hiddenSize, hiddenSize}, - {numDirections, (linearBeforeReset ? 4 : 3) * hiddenSize}, {batchSize}}; - auto augruSequenceOp = ov::test::utils::make_augru(paramsOuts, - WRB, - hiddenSize, - true, - direction, - seqMode); + std::vector WRB = {{numDirections, 3 * hiddenSize, inputSize}, + {numDirections, 3 * hiddenSize, hiddenSize}, + {numDirections, (linearBeforeReset ? 4 : 3) * hiddenSize}, + {batchSize}}; + auto augruSequenceOp = ov::test::utils::make_augru(paramsOuts, WRB, hiddenSize, true, direction, seqMode); function = makeNgraphFunction(netPrecision, params, augruSequenceOp, "augruSequenceOp"); - if (seqMode != ngraph::helpers::SequenceTestsMode::PURE_SEQ) { + if (seqMode != ov::test::utils::SequenceTestsMode::PURE_SEQ) { // TODO: ConvertAUGRUSequenceToTensorIterator throw std::runtime_error("ConvertAUGRUSequenceToTensorIterator not implemented yet."); } else { @@ -178,14 +194,13 @@ TEST_P(AUGRUSequenceCPUTest, CompareWithRefs) { namespace { /* CPU PARAMS */ -std::vector> additionalConfig - = {{{InferenceEngine::PluginConfigParams::KEY_ENFORCE_BF16, InferenceEngine::PluginConfigParams::NO}}, - {{InferenceEngine::PluginConfigParams::KEY_ENFORCE_BF16, InferenceEngine::PluginConfigParams::YES}}}; +std::vector additionalConfig = {{ov::hint::inference_precision(ov::element::f32)}, + {ov::hint::inference_precision(ov::element::bf16)}}; CPUSpecificParams cpuParams{{ntc, tnc}, {ntc, tnc}, {"ref_any"}, "ref_any"}; -CPUSpecificParams cpuParamsBatchSizeOne{{tnc, tnc}, {tnc, tnc}, {"ref_any"}, "ref_any"};; +CPUSpecificParams cpuParamsBatchSizeOne{{tnc, tnc}, {tnc, tnc}, {"ref_any"}, "ref_any"}; -std::vector mode{ngraph::helpers::SequenceTestsMode::PURE_SEQ}; +std::vector mode{ov::test::utils::SequenceTestsMode::PURE_SEQ}; // output values increase rapidly without clip, so use only seq_lengths = 2 std::vector> activations = {{"sigmoid", "tanh"}}; // dev_api::augrucell does not support lbr so far. @@ -194,190 +209,198 @@ std::vector clip{0.f}; // dev_api::augrusequence only supports forward so far. std::vector direction = {ov::op::RecurrentSequenceDirection::FORWARD}; -std::vector netPrecisions = { ElementType::f32 }; +std::vector netPrecisions = {ElementType::f32}; -const std::vector> staticShapes = { - { { {}, { {10, 2, 10} } }, // #0. Static shapes - { {}, { {10, 1, 1} } }, - { {}, { {10, 2, 1} } }, - { {}, { {10} } } }, - { { {}, { {10, 2, 10} } }, // #1. Static shapes - { {}, { {10, 1, 10} } }, - { {}, { {10, 2, 1} } }, - { {}, { {10} } } }, - { { {}, { {1, 2, 10} } }, // #2. Static shapes - { {}, { {1, 1, 1} } }, - { {}, { {1, 2, 1} } }, - { {}, { {1} } } }, - { { {}, { {1, 2, 10} } }, // #3. Static shapes - { {}, { {1, 1, 10} } }, - { {}, { {1, 2, 1} } }, - { {}, { {1} } } }, - { { {}, { {10, 2, 10} } }, // #4. Static shapes - { {}, { {10, 1, 1} } }, - { {}, { {10, 2, 1} } } }, - { { {}, { {10, 2, 10} } }, // #5. Static shapes - { {}, { {10, 1, 10} } }, - { {}, { {10, 2, 1} } } } -}; +const std::vector> staticShapes = {{{{}, {{10, 2, 10}}}, // #0. Static shapes + {{}, {{10, 1, 1}}}, + {{}, {{10, 2, 1}}}, + {{}, {{10}}}}, + {{{}, {{10, 2, 10}}}, // #1. Static shapes + {{}, {{10, 1, 10}}}, + {{}, {{10, 2, 1}}}, + {{}, {{10}}}}, + {{{}, {{1, 2, 10}}}, // #2. Static shapes + {{}, {{1, 1, 1}}}, + {{}, {{1, 2, 1}}}, + {{}, {{1}}}}, + {{{}, {{1, 2, 10}}}, // #3. Static shapes + {{}, {{1, 1, 10}}}, + {{}, {{1, 2, 1}}}, + {{}, {{1}}}}, + {{{}, {{10, 2, 10}}}, // #4. Static shapes + {{}, {{10, 1, 1}}}, + {{}, {{10, 2, 1}}}}, + {{{}, {{10, 2, 10}}}, // #5. Static shapes + {{}, {{10, 1, 10}}}, + {{}, {{10, 2, 1}}}}}; -INSTANTIATE_TEST_SUITE_P(smoke_static, AUGRUSequenceCPUTest, - ::testing::Combine(::testing::ValuesIn(std::vector>{staticShapes[0], staticShapes[1]}), - ::testing::ValuesIn(mode), - ::testing::ValuesIn(activations), - ::testing::ValuesIn(clip), - ::testing::ValuesIn(linearBeforeReset), - ::testing::ValuesIn(direction), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(cpuParams), - ::testing::Values(std::map{})), - AUGRUSequenceCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_static, + AUGRUSequenceCPUTest, + ::testing::Combine(::testing::ValuesIn(std::vector>{staticShapes[0], + staticShapes[1]}), + ::testing::ValuesIn(mode), + ::testing::ValuesIn(activations), + ::testing::ValuesIn(clip), + ::testing::ValuesIn(linearBeforeReset), + ::testing::ValuesIn(direction), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(cpuParams), + ::testing::Values(ov::AnyMap{})), + AUGRUSequenceCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_static_BatchSizeOne, AUGRUSequenceCPUTest, - ::testing::Combine(::testing::ValuesIn(std::vector>{staticShapes[3]}), - ::testing::ValuesIn(mode), - ::testing::ValuesIn(activations), - ::testing::ValuesIn(clip), - ::testing::ValuesIn(linearBeforeReset), - ::testing::ValuesIn(direction), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(cpuParamsBatchSizeOne), - ::testing::Values(std::map{})), - AUGRUSequenceCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_static_BatchSizeOne, + AUGRUSequenceCPUTest, + ::testing::Combine(::testing::ValuesIn(std::vector>{staticShapes[3]}), + ::testing::ValuesIn(mode), + ::testing::ValuesIn(activations), + ::testing::ValuesIn(clip), + ::testing::ValuesIn(linearBeforeReset), + ::testing::ValuesIn(direction), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(cpuParamsBatchSizeOne), + ::testing::Values(ov::AnyMap{})), + AUGRUSequenceCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(nightly_static_bf16, AUGRUSequenceCPUTest, - ::testing::Combine(::testing::ValuesIn(std::vector>{staticShapes[4], staticShapes[5]}), - ::testing::ValuesIn(mode), - ::testing::ValuesIn(activations), - ::testing::ValuesIn(clip), - ::testing::ValuesIn(linearBeforeReset), - ::testing::ValuesIn(direction), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(cpuParams), - ::testing::Values(additionalConfig[1])), - AUGRUSequenceCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(nightly_static_bf16, + AUGRUSequenceCPUTest, + ::testing::Combine(::testing::ValuesIn(std::vector>{staticShapes[4], + staticShapes[5]}), + ::testing::ValuesIn(mode), + ::testing::ValuesIn(activations), + ::testing::ValuesIn(clip), + ::testing::ValuesIn(linearBeforeReset), + ::testing::ValuesIn(direction), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(cpuParams), + ::testing::Values(additionalConfig[1])), + AUGRUSequenceCPUTest::getTestCaseName); const std::vector> dynamicShapes = { - { { {-1, {1, 5}, 10}, // #0. Dynamic shape 0 - { {10, 2, 10}, {8, 3, 10}, {5, 4, 10} } }, // Target shapes - { {{0, 15}, 1, 1}, // Dynamic shape 1 - { {10, 1, 1}, {8, 1, 1}, {5, 1, 1} } }, // Target shapes - { {-1, {1, 5}, 1}, // Dynamic shape 2 - { {10, 2, 1}, {8, 3, 1}, {5, 4, 1} } }, // Target shapes - { {{0, 12}}, // Dynamic shape 3 - { {10}, {8}, {5} } } }, // Target shapes - { { {{0, 11}, -1, 10}, // #1. Dynamic shape 0 - { {10, 2, 10}, {3, 4, 10}, {5, 5, 10} } }, // Target shapes - { {-1, 1, 10}, // Dynamic shape 1 - { {10, 1, 10}, {3, 1, 10}, {5, 1, 10} } }, // Target shapes - { {{0, 11}, -1, 1}, // Dynamic shape 3 - { {10, 2, 1}, {3, 4, 1}, {5, 5, 1} } }, // Target shapes - { {-1}, // Dynamic shape 2 - { {10}, {3}, {5} } } }, // Target shapes - { { {{0, 11}, -1, {7, 11}}, // #2. Dynamic shape 0 - { {10, 2, 10}, {3, 4, 10}, {5, 5, 10} } }, // Target shapes - { {-1, 1, {8, 12}}, // Dynamic shape 1 - { {10, 1, 10}, {3, 1, 10}, {5, 1, 10} } }, // Target shapes - { {{0, 11}, -1, 1}, // Dynamic shape 3 - { {10, 2, 1}, {3, 4, 1}, {5, 5, 1} } } , // Target shapes - { {-1}, // Dynamic shape 2 - { {10}, {3}, {5} } } }, // Target shapes - { { {-1, {0, 7}, 10}, // #3. Dynamic shape 0 - { {1, 2, 10}, {1, 3, 10}, {1, 6, 10} } }, // Target shapes - { {-1, 1, 1}, // Dynamic shape 1 - { {1, 1, 1}, {1, 1, 1}, {1, 1, 1} } }, // Target shapes - { {-1, {0, 7}, 1}, // Dynamic shape 3 - { {1, 2, 1}, {1, 3, 1}, {1, 6, 1} } }, // Target shapes - { {-1}, // Dynamic shape 2 - { {1}, {1}, {1} } } }, // Target shapes - { { {1, -1, 10}, // #4. Dynamic shape 0 - { {1, 2, 10}, {1, 4, 10}, {1, 8, 10} } }, // Target shapes - { {1, 1, 10}, // Dynamic shape 1 - { {1, 1, 10}, {1, 1, 10}, {1, 1, 10} } }, // Target shapes - { {1, -1, 1}, // Dynamic shape 0 - { {1, 2, 1}, {1, 4, 1}, {1, 8, 1} } }, // Target shapes - { {-1}, // Dynamic shape 2 - { {1}, {1}, {1} } } }, // Target shapes - { { {-1, -1, -1}, // #5. Dynamic shape 0 - { {1, 2, 10}, {1, 4, 10}, {1, 8, 10} } }, // Target shapes - { {-1, -1, -1}, // Dynamic shape 1 - { {1, 1, 10}, {1, 1, 10}, {1, 1, 10} } }, // Target shapes - { {-1, -1, -1}, // Dynamic shape 0 - { {1, 2, 1}, {1, 4, 1}, {1, 8, 1} } }, // Target shapes - { {-1}, // Dynamic shape 2 - { {1}, {1}, {1} } } }, // Target shapes - { { {2, {1, 5}, 10}, // #6. Dynamic shape 0 - { {2, 2, 10}, {2, 3, 10}, {2, 4, 10} } }, // Target shapes - { {2, 1, 1}, // Dynamic shape 1 - { {2, 1, 1}, {2, 1, 1}, {2, 1, 1} } }, // Target shapes - { {2, {1, 5}, 1}, // Dynamic shape 2 - { {2, 2, 1}, {2, 3, 1}, {2, 4, 1} } }, // Target shapes - { {-1}, // Dynamic shape 2 - { {2}, {2}, {2} } } }, // Target shapes - { { {5, -1, 10}, // #7. Dynamic shape 0 - { {5, 2, 10}, {5, 4, 10}, {5, 5, 10} } }, // Target shapes - { {5, 1, 10}, // Dynamic shape 1 - { {5, 1, 10}, {5, 1, 10}, {5, 1, 10} } }, // Target shapes - { {5, -1, 1}, // Dynamic shape 0 - { {5, 2, 1}, {5, 4, 1}, {5, 5, 1} } }, // Target shapes - { {-1}, // Dynamic shape 2 - { {5}, {5}, {5} } } }, // Target shapes - { { {{0, 11}, -1, {7, 11}}, // #8. Dynamic shape 0 - { {10, 2, 10}, {3, 4, 10}, {5, 5, 10}, {10, 2, 10}, {5, 5, 10} } }, // Target shapes - { {-1, 1, {8, 12}}, // Dynamic shape 1 - { {10, 1, 10}, {3, 1, 10}, {5, 1, 10}, {10, 1, 10}, {5, 1, 10} } }, // Target shapes - { {{0, 11}, -1, 1}, // Dynamic shape 3 - { {10, 2, 1}, {3, 4, 1}, {5, 5, 1}, {10, 2, 1}, {5, 5, 1} } }, // Target shapes - { {-1}, // Dynamic shape 2 - { {10}, {3}, {5}, {10}, {5} } } } // Target shapes + {{{-1, {1, 5}, 10}, // #0. Dynamic shape 0 + {{10, 2, 10}, {8, 3, 10}, {5, 4, 10}}}, // Target shapes + {{{0, 15}, 1, 1}, // Dynamic shape 1 + {{10, 1, 1}, {8, 1, 1}, {5, 1, 1}}}, // Target shapes + {{-1, {1, 5}, 1}, // Dynamic shape 2 + {{10, 2, 1}, {8, 3, 1}, {5, 4, 1}}}, // Target shapes + {{{0, 12}}, // Dynamic shape 3 + {{10}, {8}, {5}}}}, // Target shapes + {{{{0, 11}, -1, 10}, // #1. Dynamic shape 0 + {{10, 2, 10}, {3, 4, 10}, {5, 5, 10}}}, // Target shapes + {{-1, 1, 10}, // Dynamic shape 1 + {{10, 1, 10}, {3, 1, 10}, {5, 1, 10}}}, // Target shapes + {{{0, 11}, -1, 1}, // Dynamic shape 3 + {{10, 2, 1}, {3, 4, 1}, {5, 5, 1}}}, // Target shapes + {{-1}, // Dynamic shape 2 + {{10}, {3}, {5}}}}, // Target shapes + {{{{0, 11}, -1, {7, 11}}, // #2. Dynamic shape 0 + {{10, 2, 10}, {3, 4, 10}, {5, 5, 10}}}, // Target shapes + {{-1, 1, {8, 12}}, // Dynamic shape 1 + {{10, 1, 10}, {3, 1, 10}, {5, 1, 10}}}, // Target shapes + {{{0, 11}, -1, 1}, // Dynamic shape 3 + {{10, 2, 1}, {3, 4, 1}, {5, 5, 1}}}, // Target shapes + {{-1}, // Dynamic shape 2 + {{10}, {3}, {5}}}}, // Target shapes + {{{-1, {0, 7}, 10}, // #3. Dynamic shape 0 + {{1, 2, 10}, {1, 3, 10}, {1, 6, 10}}}, // Target shapes + {{-1, 1, 1}, // Dynamic shape 1 + {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}}, // Target shapes + {{-1, {0, 7}, 1}, // Dynamic shape 3 + {{1, 2, 1}, {1, 3, 1}, {1, 6, 1}}}, // Target shapes + {{-1}, // Dynamic shape 2 + {{1}, {1}, {1}}}}, // Target shapes + {{{1, -1, 10}, // #4. Dynamic shape 0 + {{1, 2, 10}, {1, 4, 10}, {1, 8, 10}}}, // Target shapes + {{1, 1, 10}, // Dynamic shape 1 + {{1, 1, 10}, {1, 1, 10}, {1, 1, 10}}}, // Target shapes + {{1, -1, 1}, // Dynamic shape 0 + {{1, 2, 1}, {1, 4, 1}, {1, 8, 1}}}, // Target shapes + {{-1}, // Dynamic shape 2 + {{1}, {1}, {1}}}}, // Target shapes + {{{-1, -1, -1}, // #5. Dynamic shape 0 + {{1, 2, 10}, {1, 4, 10}, {1, 8, 10}}}, // Target shapes + {{-1, -1, -1}, // Dynamic shape 1 + {{1, 1, 10}, {1, 1, 10}, {1, 1, 10}}}, // Target shapes + {{-1, -1, -1}, // Dynamic shape 0 + {{1, 2, 1}, {1, 4, 1}, {1, 8, 1}}}, // Target shapes + {{-1}, // Dynamic shape 2 + {{1}, {1}, {1}}}}, // Target shapes + {{{2, {1, 5}, 10}, // #6. Dynamic shape 0 + {{2, 2, 10}, {2, 3, 10}, {2, 4, 10}}}, // Target shapes + {{2, 1, 1}, // Dynamic shape 1 + {{2, 1, 1}, {2, 1, 1}, {2, 1, 1}}}, // Target shapes + {{2, {1, 5}, 1}, // Dynamic shape 2 + {{2, 2, 1}, {2, 3, 1}, {2, 4, 1}}}, // Target shapes + {{-1}, // Dynamic shape 2 + {{2}, {2}, {2}}}}, // Target shapes + {{{5, -1, 10}, // #7. Dynamic shape 0 + {{5, 2, 10}, {5, 4, 10}, {5, 5, 10}}}, // Target shapes + {{5, 1, 10}, // Dynamic shape 1 + {{5, 1, 10}, {5, 1, 10}, {5, 1, 10}}}, // Target shapes + {{5, -1, 1}, // Dynamic shape 0 + {{5, 2, 1}, {5, 4, 1}, {5, 5, 1}}}, // Target shapes + {{-1}, // Dynamic shape 2 + {{5}, {5}, {5}}}}, // Target shapes + {{{{0, 11}, -1, {7, 11}}, // #8. Dynamic shape 0 + {{10, 2, 10}, {3, 4, 10}, {5, 5, 10}, {10, 2, 10}, {5, 5, 10}}}, // Target shapes + {{-1, 1, {8, 12}}, // Dynamic shape 1 + {{10, 1, 10}, {3, 1, 10}, {5, 1, 10}, {10, 1, 10}, {5, 1, 10}}}, // Target shapes + {{{0, 11}, -1, 1}, // Dynamic shape 3 + {{10, 2, 1}, {3, 4, 1}, {5, 5, 1}, {10, 2, 1}, {5, 5, 1}}}, // Target shapes + {{-1}, // Dynamic shape 2 + {{10}, {3}, {5}, {10}, {5}}}} // Target shapes }; -INSTANTIATE_TEST_SUITE_P(smoke_dynamic, AUGRUSequenceCPUTest, - ::testing::Combine(::testing::ValuesIn({dynamicShapes[0], dynamicShapes[1], dynamicShapes[2]}), - ::testing::ValuesIn(mode), - ::testing::ValuesIn(activations), - ::testing::ValuesIn(clip), - ::testing::ValuesIn(linearBeforeReset), - ::testing::ValuesIn(direction), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(cpuParams), - ::testing::Values(std::map{})), - AUGRUSequenceCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_dynamic, + AUGRUSequenceCPUTest, + ::testing::Combine(::testing::ValuesIn({dynamicShapes[0], dynamicShapes[1], dynamicShapes[2]}), + ::testing::ValuesIn(mode), + ::testing::ValuesIn(activations), + ::testing::ValuesIn(clip), + ::testing::ValuesIn(linearBeforeReset), + ::testing::ValuesIn(direction), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(cpuParams), + ::testing::Values(ov::AnyMap{})), + AUGRUSequenceCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_dynamic_BatchSizeOne, AUGRUSequenceCPUTest, - ::testing::Combine(::testing::ValuesIn({dynamicShapes[4]}), - ::testing::ValuesIn(mode), - ::testing::ValuesIn(activations), - ::testing::ValuesIn(clip), - ::testing::ValuesIn(linearBeforeReset), - ::testing::ValuesIn(direction), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(cpuParamsBatchSizeOne), - ::testing::Values(std::map{})), - AUGRUSequenceCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_dynamic_BatchSizeOne, + AUGRUSequenceCPUTest, + ::testing::Combine(::testing::ValuesIn({dynamicShapes[4]}), + ::testing::ValuesIn(mode), + ::testing::ValuesIn(activations), + ::testing::ValuesIn(clip), + ::testing::ValuesIn(linearBeforeReset), + ::testing::ValuesIn(direction), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(cpuParamsBatchSizeOne), + ::testing::Values(ov::AnyMap{})), + AUGRUSequenceCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(nightly_dynamic, AUGRUSequenceCPUTest, - ::testing::Combine(::testing::ValuesIn({dynamicShapes[5], dynamicShapes[8]}), - ::testing::ValuesIn(mode), - ::testing::ValuesIn(activations), - ::testing::ValuesIn(clip), - ::testing::ValuesIn(linearBeforeReset), - ::testing::ValuesIn(direction), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(cpuParams), - ::testing::Values(std::map{})), - AUGRUSequenceCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(nightly_dynamic, + AUGRUSequenceCPUTest, + ::testing::Combine(::testing::ValuesIn({dynamicShapes[5], dynamicShapes[8]}), + ::testing::ValuesIn(mode), + ::testing::ValuesIn(activations), + ::testing::ValuesIn(clip), + ::testing::ValuesIn(linearBeforeReset), + ::testing::ValuesIn(direction), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(cpuParams), + ::testing::Values(ov::AnyMap{})), + AUGRUSequenceCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(nightly_dynamic_bf16, AUGRUSequenceCPUTest, - ::testing::Combine(::testing::ValuesIn({dynamicShapes[6], dynamicShapes[7]}), - ::testing::ValuesIn(mode), - ::testing::ValuesIn(activations), - ::testing::ValuesIn(clip), - ::testing::ValuesIn(linearBeforeReset), - ::testing::ValuesIn(direction), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(cpuParams), - ::testing::Values(additionalConfig[1])), - AUGRUSequenceCPUTest::getTestCaseName); -} // namespace -} // namespace CPULayerTestsDefinitions +INSTANTIATE_TEST_SUITE_P(nightly_dynamic_bf16, + AUGRUSequenceCPUTest, + ::testing::Combine(::testing::ValuesIn({dynamicShapes[6], dynamicShapes[7]}), + ::testing::ValuesIn(mode), + ::testing::ValuesIn(activations), + ::testing::ValuesIn(clip), + ::testing::ValuesIn(linearBeforeReset), + ::testing::ValuesIn(direction), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(cpuParams), + ::testing::Values(additionalConfig[1])), + AUGRUSequenceCPUTest::getTestCaseName); +} // namespace +} // namespace test +} // namespace ov diff --git a/src/plugins/intel_cpu/tests/functional/single_layer_tests/batch_to_space.cpp b/src/plugins/intel_cpu/tests/functional/single_layer_tests/batch_to_space.cpp index 99367ef14e8..39eb90391a8 100644 --- a/src/plugins/intel_cpu/tests/functional/single_layer_tests/batch_to_space.cpp +++ b/src/plugins/intel_cpu/tests/functional/single_layer_tests/batch_to_space.cpp @@ -3,32 +3,32 @@ // #include -#include "shared_test_classes/base/ov_subgraph.hpp" + #include "ov_models/builders.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" #include "test_utils/cpu_test_utils.hpp" -using namespace InferenceEngine; using namespace CPUTestUtils; -using namespace ov::test; -namespace CPULayerTestsDefinitions { +namespace ov { +namespace test { namespace { - std::vector blockShape, cropsBegin, cropsEnd; +std::vector blockShape, cropsBegin, cropsEnd; } // namespace -using BatchToSpaceLayerTestCPUParams = std::tuple< - std::vector, // Input shapes - std::vector, // block shape - std::vector, // crops begin - std::vector, // crops end - ov::element::Type, // Network precision - CPUSpecificParams>; +using BatchToSpaceLayerTestCPUParams = std::tuple, // Input shapes + std::vector, // block shape + std::vector, // crops begin + std::vector, // crops end + ov::element::Type, // Network precision + CPUSpecificParams>; class BatchToSpaceCPULayerTest : public testing::WithParamInterface, - virtual public SubgraphBaseTest, public CPUTestsBase { + virtual public SubgraphBaseTest, + public CPUTestsBase { public: - static std::string getTestCaseName(const testing::TestParamInfo &obj) { + static std::string getTestCaseName(const testing::TestParamInfo& obj) { std::vector inputShapes; ov::element::Type model_type; CPUSpecificParams cpuParams; @@ -36,7 +36,7 @@ public: std::ostringstream result; if (inputShapes.front().first.size() != 0) { result << "IS=("; - for (const auto &shape : inputShapes) { + for (const auto& shape : inputShapes) { result << ov::test::utils::partialShape2str({shape.first}) << "_"; } result.seekp(-1, result.cur); @@ -65,24 +65,24 @@ public: const auto& param_type = parameter->get_output_element_type(0); const auto& static_shape = targetInputStaticShapes[i]; switch (i) { - case 0: { - tensor = ov::test::utils::create_and_fill_tensor(param_type, static_shape, 2560, 0, 256); - break; - } - case 1: { - ASSERT_EQ(ov::shape_size(static_shape), blockShape.size()); - tensor = ov::Tensor(param_type, static_shape, blockShape.data()); - break; - } - case 2: - case 3: { - ASSERT_EQ(ov::shape_size(static_shape), cropsEnd.size()); - tensor = ov::Tensor(param_type, static_shape, cropsEnd.data()); - break; - } - default: { - throw std::runtime_error("Incorrect parameter number!"); - } + case 0: { + tensor = ov::test::utils::create_and_fill_tensor(param_type, static_shape, 2560, 0, 256); + break; + } + case 1: { + ASSERT_EQ(ov::shape_size(static_shape), blockShape.size()); + tensor = ov::Tensor(param_type, static_shape, blockShape.data()); + break; + } + case 2: + case 3: { + ASSERT_EQ(ov::shape_size(static_shape), cropsEnd.size()); + tensor = ov::Tensor(param_type, static_shape, cropsEnd.data()); + break; + } + default: { + throw std::runtime_error("Incorrect parameter number!"); + } } inputs.insert({parameter, tensor}); } @@ -92,7 +92,7 @@ protected: void SetUp() override { targetDevice = ov::test::utils::DEVICE_CPU; - std::vector inputShapes; + std::vector inputShapes; ov::element::Type model_type; CPUSpecificParams cpuParams; std::tie(inputShapes, blockShape, cropsBegin, cropsEnd, model_type, cpuParams) = this->GetParam(); @@ -120,8 +120,8 @@ protected: in3 = std::make_shared(ov::element::Type_t::i64, inputDynamicShapes[3]); auto btsNode = std::make_shared(in0, in1, in2, in3); btsNode->get_rt_info() = getCPUInfo(); - ngraph::ResultVector results{std::make_shared(btsNode)}; - function = std::make_shared(results, ov::ParameterVector{in0, in1, in2, in3}, "BatchToSpace"); + ov::ResultVector results{std::make_shared(btsNode)}; + function = std::make_shared(results, ov::ParameterVector{in0, in1, in2, in3}, "BatchToSpace"); } }; @@ -132,310 +132,273 @@ TEST_P(BatchToSpaceCPULayerTest, CompareWithRefs) { namespace { -const std::vector model_types = { - ov::element::Type_t::u8, - ov::element::Type_t::i8, - ov::element::Type_t::i32, - ov::element::Type_t::f32, - ov::element::Type_t::bf16 -}; +const std::vector model_types = {ov::element::Type_t::u8, + ov::element::Type_t::i8, + ov::element::Type_t::i32, + ov::element::Type_t::f32, + ov::element::Type_t::bf16}; -const std::vector> blockShape4D1 = {{1, 1, 1, 2}, {1, 2, 2, 1}}; -const std::vector> cropsBegin4D1 = {{0, 0, 0, 0}, {0, 0, 0, 1}, {0, 0, 2, 0}}; -const std::vector> cropsEnd4D1 = {{0, 0, 0, 0}, {0, 0, 1, 0}, {0, 0, 1, 1}}; +const std::vector> blockShape4D1 = {{1, 1, 1, 2}, {1, 2, 2, 1}}; +const std::vector> cropsBegin4D1 = {{0, 0, 0, 0}, {0, 0, 0, 1}, {0, 0, 2, 0}}; +const std::vector> cropsEnd4D1 = {{0, 0, 0, 0}, {0, 0, 1, 0}, {0, 0, 1, 1}}; -std::vector> staticInputShapes4D1 = { - {{8, 16, 10, 10}, {4}, {4}, {4}} -}; +std::vector> staticInputShapes4D1 = {{{8, 16, 10, 10}, {4}, {4}, {4}}}; std::vector> dynamicInputShapes4D1 = { - { - {{-1, -1, -1, -1}, {{8, 8, 6, 7}, {4, 10, 5, 5}, {12, 9, 7, 5}}}, - {{4}, {{4}, {4}, {4}}}, - {{4}, {{4}, {4}, {4}}}, - {{4}, {{4}, {4}, {4}}} - }, - { - {{{4, 12}, {8, 16}, 6, -1}, {{8, 8, 6, 7}, {4, 10, 6, 5}, {12, 9, 6, 5}}}, - {{4}, {{4}, {4}, {4}}}, - {{4}, {{4}, {4}, {4}}}, - {{4}, {{4}, {4}, {4}}} - } -}; + {{{-1, -1, -1, -1}, {{8, 8, 6, 7}, {4, 10, 5, 5}, {12, 9, 7, 5}}}, + {{4}, {{4}, {4}, {4}}}, + {{4}, {{4}, {4}, {4}}}, + {{4}, {{4}, {4}, {4}}}}, + {{{{4, 12}, {8, 16}, 6, -1}, {{8, 8, 6, 7}, {4, 10, 6, 5}, {12, 9, 6, 5}}}, + {{4}, {{4}, {4}, {4}}}, + {{4}, {{4}, {4}, {4}}}, + {{4}, {{4}, {4}, {4}}}}}; std::vector> dynamicInputShapes4D1Blocked = { - { - {{-1, 16, -1, -1}, {{4, 16, 5, 8}, {8, 16, 7, 6}, {12, 16, 4, 5}}}, - {{4}, {{4}, {4}, {4}}}, - {{4}, {{4}, {4}, {4}}}, - {{4}, {{4}, {4}, {4}}} - } -}; + {{{-1, 16, -1, -1}, {{4, 16, 5, 8}, {8, 16, 7, 6}, {12, 16, 4, 5}}}, + {{4}, {{4}, {4}, {4}}}, + {{4}, {{4}, {4}, {4}}}, + {{4}, {{4}, {4}, {4}}}}}; -const std::vector> blockShape4D2 = {{1, 2, 3, 4}, {1, 3, 4, 2}}; -const std::vector> cropsBegin4D2 = {{0, 0, 0, 1}, {0, 0, 1, 2}}; -const std::vector> cropsEnd4D2 = {{0, 0, 1, 0}, {0, 0, 3, 1}}; +const std::vector> blockShape4D2 = {{1, 2, 3, 4}, {1, 3, 4, 2}}; +const std::vector> cropsBegin4D2 = {{0, 0, 0, 1}, {0, 0, 1, 2}}; +const std::vector> cropsEnd4D2 = {{0, 0, 1, 0}, {0, 0, 3, 1}}; -std::vector> staticInputShapes4D2 = { - {{24, 16, 7, 8}, {4}, {4}, {4}} -}; +std::vector> staticInputShapes4D2 = {{{24, 16, 7, 8}, {4}, {4}, {4}}}; std::vector> dynamicInputShapes4D2 = { - { - {{-1, -1, -1, -1}, {{48, 4, 7, 8}, {24, 8, 6, 7}, {24, 16, 5, 5}}}, - {{4}, {{4}, {4}, {4}}}, - {{4}, {{4}, {4}, {4}}}, - {{4}, {{4}, {4}, {4}}} - }, - { - {{24, {4, 10}, -1, -1}, {{24, 8, 6, 7}, {24, 6, 7, 5}, {24, 4, 5, 5}}}, - {{4}, {{4}, {4}, {4}}}, - {{4}, {{4}, {4}, {4}}}, - {{4}, {{4}, {4}, {4}}} - } -}; + {{{-1, -1, -1, -1}, {{48, 4, 7, 8}, {24, 8, 6, 7}, {24, 16, 5, 5}}}, + {{4}, {{4}, {4}, {4}}}, + {{4}, {{4}, {4}, {4}}}, + {{4}, {{4}, {4}, {4}}}}, + {{{24, {4, 10}, -1, -1}, {{24, 8, 6, 7}, {24, 6, 7, 5}, {24, 4, 5, 5}}}, + {{4}, {{4}, {4}, {4}}}, + {{4}, {{4}, {4}, {4}}}, + {{4}, {{4}, {4}, {4}}}}}; std::vector> dynamicInputShapes4D2Blocked = { - { - {{-1, 16, -1, -1}, {{24, 16, 5, 5}, {24, 16, 6, 7}, {48, 16, 4, 4}}}, - {{4}, {{4}, {4}, {4}}}, - {{4}, {{4}, {4}, {4}}}, - {{4}, {{4}, {4}, {4}}} - } -}; + {{{-1, 16, -1, -1}, {{24, 16, 5, 5}, {24, 16, 6, 7}, {48, 16, 4, 4}}}, + {{4}, {{4}, {4}, {4}}}, + {{4}, {{4}, {4}, {4}}}, + {{4}, {{4}, {4}, {4}}}}}; -const std::vector cpuParamsWithBlock_4D = { - CPUSpecificParams({nChw16c}, {nChw16c}, {}, {}), - CPUSpecificParams({nChw8c}, {nChw8c}, {}, {}), - CPUSpecificParams({nhwc}, {nhwc}, {}, {}), - CPUSpecificParams({nchw}, {nchw}, {}, {}) -}; +const std::vector cpuParamsWithBlock_4D = {CPUSpecificParams({nChw16c}, {nChw16c}, {}, {}), + CPUSpecificParams({nChw8c}, {nChw8c}, {}, {}), + CPUSpecificParams({nhwc}, {nhwc}, {}, {}), + CPUSpecificParams({nchw}, {nchw}, {}, {})}; -const std::vector cpuParams_4D = { - CPUSpecificParams({nhwc}, {nhwc}, {}, {}), - CPUSpecificParams({nchw}, {nchw}, {}, {}) -}; +const std::vector cpuParams_4D = {CPUSpecificParams({nhwc}, {nhwc}, {}, {}), + CPUSpecificParams({nchw}, {nchw}, {}, {})}; -const auto staticBatchToSpaceParamsSet4D1 = ::testing::Combine( - ::testing::ValuesIn(static_shapes_to_test_representation(staticInputShapes4D1)), - ::testing::ValuesIn(blockShape4D1), - ::testing::ValuesIn(cropsBegin4D1), - ::testing::ValuesIn(cropsEnd4D1), - ::testing::ValuesIn(model_types), - ::testing::ValuesIn(cpuParamsWithBlock_4D)); +const auto staticBatchToSpaceParamsSet4D1 = + ::testing::Combine(::testing::ValuesIn(static_shapes_to_test_representation(staticInputShapes4D1)), + ::testing::ValuesIn(blockShape4D1), + ::testing::ValuesIn(cropsBegin4D1), + ::testing::ValuesIn(cropsEnd4D1), + ::testing::ValuesIn(model_types), + ::testing::ValuesIn(cpuParamsWithBlock_4D)); -const auto dynamicBatchToSpaceParamsSet4D1 = ::testing::Combine( - ::testing::ValuesIn(dynamicInputShapes4D1), - ::testing::ValuesIn(blockShape4D1), - ::testing::ValuesIn(cropsBegin4D1), - ::testing::ValuesIn(cropsEnd4D1), - ::testing::ValuesIn(model_types), - ::testing::ValuesIn(cpuParams_4D)); +const auto dynamicBatchToSpaceParamsSet4D1 = ::testing::Combine(::testing::ValuesIn(dynamicInputShapes4D1), + ::testing::ValuesIn(blockShape4D1), + ::testing::ValuesIn(cropsBegin4D1), + ::testing::ValuesIn(cropsEnd4D1), + ::testing::ValuesIn(model_types), + ::testing::ValuesIn(cpuParams_4D)); -const auto dynamicBatchToSpaceParamsWithBlockedSet4D1 = ::testing::Combine( - ::testing::ValuesIn(dynamicInputShapes4D1Blocked), - ::testing::ValuesIn(blockShape4D1), - ::testing::ValuesIn(cropsBegin4D1), - ::testing::ValuesIn(cropsEnd4D1), - ::testing::ValuesIn(model_types), - ::testing::ValuesIn(cpuParamsWithBlock_4D)); +const auto dynamicBatchToSpaceParamsWithBlockedSet4D1 = + ::testing::Combine(::testing::ValuesIn(dynamicInputShapes4D1Blocked), + ::testing::ValuesIn(blockShape4D1), + ::testing::ValuesIn(cropsBegin4D1), + ::testing::ValuesIn(cropsEnd4D1), + ::testing::ValuesIn(model_types), + ::testing::ValuesIn(cpuParamsWithBlock_4D)); -const auto staticBatchToSpaceParamsSet4D2 = ::testing::Combine( - ::testing::ValuesIn(static_shapes_to_test_representation(staticInputShapes4D2)), - ::testing::ValuesIn(blockShape4D2), - ::testing::ValuesIn(cropsBegin4D2), - ::testing::ValuesIn(cropsEnd4D2), - ::testing::ValuesIn(model_types), - ::testing::ValuesIn(cpuParamsWithBlock_4D)); +const auto staticBatchToSpaceParamsSet4D2 = + ::testing::Combine(::testing::ValuesIn(static_shapes_to_test_representation(staticInputShapes4D2)), + ::testing::ValuesIn(blockShape4D2), + ::testing::ValuesIn(cropsBegin4D2), + ::testing::ValuesIn(cropsEnd4D2), + ::testing::ValuesIn(model_types), + ::testing::ValuesIn(cpuParamsWithBlock_4D)); -const auto dynamicBatchToSpaceParamsSet4D2 = ::testing::Combine( - ::testing::ValuesIn(dynamicInputShapes4D2), - ::testing::ValuesIn(blockShape4D2), - ::testing::ValuesIn(cropsBegin4D2), - ::testing::ValuesIn(cropsEnd4D2), - ::testing::ValuesIn(model_types), - ::testing::ValuesIn(cpuParams_4D)); +const auto dynamicBatchToSpaceParamsSet4D2 = ::testing::Combine(::testing::ValuesIn(dynamicInputShapes4D2), + ::testing::ValuesIn(blockShape4D2), + ::testing::ValuesIn(cropsBegin4D2), + ::testing::ValuesIn(cropsEnd4D2), + ::testing::ValuesIn(model_types), + ::testing::ValuesIn(cpuParams_4D)); -const auto dynamicBatchToSpaceParamsWithBlockedSet4D2 = ::testing::Combine( - ::testing::ValuesIn(dynamicInputShapes4D2Blocked), - ::testing::ValuesIn(blockShape4D2), - ::testing::ValuesIn(cropsBegin4D2), - ::testing::ValuesIn(cropsEnd4D2), - ::testing::ValuesIn(model_types), - ::testing::ValuesIn(cpuParamsWithBlock_4D)); +const auto dynamicBatchToSpaceParamsWithBlockedSet4D2 = + ::testing::Combine(::testing::ValuesIn(dynamicInputShapes4D2Blocked), + ::testing::ValuesIn(blockShape4D2), + ::testing::ValuesIn(cropsBegin4D2), + ::testing::ValuesIn(cropsEnd4D2), + ::testing::ValuesIn(model_types), + ::testing::ValuesIn(cpuParamsWithBlock_4D)); -INSTANTIATE_TEST_SUITE_P(smoke_StaticBatchToSpaceCPULayerTestCase1_4D, BatchToSpaceCPULayerTest, - staticBatchToSpaceParamsSet4D1, BatchToSpaceCPULayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_StaticBatchToSpaceCPULayerTestCase1_4D, + BatchToSpaceCPULayerTest, + staticBatchToSpaceParamsSet4D1, + BatchToSpaceCPULayerTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_DynamicBatchToSpaceCPULayerTestCase1_4D, BatchToSpaceCPULayerTest, - dynamicBatchToSpaceParamsSet4D1, BatchToSpaceCPULayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_DynamicBatchToSpaceCPULayerTestCase1_4D, + BatchToSpaceCPULayerTest, + dynamicBatchToSpaceParamsSet4D1, + BatchToSpaceCPULayerTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_DynamicBatchToSpaceCPULayerTestCaseWithBlocked1_4D, BatchToSpaceCPULayerTest, - dynamicBatchToSpaceParamsWithBlockedSet4D1, BatchToSpaceCPULayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_DynamicBatchToSpaceCPULayerTestCaseWithBlocked1_4D, + BatchToSpaceCPULayerTest, + dynamicBatchToSpaceParamsWithBlockedSet4D1, + BatchToSpaceCPULayerTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_StaticBatchToSpaceCPULayerTestCase2_4D, BatchToSpaceCPULayerTest, - staticBatchToSpaceParamsSet4D2, BatchToSpaceCPULayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_StaticBatchToSpaceCPULayerTestCase2_4D, + BatchToSpaceCPULayerTest, + staticBatchToSpaceParamsSet4D2, + BatchToSpaceCPULayerTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_DynamicBatchToSpaceCPULayerTestCase2_4D, BatchToSpaceCPULayerTest, - dynamicBatchToSpaceParamsSet4D2, BatchToSpaceCPULayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_DynamicBatchToSpaceCPULayerTestCase2_4D, + BatchToSpaceCPULayerTest, + dynamicBatchToSpaceParamsSet4D2, + BatchToSpaceCPULayerTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_DynamicBatchToSpaceCPULayerTestCaseWithBlocked2_4D, BatchToSpaceCPULayerTest, - dynamicBatchToSpaceParamsWithBlockedSet4D2, BatchToSpaceCPULayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_DynamicBatchToSpaceCPULayerTestCaseWithBlocked2_4D, + BatchToSpaceCPULayerTest, + dynamicBatchToSpaceParamsWithBlockedSet4D2, + BatchToSpaceCPULayerTest::getTestCaseName); -const std::vector> blockShape5D1 = {{1, 1, 2, 2, 1}, {1, 2, 1, 2, 2}}; -const std::vector> cropsBegin5D1 = {{0, 0, 0, 0, 0}, {0, 0, 0, 3, 3}}; -const std::vector> cropsEnd5D1 = {{0, 0, 0, 0, 0}, {0, 0, 1, 0, 1}}; - -std::vector> staticInputShapes5D1 = { - {{8, 16, 4, 10, 10}, {5}, {5}, {5}} -}; +const std::vector> blockShape5D1 = {{1, 1, 2, 2, 1}, {1, 2, 1, 2, 2}}; +const std::vector> cropsBegin5D1 = {{0, 0, 0, 0, 0}, {0, 0, 0, 3, 3}}; +const std::vector> cropsEnd5D1 = {{0, 0, 0, 0, 0}, {0, 0, 1, 0, 1}}; +std::vector> staticInputShapes5D1 = {{{8, 16, 4, 10, 10}, {5}, {5}, {5}}}; std::vector> dynamicInputShapes5D1 = { - { - {{-1, -1, -1, -1, -1}, {{8, 16, 4, 10, 10}, {16, 10, 5, 11, 9}, {24, 6, 6, 8, 8}}}, - {{5}, {{5}, {5}, {5}}}, - {{5}, {{5}, {5}, {5}}}, - {{5}, {{5}, {5}, {5}}} - }, - { - {{{8, 16}, {8, 16}, {2, 7}, -1, -1}, {{8, 16, 2, 6, 8}, {8, 10, 4, 7, 5}, {16, 8, 7, 5, 10}}}, - {{5}, {{5}, {5}, {5}}}, - {{5}, {{5}, {5}, {5}}}, - {{5}, {{5}, {5}, {5}}} - } -}; + {{{-1, -1, -1, -1, -1}, {{8, 16, 4, 10, 10}, {16, 10, 5, 11, 9}, {24, 6, 6, 8, 8}}}, + {{5}, {{5}, {5}, {5}}}, + {{5}, {{5}, {5}, {5}}}, + {{5}, {{5}, {5}, {5}}}}, + {{{{8, 16}, {8, 16}, {2, 7}, -1, -1}, {{8, 16, 2, 6, 8}, {8, 10, 4, 7, 5}, {16, 8, 7, 5, 10}}}, + {{5}, {{5}, {5}, {5}}}, + {{5}, {{5}, {5}, {5}}}, + {{5}, {{5}, {5}, {5}}}}}; std::vector> dynamicInputShapes5D1Blocked = { - { - {{-1, 16, -1, -1, -1}, {{24, 16, 3, 6, 7}, {48, 16, 4, 5, 5}, {24, 16, 5, 8, 5}}}, - {{5}, {{5}, {5}, {5}}}, - {{5}, {{5}, {5}, {5}}}, - {{5}, {{5}, {5}, {5}}} - } -}; + {{{-1, 16, -1, -1, -1}, {{24, 16, 3, 6, 7}, {48, 16, 4, 5, 5}, {24, 16, 5, 8, 5}}}, + {{5}, {{5}, {5}, {5}}}, + {{5}, {{5}, {5}, {5}}}, + {{5}, {{5}, {5}, {5}}}}}; -const std::vector> blockShape5D2 = {{1, 2, 4, 3, 1}, {1, 1, 2, 4, 3}}; -const std::vector> cropsBegin5D2 = {{0, 0, 1, 2, 0}, {0, 0, 1, 0, 1}}; -const std::vector> cropsEnd5D2 = {{0, 0, 1, 0, 1}, {0, 0, 1, 1, 1}}; +const std::vector> blockShape5D2 = {{1, 2, 4, 3, 1}, {1, 1, 2, 4, 3}}; +const std::vector> cropsBegin5D2 = {{0, 0, 1, 2, 0}, {0, 0, 1, 0, 1}}; +const std::vector> cropsEnd5D2 = {{0, 0, 1, 0, 1}, {0, 0, 1, 1, 1}}; -std::vector> staticInputShapes5D2 = { - {{48, 16, 3, 3, 3}, {5}, {5}, {5}} -}; +std::vector> staticInputShapes5D2 = {{{48, 16, 3, 3, 3}, {5}, {5}, {5}}}; std::vector> dynamicInputShapes5D2 = { - { - {{-1, -1, -1, -1, -1}, {{48, 4, 3, 3, 3}, {24, 16, 5, 3, 5}, {24, 8, 7, 5, 5}}}, - {{5}, {{5}, {5}, {5}}}, - {{5}, {{5}, {5}, {5}}}, - {{5}, {{5}, {5}, {5}}} - }, - { - {{24, {8, 16}, {3, 5}, -1, -1}, {{24, 16, 3, 4, 3}, {24, 12, 5, 3, 5}, {24, 8, 4, 5, 5}}}, - {{5}, {{5}, {5}, {5}}}, - {{5}, {{5}, {5}, {5}}}, - {{5}, {{5}, {5}, {5}}} - }, - { - // special case - {{{1, 24}, {1, 16}, {1, 10}, {1, 10}, {1, 10}}, - { - {24, 16, 5, 3, 5}, - {24, 16, 5, 3, 5}, - {24, 16, 7, 5, 5} - }}, - {{5}, {{5}, {5}, {5}}}, - {{5}, {{5}, {5}, {5}}}, - {{5}, {{5}, {5}, {5}}} - } -}; + {{{-1, -1, -1, -1, -1}, {{48, 4, 3, 3, 3}, {24, 16, 5, 3, 5}, {24, 8, 7, 5, 5}}}, + {{5}, {{5}, {5}, {5}}}, + {{5}, {{5}, {5}, {5}}}, + {{5}, {{5}, {5}, {5}}}}, + {{{24, {8, 16}, {3, 5}, -1, -1}, {{24, 16, 3, 4, 3}, {24, 12, 5, 3, 5}, {24, 8, 4, 5, 5}}}, + {{5}, {{5}, {5}, {5}}}, + {{5}, {{5}, {5}, {5}}}, + {{5}, {{5}, {5}, {5}}}}, + {// special case + {{{1, 24}, {1, 16}, {1, 10}, {1, 10}, {1, 10}}, {{24, 16, 5, 3, 5}, {24, 16, 5, 3, 5}, {24, 16, 7, 5, 5}}}, + {{5}, {{5}, {5}, {5}}}, + {{5}, {{5}, {5}, {5}}}, + {{5}, {{5}, {5}, {5}}}}}; std::vector> dynamicInputShapes5D2Blocked = { - { - {{-1, 16, -1, -1, -1}, {{24, 16, 4, 5, 5}, {48, 16, 3, 4, 3}, {24, 16, 5, 3, 5}}}, - {{5}, {{5}, {5}, {5}}}, - {{5}, {{5}, {5}, {5}}}, - {{5}, {{5}, {5}, {5}}} - } -}; + {{{-1, 16, -1, -1, -1}, {{24, 16, 4, 5, 5}, {48, 16, 3, 4, 3}, {24, 16, 5, 3, 5}}}, + {{5}, {{5}, {5}, {5}}}, + {{5}, {{5}, {5}, {5}}}, + {{5}, {{5}, {5}, {5}}}}}; -const std::vector cpuParamsWithBlock_5D = { - CPUSpecificParams({nCdhw16c}, {nCdhw16c}, {}, {}), - CPUSpecificParams({nCdhw8c}, {nCdhw8c}, {}, {}), - CPUSpecificParams({ndhwc}, {ndhwc}, {}, {}), - CPUSpecificParams({ncdhw}, {ncdhw}, {}, {}) -}; +const std::vector cpuParamsWithBlock_5D = {CPUSpecificParams({nCdhw16c}, {nCdhw16c}, {}, {}), + CPUSpecificParams({nCdhw8c}, {nCdhw8c}, {}, {}), + CPUSpecificParams({ndhwc}, {ndhwc}, {}, {}), + CPUSpecificParams({ncdhw}, {ncdhw}, {}, {})}; -const std::vector cpuParams_5D = { - CPUSpecificParams({ndhwc}, {ndhwc}, {}, {}), - CPUSpecificParams({ncdhw}, {ncdhw}, {}, {}) -}; +const std::vector cpuParams_5D = {CPUSpecificParams({ndhwc}, {ndhwc}, {}, {}), + CPUSpecificParams({ncdhw}, {ncdhw}, {}, {})}; -const auto staticBatchToSpaceParamsSet5D1 = ::testing::Combine( - ::testing::ValuesIn(static_shapes_to_test_representation(staticInputShapes5D1)), - ::testing::ValuesIn(blockShape5D1), - ::testing::ValuesIn(cropsBegin5D1), - ::testing::ValuesIn(cropsEnd5D1), - ::testing::ValuesIn(model_types), - ::testing::ValuesIn(cpuParamsWithBlock_5D)); +const auto staticBatchToSpaceParamsSet5D1 = + ::testing::Combine(::testing::ValuesIn(static_shapes_to_test_representation(staticInputShapes5D1)), + ::testing::ValuesIn(blockShape5D1), + ::testing::ValuesIn(cropsBegin5D1), + ::testing::ValuesIn(cropsEnd5D1), + ::testing::ValuesIn(model_types), + ::testing::ValuesIn(cpuParamsWithBlock_5D)); -const auto dynamicBatchToSpaceParamsSet5D1 = ::testing::Combine( - ::testing::ValuesIn(dynamicInputShapes5D1), - ::testing::ValuesIn(blockShape5D1), - ::testing::ValuesIn(cropsBegin5D1), - ::testing::ValuesIn(cropsEnd5D1), - ::testing::ValuesIn(model_types), - ::testing::ValuesIn(cpuParams_5D)); +const auto dynamicBatchToSpaceParamsSet5D1 = ::testing::Combine(::testing::ValuesIn(dynamicInputShapes5D1), + ::testing::ValuesIn(blockShape5D1), + ::testing::ValuesIn(cropsBegin5D1), + ::testing::ValuesIn(cropsEnd5D1), + ::testing::ValuesIn(model_types), + ::testing::ValuesIn(cpuParams_5D)); -const auto dynamicBatchToSpaceParamsWithBlockedSet5D1 = ::testing::Combine( - ::testing::ValuesIn(dynamicInputShapes5D1Blocked), - ::testing::ValuesIn(blockShape5D1), - ::testing::ValuesIn(cropsBegin5D1), - ::testing::ValuesIn(cropsEnd5D1), - ::testing::ValuesIn(model_types), - ::testing::ValuesIn(cpuParamsWithBlock_5D)); +const auto dynamicBatchToSpaceParamsWithBlockedSet5D1 = + ::testing::Combine(::testing::ValuesIn(dynamicInputShapes5D1Blocked), + ::testing::ValuesIn(blockShape5D1), + ::testing::ValuesIn(cropsBegin5D1), + ::testing::ValuesIn(cropsEnd5D1), + ::testing::ValuesIn(model_types), + ::testing::ValuesIn(cpuParamsWithBlock_5D)); -const auto staticBatchToSpaceParamsSet5D2 = ::testing::Combine( - ::testing::ValuesIn(static_shapes_to_test_representation(staticInputShapes5D2)), - ::testing::ValuesIn(blockShape5D2), - ::testing::ValuesIn(cropsBegin5D2), - ::testing::ValuesIn(cropsEnd5D2), - ::testing::ValuesIn(model_types), - ::testing::ValuesIn(cpuParamsWithBlock_5D)); +const auto staticBatchToSpaceParamsSet5D2 = + ::testing::Combine(::testing::ValuesIn(static_shapes_to_test_representation(staticInputShapes5D2)), + ::testing::ValuesIn(blockShape5D2), + ::testing::ValuesIn(cropsBegin5D2), + ::testing::ValuesIn(cropsEnd5D2), + ::testing::ValuesIn(model_types), + ::testing::ValuesIn(cpuParamsWithBlock_5D)); -const auto dynamicBatchToSpaceParamsSet5D2 = ::testing::Combine( - ::testing::ValuesIn(dynamicInputShapes5D2), - ::testing::ValuesIn(blockShape5D2), - ::testing::ValuesIn(cropsBegin5D2), - ::testing::ValuesIn(cropsEnd5D2), - ::testing::ValuesIn(model_types), - ::testing::ValuesIn(cpuParams_5D)); +const auto dynamicBatchToSpaceParamsSet5D2 = ::testing::Combine(::testing::ValuesIn(dynamicInputShapes5D2), + ::testing::ValuesIn(blockShape5D2), + ::testing::ValuesIn(cropsBegin5D2), + ::testing::ValuesIn(cropsEnd5D2), + ::testing::ValuesIn(model_types), + ::testing::ValuesIn(cpuParams_5D)); -const auto dynamicBatchToSpaceParamsWithBlockedSet5D2 = ::testing::Combine( - ::testing::ValuesIn(dynamicInputShapes5D2Blocked), - ::testing::ValuesIn(blockShape5D2), - ::testing::ValuesIn(cropsBegin5D2), - ::testing::ValuesIn(cropsEnd5D2), - ::testing::ValuesIn(model_types), - ::testing::ValuesIn(cpuParamsWithBlock_5D)); +const auto dynamicBatchToSpaceParamsWithBlockedSet5D2 = + ::testing::Combine(::testing::ValuesIn(dynamicInputShapes5D2Blocked), + ::testing::ValuesIn(blockShape5D2), + ::testing::ValuesIn(cropsBegin5D2), + ::testing::ValuesIn(cropsEnd5D2), + ::testing::ValuesIn(model_types), + ::testing::ValuesIn(cpuParamsWithBlock_5D)); -INSTANTIATE_TEST_SUITE_P(smoke_StaticBatchToSpaceCPULayerTestCase1_5D, BatchToSpaceCPULayerTest, - staticBatchToSpaceParamsSet5D1, BatchToSpaceCPULayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_StaticBatchToSpaceCPULayerTestCase1_5D, + BatchToSpaceCPULayerTest, + staticBatchToSpaceParamsSet5D1, + BatchToSpaceCPULayerTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_DynamicBatchToSpaceCPULayerTestCase1_5D, BatchToSpaceCPULayerTest, - dynamicBatchToSpaceParamsSet5D1, BatchToSpaceCPULayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_DynamicBatchToSpaceCPULayerTestCase1_5D, + BatchToSpaceCPULayerTest, + dynamicBatchToSpaceParamsSet5D1, + BatchToSpaceCPULayerTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_DynamicBatchToSpaceCPULayerTestCaseWithBlocked1_5D, BatchToSpaceCPULayerTest, - dynamicBatchToSpaceParamsWithBlockedSet5D1, BatchToSpaceCPULayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_DynamicBatchToSpaceCPULayerTestCaseWithBlocked1_5D, + BatchToSpaceCPULayerTest, + dynamicBatchToSpaceParamsWithBlockedSet5D1, + BatchToSpaceCPULayerTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_StaticBatchToSpaceCPULayerTestCase2_5D, BatchToSpaceCPULayerTest, - staticBatchToSpaceParamsSet5D2, BatchToSpaceCPULayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_StaticBatchToSpaceCPULayerTestCase2_5D, + BatchToSpaceCPULayerTest, + staticBatchToSpaceParamsSet5D2, + BatchToSpaceCPULayerTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_DynamicBatchToSpaceCPULayerTestCase2_5D, BatchToSpaceCPULayerTest, - dynamicBatchToSpaceParamsSet5D2, BatchToSpaceCPULayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_DynamicBatchToSpaceCPULayerTestCase2_5D, + BatchToSpaceCPULayerTest, + dynamicBatchToSpaceParamsSet5D2, + BatchToSpaceCPULayerTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_DynamicBatchToSpaceCPULayerTestCaseWithBlocked2_5D, BatchToSpaceCPULayerTest, - dynamicBatchToSpaceParamsWithBlockedSet5D2, BatchToSpaceCPULayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_DynamicBatchToSpaceCPULayerTestCaseWithBlocked2_5D, + BatchToSpaceCPULayerTest, + dynamicBatchToSpaceParamsWithBlockedSet5D2, + BatchToSpaceCPULayerTest::getTestCaseName); } // namespace -} // namespace CPULayerTestsDefinitions +} // namespace test +} // namespace ov diff --git a/src/plugins/intel_cpu/tests/functional/single_layer_tests/broadcast.cpp b/src/plugins/intel_cpu/tests/functional/single_layer_tests/broadcast.cpp index cd5f2bae07f..62df3e54608 100644 --- a/src/plugins/intel_cpu/tests/functional/single_layer_tests/broadcast.cpp +++ b/src/plugins/intel_cpu/tests/functional/single_layer_tests/broadcast.cpp @@ -2,30 +2,30 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "test_utils/cpu_test_utils.hpp" +#include + #include "ov_models/builders.hpp" #include "shared_test_classes/base/ov_subgraph.hpp" -#include +#include "test_utils/cpu_test_utils.hpp" using namespace CPUTestUtils; -namespace CPULayerTestsDefinitions { +namespace ov { +namespace test { -using BroadcastLayerTestParamsSet = typename std::tuple< - std::vector, // Shapes - std::vector, // Target shapes - std::vector, // Axes mapping - ov::op::BroadcastType, // Broadcast mode - ov::element::Type_t, // Network precision - std::vector, // Const inputs - std::string>; // Device name +using BroadcastLayerTestParamsSet = typename std::tuple, // Shapes + std::vector, // Target shapes + std::vector, // Axes mapping + ov::op::BroadcastType, // Broadcast mode + ov::element::Type_t, // Network precision + std::vector, // Const inputs + std::string>; // Device name -using BroadcastLayerCPUTestParamsSet = typename std::tuple< - BroadcastLayerTestParamsSet, - CPUSpecificParams>; +using BroadcastLayerCPUTestParamsSet = typename std::tuple; class BroadcastLayerCPUTest : public testing::WithParamInterface, - virtual public ov::test::SubgraphBaseTest, public CPUTestsBase { + virtual public ov::test::SubgraphBaseTest, + public CPUTestsBase { public: static std::string getTestCaseName(testing::TestParamInfo obj) { BroadcastLayerTestParamsSet basicParamsSet; @@ -38,7 +38,8 @@ public: ov::element::Type_t netPrecision; std::vector isConstInputs; std::string deviceName; - std::tie(inputShapes, targetShapes, axesMapping, mode, netPrecision, isConstInputs, deviceName) = basicParamsSet; + std::tie(inputShapes, targetShapes, axesMapping, mode, netPrecision, isConstInputs, deviceName) = + basicParamsSet; std::ostringstream result; result << "IS=("; @@ -51,11 +52,12 @@ public: result << ov::test::utils::vec2str(item) << "_"; } } - result << "targetShape=" << ov::test::utils::vec2str(targetShapes) << "_"; - result << "axesMapping=" << ov::test::utils::vec2str(axesMapping) << "_"; + result << "targetShape=" << ov::test::utils::vec2str(targetShapes) << "_"; + result << "axesMapping=" << ov::test::utils::vec2str(axesMapping) << "_"; result << "mode=" << mode << "_"; result << "netPrec=" << netPrecision << "_"; - result << "constIn=(" << (isConstInputs[0] ? "True" : "False") << "." << (isConstInputs[1] ? "True" : "False") << ")_"; + result << "constIn=(" << (isConstInputs[0] ? "True" : "False") << "." << (isConstInputs[1] ? "True" : "False") + << ")_"; result << "trgDev=" << deviceName; result << CPUTestsBase::getTestCaseName(cpuParams); @@ -73,22 +75,23 @@ protected: ov::op::BroadcastType mode; ov::element::Type_t netPrecision; std::vector isConstInput; - std::tie(inputShapes, targetShape, axesMapping, mode, netPrecision, isConstInput, targetDevice) = basicParamsSet; + std::tie(inputShapes, targetShape, axesMapping, mode, netPrecision, isConstInput, targetDevice) = + basicParamsSet; bool isTargetShapeConst = isConstInput[0], isAxesMapConst = isConstInput[1]; const auto targetShapeRank = targetShape.size(); const auto axesMappingRank = axesMapping.size(); std::tie(inFmts, outFmts, priority, selectedType) = cpuParams; - selectedType += std::string("_") + InferenceEngine::details::convertPrecision(netPrecision).name(); + selectedType += std::string("_") + ov::element::Type(netPrecision).get_type_name(); if (inputShapes.front().first.rank() != 0) { inputDynamicShapes.push_back(inputShapes.front().first); if (!isTargetShapeConst) { - inputDynamicShapes.push_back({ static_cast(targetShape.size()) }); + inputDynamicShapes.push_back({static_cast(targetShape.size())}); } if (!isAxesMapConst) { - inputDynamicShapes.push_back({ static_cast(axesMapping.size()) }); + inputDynamicShapes.push_back({static_cast(axesMapping.size())}); } } const size_t targetStaticShapeSize = inputShapes.front().second.size(); @@ -96,22 +99,25 @@ protected: for (size_t i = 0lu; i < targetStaticShapeSize; ++i) { targetStaticShapes[i].push_back(inputShapes.front().second[i]); if (!isTargetShapeConst) - targetStaticShapes[i].push_back({ targetShape.size() }); + targetStaticShapes[i].push_back({targetShape.size()}); if (!isAxesMapConst) - targetStaticShapes[i].push_back({ axesMapping.size() }); + targetStaticShapes[i].push_back({axesMapping.size()}); } ov::ParameterVector functionParams; if (inputDynamicShapes.empty()) { - functionParams.push_back(std::make_shared(netPrecision, targetStaticShapes.front().front())); + functionParams.push_back( + std::make_shared(netPrecision, targetStaticShapes.front().front())); } else { functionParams.push_back(std::make_shared(netPrecision, inputDynamicShapes.front())); if (!isTargetShapeConst) { - functionParams.push_back(std::make_shared(ov::element::i64, inputDynamicShapes[1])); + functionParams.push_back( + std::make_shared(ov::element::i64, inputDynamicShapes[1])); functionParams.back()->set_friendly_name("targetShape"); } if (!isAxesMapConst) { - functionParams.push_back(std::make_shared(ov::element::i64, inputDynamicShapes.back())); + functionParams.push_back( + std::make_shared(ov::element::i64, inputDynamicShapes.back())); functionParams.back()->set_friendly_name("axesMapping"); } } @@ -131,27 +137,21 @@ protected: } else { axesMappingOp = functionParams.size() > 2 ? functionParams[2] : functionParams[1]; } - broadcastOp = std::make_shared(functionParams[0], - targetShapeOp, - axesMappingOp, - mode); + broadcastOp = + std::make_shared(functionParams[0], targetShapeOp, axesMappingOp, mode); } else if (mode == ov::op::BroadcastType::NUMPY) { if (isTargetShapeConst) { auto targetShapeConst = ov::op::v0::Constant::create(ov::element::i64, {targetShapeRank}, targetShape); - broadcastOp = std::make_shared(functionParams[0], - targetShapeConst, - mode); + broadcastOp = std::make_shared(functionParams[0], targetShapeConst, mode); } else { - broadcastOp = std::make_shared(functionParams[0], - functionParams[1], - mode); + broadcastOp = std::make_shared(functionParams[0], functionParams[1], mode); } } function = makeNgraphFunction(netPrecision, functionParams, broadcastOp, "Broadcast"); } - void generate_inputs(const std::vector& targetInputStaticShapes) override { + void generate_inputs(const std::vector& targetInputStaticShapes) override { inputs.clear(); const auto& funcInputs = function->inputs(); for (size_t i = 0lu; i < funcInputs.size(); i++) { @@ -171,10 +171,14 @@ protected: } } else { if (funcInput.get_element_type().is_real()) { - tensor = ov::test::utils::create_and_fill_tensor( - funcInput.get_element_type(), targetInputStaticShapes[i], 10, 0, 1000); + tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), + targetInputStaticShapes[i], + 10, + 0, + 1000); } else { - tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), targetInputStaticShapes[i]); + tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), + targetInputStaticShapes[i]); } } inputs.insert({funcInput.get_node_shared_ptr(), tensor}); @@ -192,277 +196,225 @@ TEST_P(BroadcastLayerCPUTest, CompareWithRefs) { namespace { /* CPU PARAMS */ -const auto cpuParams_nChw16c = CPUSpecificParams {{nChw16c}, {nChw16c}, {}, "ref"}; -const auto cpuParams_nCdhw16c = CPUSpecificParams {{nCdhw16c}, {nCdhw16c}, {}, "ref"}; +const auto cpuParams_nChw16c = CPUSpecificParams{{nChw16c}, {nChw16c}, {}, "ref"}; +const auto cpuParams_nCdhw16c = CPUSpecificParams{{nCdhw16c}, {nCdhw16c}, {}, "ref"}; -const auto cpuParams_nChw8c = CPUSpecificParams {{nChw8c}, {nChw8c}, {}, "ref"}; -const auto cpuParams_nCdhw8c = CPUSpecificParams {{nCdhw8c}, {nCdhw8c}, {}, "ref"}; +const auto cpuParams_nChw8c = CPUSpecificParams{{nChw8c}, {nChw8c}, {}, "ref"}; +const auto cpuParams_nCdhw8c = CPUSpecificParams{{nCdhw8c}, {nCdhw8c}, {}, "ref"}; -const auto cpuParams_nhwc = CPUSpecificParams {{nhwc}, {nhwc}, {}, "ref"}; -const auto cpuParams_ndhwc = CPUSpecificParams {{ndhwc}, {ndhwc}, {}, "ref"}; +const auto cpuParams_nhwc = CPUSpecificParams{{nhwc}, {nhwc}, {}, "ref"}; +const auto cpuParams_ndhwc = CPUSpecificParams{{ndhwc}, {ndhwc}, {}, "ref"}; /* ========== */ /* COMMON PARAMS */ -const std::vector inputPrecisions = { - ov::element::f32, - ov::element::bf16, - ov::element::i32, - ov::element::i8 -}; +const std::vector inputPrecisions = {ov::element::f32, + ov::element::bf16, + ov::element::i32, + ov::element::i8}; /* ============= */ /* INSTANCES */ // 4D -const std::vector CPUParams4D = { - cpuParams_nChw16c, - cpuParams_nChw8c, - cpuParams_nhwc -}; +const std::vector CPUParams4D = {cpuParams_nChw16c, cpuParams_nChw8c, cpuParams_nhwc}; -const std::vector> staticInputShapes4D = { - { - {{}, - { // Static shapes - {1, 16, 1, 1} - } - } - }, - { - {{}, - { // Static shapes - {50, 50} - } - } - } -}; +const std::vector> staticInputShapes4D = {{{{}, + {// Static shapes + {1, 16, 1, 1}}}}, + {{{}, + {// Static shapes + {50, 50}}}}}; -INSTANTIATE_TEST_CASE_P(smoke_StaticShape4D, BroadcastLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - ::testing::Values(staticInputShapes4D[0]), - ::testing::ValuesIn(std::vector>{{1, 16, 3, 3}, {1, 16, 1, 3}}), - ::testing::Values(std::vector{}), - ::testing::Values(ov::op::BroadcastType::NUMPY), - ::testing::ValuesIn(inputPrecisions), - ::testing::Values(std::vector{true, true}), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::ValuesIn(CPUParams4D)), - BroadcastLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_CASE_P(smoke_StaticShape4D, + BroadcastLayerCPUTest, + ::testing::Combine(::testing::Combine(::testing::Values(staticInputShapes4D[0]), + ::testing::ValuesIn(std::vector>{ + {1, 16, 3, 3}, + {1, 16, 1, 3}}), + ::testing::Values(std::vector{}), + ::testing::Values(ov::op::BroadcastType::NUMPY), + ::testing::ValuesIn(inputPrecisions), + ::testing::Values(std::vector{true, true}), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::ValuesIn(CPUParams4D)), + BroadcastLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_CASE_P(smoke_StaticShape4DE, BroadcastLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - ::testing::Values(staticInputShapes4D[1]), - ::testing::Values(std::vector{1, 50, 50, 16}), - ::testing::Values(std::vector{1, 2}), - ::testing::Values(ov::op::BroadcastType::EXPLICIT), - ::testing::ValuesIn(inputPrecisions), - ::testing::Values(std::vector{true, true}), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), - BroadcastLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_CASE_P(smoke_StaticShape4DE, + BroadcastLayerCPUTest, + ::testing::Combine(::testing::Combine(::testing::Values(staticInputShapes4D[1]), + ::testing::Values(std::vector{1, 50, 50, 16}), + ::testing::Values(std::vector{1, 2}), + ::testing::Values(ov::op::BroadcastType::EXPLICIT), + ::testing::ValuesIn(inputPrecisions), + ::testing::Values(std::vector{true, true}), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), + BroadcastLayerCPUTest::getTestCaseName); -const std::vector> staticInputShapesScalar = { - { - {{}, - { // Static shapes - {1} - } - } - } -}; +const std::vector> staticInputShapesScalar = {{{{}, + {// Static shapes + {1}}}}}; -INSTANTIATE_TEST_CASE_P(smoke_StaticShape4DScalar, BroadcastLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - ::testing::ValuesIn(staticInputShapesScalar), - ::testing::Values(std::vector{1, 16, 3, 3}), - ::testing::Values(std::vector{}), - ::testing::Values(ov::op::BroadcastType::NUMPY), - ::testing::ValuesIn(inputPrecisions), - ::testing::Values(std::vector{true, true}), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), - BroadcastLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_CASE_P(smoke_StaticShape4DScalar, + BroadcastLayerCPUTest, + ::testing::Combine(::testing::Combine(::testing::ValuesIn(staticInputShapesScalar), + ::testing::Values(std::vector{1, 16, 3, 3}), + ::testing::Values(std::vector{}), + ::testing::Values(ov::op::BroadcastType::NUMPY), + ::testing::ValuesIn(inputPrecisions), + ::testing::Values(std::vector{true, true}), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), + BroadcastLayerCPUTest::getTestCaseName); const std::vector> dynamicInputShapes4D = { { - { // Origin dynamic shapes - {ov::Dimension(1, 20), ov::Dimension(1, 20), ov::Dimension(1, 20), ov::Dimension(1, 20)}, - { // Dynamic shapes instances - {1, 16, 1, 1}, - {8, 1, 1, 7}, - {1, 1, 1, 7} - } - }, + {// Origin dynamic shapes + {ov::Dimension(1, 20), ov::Dimension(1, 20), ov::Dimension(1, 20), ov::Dimension(1, 20)}, + {// Dynamic shapes instances + {1, 16, 1, 1}, + {8, 1, 1, 7}, + {1, 1, 1, 7}}}, }, - { - { // Origin dynamic shapes - {-1, -1, -1, -1}, - { // Dynamic shapes instances - {{1, 16, 1, 1}}, - {{8, 1, 1, 1}} - } - } - } -}; + {{// Origin dynamic shapes + {-1, -1, -1, -1}, + {// Dynamic shapes instances + {{1, 16, 1, 1}}, + {{8, 1, 1, 1}}}}}}; -INSTANTIATE_TEST_CASE_P(smoke_DynamicShape4D, BroadcastLayerCPUTest, - ::testing::Combine(::testing::Combine( - ::testing::ValuesIn(dynamicInputShapes4D), - ::testing::ValuesIn(std::vector>{{8, 16, 1, 7}, {8, 16, 10, 7}}), - ::testing::Values(std::vector{}), - ::testing::Values(ov::op::BroadcastType::NUMPY), - ::testing::ValuesIn(inputPrecisions), - ::testing::ValuesIn(std::vector>{{true, true}, {false, true}}), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), - BroadcastLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_CASE_P( + smoke_DynamicShape4D, + BroadcastLayerCPUTest, + ::testing::Combine( + ::testing::Combine(::testing::ValuesIn(dynamicInputShapes4D), + ::testing::ValuesIn(std::vector>{{8, 16, 1, 7}, {8, 16, 10, 7}}), + ::testing::Values(std::vector{}), + ::testing::Values(ov::op::BroadcastType::NUMPY), + ::testing::ValuesIn(inputPrecisions), + ::testing::ValuesIn(std::vector>{{true, true}, {false, true}}), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), + BroadcastLayerCPUTest::getTestCaseName); -const std::vector> dynamicInputShapesScalar = { - { - { // Origin dynamic shapes - {-1}, - { // Dynamic shapes instances - {1}, - {7} - } - } - } -}; +const std::vector> dynamicInputShapesScalar = {{{// Origin dynamic shapes + {-1}, + {// Dynamic shapes instances + {1}, + {7}}}}}; -INSTANTIATE_TEST_CASE_P(smoke_DynamicShape4DScalar, BroadcastLayerCPUTest, - ::testing::Combine(::testing::Combine( - ::testing::ValuesIn(dynamicInputShapesScalar), - ::testing::Values(std::vector{8, 16, 1, 7}), - ::testing::Values(std::vector{}), - ::testing::Values(ov::op::BroadcastType::NUMPY), - ::testing::ValuesIn(inputPrecisions), - ::testing::ValuesIn(std::vector>{{true, true}, {false, true}}), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), - BroadcastLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_CASE_P(smoke_DynamicShape4DScalar, + BroadcastLayerCPUTest, + ::testing::Combine(::testing::Combine(::testing::ValuesIn(dynamicInputShapesScalar), + ::testing::Values(std::vector{8, 16, 1, 7}), + ::testing::Values(std::vector{}), + ::testing::Values(ov::op::BroadcastType::NUMPY), + ::testing::ValuesIn(inputPrecisions), + ::testing::ValuesIn(std::vector>{ + {true, true}, + {false, true}}), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), + BroadcastLayerCPUTest::getTestCaseName); // 5D -const std::vector> staticInputShapes5D = { - { - {{}, - { // Static shapes - {1, 16, 1, 1, 1} - } - } - } -}; +const std::vector> staticInputShapes5D = {{{{}, + {// Static shapes + {1, 16, 1, 1, 1}}}}}; const std::vector> dynamicInputShapes5D = { - { - { // Origin dynamic shapes - {ov::Dimension(1, 20), ov::Dimension(1, 20), ov::Dimension(1, 20), ov::Dimension(1, 20), ov::Dimension(1, 20)}, - { // Dynamic shapes instances - {1, 16, 1, 1, 1}, - {8, 1, 1, 7, 1}, - {8, 1, 1, 1, 1} - } - } - }, - { - { // Origin dynamic shapes - {-1, -1, -1, -1, -1}, - { // Dynamic shapes instances - {1, 16, 1, 1, 1}, - {8, 16, 1, 7, 1} - } - } - } -}; -std::vector> targetShapes5D { - {8, 16, 1, 7, 1}, - {8, 16, 10, 7, 4} -}; + {{// Origin dynamic shapes + {ov::Dimension(1, 20), ov::Dimension(1, 20), ov::Dimension(1, 20), ov::Dimension(1, 20), ov::Dimension(1, 20)}, + {// Dynamic shapes instances + {1, 16, 1, 1, 1}, + {8, 1, 1, 7, 1}, + {8, 1, 1, 1, 1}}}}, + {{// Origin dynamic shapes + {-1, -1, -1, -1, -1}, + {// Dynamic shapes instances + {1, 16, 1, 1, 1}, + {8, 16, 1, 7, 1}}}}}; +std::vector> targetShapes5D{{8, 16, 1, 7, 1}, {8, 16, 10, 7, 4}}; const std::vector CPUParams5D = { - cpuParams_nCdhw16c, - cpuParams_nCdhw8c, - cpuParams_ndhwc, + cpuParams_nCdhw16c, + cpuParams_nCdhw8c, + cpuParams_ndhwc, }; -INSTANTIATE_TEST_CASE_P(smoke_StaticShape5D, BroadcastLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - ::testing::ValuesIn(staticInputShapes5D), - ::testing::ValuesIn(std::vector>{{1, 16, 1, 1, 3}, {1, 16, 3, 1, 3}}), - ::testing::Values(std::vector{}), - ::testing::Values(ov::op::BroadcastType::NUMPY), - ::testing::ValuesIn(inputPrecisions), - ::testing::Values(std::vector{true, true}), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::ValuesIn(CPUParams5D)), - BroadcastLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_CASE_P(smoke_StaticShape5D, + BroadcastLayerCPUTest, + ::testing::Combine(::testing::Combine(::testing::ValuesIn(staticInputShapes5D), + ::testing::ValuesIn(std::vector>{ + {1, 16, 1, 1, 3}, + {1, 16, 3, 1, 3}}), + ::testing::Values(std::vector{}), + ::testing::Values(ov::op::BroadcastType::NUMPY), + ::testing::ValuesIn(inputPrecisions), + ::testing::Values(std::vector{true, true}), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::ValuesIn(CPUParams5D)), + BroadcastLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_CASE_P(smoke_StaticShape5DScalar, BroadcastLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - ::testing::ValuesIn(staticInputShapesScalar), - ::testing::Values(std::vector{1, 16, 3, 1, 3}), - ::testing::Values(std::vector{}), - ::testing::Values(ov::op::BroadcastType::NUMPY), - ::testing::ValuesIn(inputPrecisions), - ::testing::Values(std::vector{true, true}), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), - BroadcastLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_CASE_P(smoke_StaticShape5DScalar, + BroadcastLayerCPUTest, + ::testing::Combine(::testing::Combine(::testing::ValuesIn(staticInputShapesScalar), + ::testing::Values(std::vector{1, 16, 3, 1, 3}), + ::testing::Values(std::vector{}), + ::testing::Values(ov::op::BroadcastType::NUMPY), + ::testing::ValuesIn(inputPrecisions), + ::testing::Values(std::vector{true, true}), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), + BroadcastLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_CASE_P(smoke_DynamicShape5D, BroadcastLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - ::testing::ValuesIn(dynamicInputShapes5D), - ::testing::ValuesIn(targetShapes5D), - ::testing::Values(std::vector{}), - ::testing::Values(ov::op::BroadcastType::NUMPY), - ::testing::ValuesIn(inputPrecisions), - ::testing::ValuesIn(std::vector>{{true, true}, {false, true}}), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), - BroadcastLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_CASE_P(smoke_DynamicShape5D, + BroadcastLayerCPUTest, + ::testing::Combine(::testing::Combine(::testing::ValuesIn(dynamicInputShapes5D), + ::testing::ValuesIn(targetShapes5D), + ::testing::Values(std::vector{}), + ::testing::Values(ov::op::BroadcastType::NUMPY), + ::testing::ValuesIn(inputPrecisions), + ::testing::ValuesIn(std::vector>{ + {true, true}, + {false, true}}), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), + BroadcastLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_CASE_P(smoke_DynamicShape5DScalar, BroadcastLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - ::testing::ValuesIn(dynamicInputShapesScalar), - ::testing::Values(std::vector{8, 16, 1, 1, 7}), - ::testing::Values(std::vector{}), - ::testing::Values(ov::op::BroadcastType::NUMPY), - ::testing::ValuesIn(inputPrecisions), - ::testing::ValuesIn(std::vector>{{true, true}, {false, true}}), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), - BroadcastLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_CASE_P(smoke_DynamicShape5DScalar, + BroadcastLayerCPUTest, + ::testing::Combine(::testing::Combine(::testing::ValuesIn(dynamicInputShapesScalar), + ::testing::Values(std::vector{8, 16, 1, 1, 7}), + ::testing::Values(std::vector{}), + ::testing::Values(ov::op::BroadcastType::NUMPY), + ::testing::ValuesIn(inputPrecisions), + ::testing::ValuesIn(std::vector>{ + {true, true}, + {false, true}}), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), + BroadcastLayerCPUTest::getTestCaseName); // 1D -const std::vector> dynamicShapes1D = { - { - { // Origin dynamic shapes - {-1}, - { // Dynamic shapes instances - {1}, - {1} - } - } - } -}; +const std::vector> dynamicShapes1D = {{{// Origin dynamic shapes + {-1}, + {// Dynamic shapes instances + {1}, + {1}}}}}; -INSTANTIATE_TEST_CASE_P(smoke_DynamicShapes1D, BroadcastLayerCPUTest, - ::testing::Combine(::testing::Combine( - ::testing::ValuesIn(dynamicShapes1D), - ::testing::Values(std::vector{0}), - ::testing::Values(std::vector{}), - ::testing::Values(ov::op::BroadcastType::NUMPY), - ::testing::ValuesIn(inputPrecisions), - ::testing::ValuesIn(std::vector>{{false, true}}), - ::testing::Values(ov::test::utils::DEVICE_CPU)), - ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), - BroadcastLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_CASE_P(smoke_DynamicShapes1D, + BroadcastLayerCPUTest, + ::testing::Combine(::testing::Combine(::testing::ValuesIn(dynamicShapes1D), + ::testing::Values(std::vector{0}), + ::testing::Values(std::vector{}), + ::testing::Values(ov::op::BroadcastType::NUMPY), + ::testing::ValuesIn(inputPrecisions), + ::testing::ValuesIn(std::vector>{ + {false, true}}), + ::testing::Values(ov::test::utils::DEVICE_CPU)), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), + BroadcastLayerCPUTest::getTestCaseName); /* ========= */ -} // namespace +} // namespace -} // namespace CPULayerTestsDefinitions +} // namespace test +} // namespace ov diff --git a/src/plugins/intel_cpu/tests/functional/single_layer_tests/bucketize.cpp b/src/plugins/intel_cpu/tests/functional/single_layer_tests/bucketize.cpp index 6c345226e4f..2e2cf824bd5 100644 --- a/src/plugins/intel_cpu/tests/functional/single_layer_tests/bucketize.cpp +++ b/src/plugins/intel_cpu/tests/functional/single_layer_tests/bucketize.cpp @@ -3,16 +3,14 @@ // #include -#include "ov_models/builders.hpp" + #include "shared_test_classes/base/ov_subgraph.hpp" #include "test_utils/cpu_test_utils.hpp" -using namespace InferenceEngine; using namespace CPUTestUtils; -using namespace ngraph::opset3; -using namespace ov::test; -namespace CPULayerTestsDefinitions { +namespace ov { +namespace test { using BucketizeCPUParamsTuple = std::tuple& targetInputStaticShapes) override { + void generate_inputs(const std::vector& targetInputStaticShapes) override { inputs.clear(); const auto& funcInputs = function->inputs(); auto data_size = shape_size(targetInputStaticShapes[0]); ov::Tensor tensorData = ov::test::utils::create_and_fill_tensor(funcInputs[0].get_element_type(), - targetInputStaticShapes[0], - data_size * 5, - 0, - 10, - 7235346); + targetInputStaticShapes[0], + data_size * 5, + 0, + 10, + 7235346); ov::Tensor tensorBucket = ov::test::utils::create_and_fill_tensor_unique_sequence(funcInputs[1].get_element_type(), @@ -91,14 +89,14 @@ protected: std::tie(dataShape, bucketsShape, with_right_bound, inDataPrc, inBucketsPrc, netPrc) = this->GetParam(); init_input_shapes({dataShape, bucketsShape}); - auto data = std::make_shared(inDataPrc, inputDynamicShapes[0]); + auto data = std::make_shared(inDataPrc, inputDynamicShapes[0]); data->set_friendly_name("a_data"); - auto buckets = std::make_shared(inBucketsPrc, inputDynamicShapes[1]); + auto buckets = std::make_shared(inBucketsPrc, inputDynamicShapes[1]); buckets->set_friendly_name("b_buckets"); - auto bucketize = std::make_shared(data, buckets, netPrc, with_right_bound); - function = std::make_shared(std::make_shared(bucketize), - ngraph::ParameterVector{data, buckets}, - "Bucketize"); + auto bucketize = std::make_shared(data, buckets, netPrc, with_right_bound); + function = std::make_shared(std::make_shared(bucketize), + ov::ParameterVector{data, buckets}, + "Bucketize"); } }; @@ -109,11 +107,11 @@ TEST_P(BucketizeLayerCPUTest, CompareWithRefs) { namespace { const std::vector dataShapesDynamic = { - {{ngraph::Dimension(1, 10), ngraph::Dimension::dynamic(), ngraph::Dimension::dynamic()}, + {{ov::Dimension(1, 10), ov::Dimension::dynamic(), ov::Dimension::dynamic()}, {{1, 20, 20}, {3, 16, 16}, {10, 16, 16}}}, - {{ngraph::Dimension(1, 10), 3, 50, 50}, {{1, 3, 50, 50}, {2, 3, 50, 50}, {10, 3, 50, 50}}}}; + {{ov::Dimension(1, 10), 3, 50, 50}, {{1, 3, 50, 50}, {2, 3, 50, 50}, {10, 3, 50, 50}}}}; -const std::vector bucketsShapesDynamic = {{{ngraph::Dimension::dynamic()}, {{5}, {20}, {100}}}}; +const std::vector bucketsShapesDynamic = {{{ov::Dimension::dynamic()}, {{5}, {20}, {100}}}}; const std::vector inPrc = {ov::element::f32, ov::element::i64, ov::element::i32}; const std::vector outPrc = {ov::element::i64, ov::element::i32}; @@ -142,4 +140,5 @@ INSTANTIATE_TEST_SUITE_P(smoke_TestsBucketize_left_Dynamic, BucketizeLayerCPUTest::getTestCaseName); } // namespace -} // namespace CPULayerTestsDefinitions +} // namespace test +} // namespace ov diff --git a/src/plugins/intel_cpu/tests/functional/single_layer_tests/concat.cpp b/src/plugins/intel_cpu/tests/functional/single_layer_tests/concat.cpp index e805d802abe..0a71bfe87ea 100644 --- a/src/plugins/intel_cpu/tests/functional/single_layer_tests/concat.cpp +++ b/src/plugins/intel_cpu/tests/functional/single_layer_tests/concat.cpp @@ -2,24 +2,24 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "shared_test_classes/base/ov_subgraph.hpp" #include "ov_models/builders.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" #include "test_utils/cpu_test_utils.hpp" -using namespace ov::test; using namespace CPUTestUtils; -namespace CPULayerTestsDefinitions { +namespace ov { +namespace test { -typedef std::tuple< - size_t, // Concat axis - std::vector, // Input shapes - ElementType, // Network precision - CPUSpecificParams -> concatCPUTestParams; +typedef std::tuple, // Input shapes + ElementType, // Network precision + CPUSpecificParams> + concatCPUTestParams; class ConcatLayerCPUTest : public testing::WithParamInterface, - virtual public SubgraphBaseTest, public CPUTestsBase { + virtual public SubgraphBaseTest, + public CPUTestsBase { public: static std::string getTestCaseName(testing::TestParamInfo obj) { int axis; @@ -49,7 +49,7 @@ public: return result.str(); } - void compare(const std::vector &expected, const std::vector &actual) override { + void compare(const std::vector& expected, const std::vector& actual) override { if (actual.front().get_size() == 0) { ASSERT_EQ(0, expected.front().get_size()); for (const auto& shape : targetStaticShapes[inferNum]) { @@ -74,7 +74,7 @@ protected: std::tie(axis, inputShape, netPrecision, cpuParams) = this->GetParam(); std::tie(inFmts, outFmts, priority, selectedType) = cpuParams; - selectedType += std::string("_") + InferenceEngine::details::convertPrecision(netPrecision).name(); + selectedType += std::string("_") + ov::element::Type(netPrecision).get_type_name(); init_input_shapes(inputShape); @@ -85,7 +85,7 @@ protected: params.push_back(param); paramsOuts.push_back(param); } - auto concat = std::make_shared(paramsOuts, axis); + auto concat = std::make_shared(paramsOuts, axis); function = makeNgraphFunction(netPrecision, params, concat, "ConcatCPU"); } @@ -119,615 +119,699 @@ const auto blocked16_4D_ref = CPUSpecificParams{{nChw16c}, {nChw16c}, {}, "ref"} const auto blocked16_5D_ref = CPUSpecificParams{{nCdhw16c}, {nCdhw16c}, {}, "ref"}; // List of precisions natively supported by onednn. -const std::vector netPrecisions = { - ElementType::i8, - ElementType::i32, - ElementType::f32, - ElementType::bf16 -}; +const std::vector netPrecisions = {ElementType::i8, ElementType::i32, ElementType::f32, ElementType::bf16}; -INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_Block8_static, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(1, -2, 3), - ::testing::Values(static_shapes_to_test_representation({{2, 16, 3, 5}, {2, 16, 3, 5}})), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(planar_4D_ref, planarChannels_4D, blocked8_4D_ref)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_Block8_static, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(1, -2, 3), + ::testing::Values(static_shapes_to_test_representation({{2, 16, 3, 5}, + {2, 16, 3, 5}})), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(planar_4D_ref, planarChannels_4D, blocked8_4D_ref)), + ConcatLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_Block16_static, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(1, 2, -1), - ::testing::Values(static_shapes_to_test_representation({{3, 32, 3, 5}, {3, 32, 3, 5}})), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(blocked16_4D_ref)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_Block16_static, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(1, 2, -1), + ::testing::Values(static_shapes_to_test_representation({{3, 32, 3, 5}, + {3, 32, 3, 5}})), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(blocked16_4D_ref)), + ConcatLayerCPUTest::getTestCaseName); const std::vector> inputShapes4D_Block_axis1 = { - { - // {{dynamic shape}, {{static shape case1}, {static shape case2}, ...} - {{-1, 32, -1, -1}, {{2, 32, 5, 7}, {1, 32, 10, 2}, {3, 32, 1, 8}}}, // input 0 - {{-1, 16, -1, -1}, {{2, 16, 5, 7}, {1, 16, 10, 2}, {3, 16, 1, 8}}}, // input 1 - {{-1, 64, -1, -1}, {{2, 64, 5, 7}, {1, 64, 10, 2}, {3, 64, 1, 8}}} // input 2 - }, - { - {{{1, 5}, 32, {1, 10}, {2, 8}}, {{2, 32, 5, 7}, {1, 32, 10, 2}, {3, 32, 1, 8}}}, - {{{1, 3}, 16, {1, 10}, {2, 8}}, {{2, 16, 5, 7}, {1, 16, 10, 2}, {3, 16, 1, 8}}}, - {{{1, 3}, 64, {1, 10}, {2, 8}}, {{2, 64, 5, 7}, {1, 64, 10, 2}, {3, 64, 1, 8}}} - }, - { - {{{1, 10}, 32, 2, 3}, {{2, 32, 2, 3}, {1, 32, 2, 3}}}, - {{{1, 10}, 16, 2, 3}, {{2, 16, 2, 3}, {1, 16, 2, 3}}}, - {{{1, 10}, 64, 2, 3}, {{2, 64, 2, 3}, {1, 64, 2, 3}}} - }, + { + // {{dynamic shape}, {{static shape case1}, {static shape case2}, ...} + {{-1, 32, -1, -1}, {{2, 32, 5, 7}, {1, 32, 10, 2}, {3, 32, 1, 8}}}, // input 0 + {{-1, 16, -1, -1}, {{2, 16, 5, 7}, {1, 16, 10, 2}, {3, 16, 1, 8}}}, // input 1 + {{-1, 64, -1, -1}, {{2, 64, 5, 7}, {1, 64, 10, 2}, {3, 64, 1, 8}}} // input 2 + }, + {{{{1, 5}, 32, {1, 10}, {2, 8}}, {{2, 32, 5, 7}, {1, 32, 10, 2}, {3, 32, 1, 8}}}, + {{{1, 3}, 16, {1, 10}, {2, 8}}, {{2, 16, 5, 7}, {1, 16, 10, 2}, {3, 16, 1, 8}}}, + {{{1, 3}, 64, {1, 10}, {2, 8}}, {{2, 64, 5, 7}, {1, 64, 10, 2}, {3, 64, 1, 8}}}}, + {{{{1, 10}, 32, 2, 3}, {{2, 32, 2, 3}, {1, 32, 2, 3}}}, + {{{1, 10}, 16, 2, 3}, {{2, 16, 2, 3}, {1, 16, 2, 3}}}, + {{{1, 10}, 64, 2, 3}, {{2, 64, 2, 3}, {1, 64, 2, 3}}}}, }; -INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_Block_dynamic_axis_1, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(1, -3), - ::testing::ValuesIn(inputShapes4D_Block_axis1), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(blocked8_4D_ref, blocked16_4D_ref)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_Block_dynamic_axis_1, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(1, -3), + ::testing::ValuesIn(inputShapes4D_Block_axis1), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(blocked8_4D_ref, blocked16_4D_ref)), + ConcatLayerCPUTest::getTestCaseName); const std::vector> inputShapes4D_axis1 = { - { - {{-1, -1, -1, -1}, {{2, 32, 0, 7}, {2, 32, 5, 7}, {2, 32, 5, 7}, {1, 18, 10, 2}, {2, 32, 5, 7}, {3, 8, 1, 8}, {2, 0, 5, 7}}}, - {{-1, -1, -1, -1}, {{2, 16, 0, 7}, {2, 16, 5, 7}, {2, 16, 5, 7}, {1, 5, 10, 2}, {2, 0, 5, 7}, {3, 3, 1, 8}, {2, 16, 5, 7}}}, - {{-1, -1, -1, -1}, {{2, 64, 0, 7}, {2, 64, 5, 7}, {2, 0, 5, 7}, {1, 45, 10, 2}, {2, 64, 5, 7}, {3, 1, 1, 8}, {2, 64, 5, 7}}} - }, - { - {{{1, 3}, {8, 32}, {1, 10}, {2, 8}}, {{2, 32, 5, 7}, {1, 18, 10, 2}, {3, 8, 1, 8}}}, - {{{1, 3}, {3, 16}, {1, 10}, {2, 8}}, {{2, 16, 5, 7}, {1, 5, 10, 2}, {3, 3, 1, 8}}}, - {{{1, 3}, {1, 64}, {1, 10}, {2, 8}}, {{2, 64, 5, 7}, {1, 45, 10, 2}, {3, 1, 1, 8}}} - }, - { - {{{1, 18, 10, 2}}, {{1, 18, 10, 2}, {1, 18, 10, 2}}}, - {{-1, -1, -1, -1}, {{1, 3, 10, 2}, {1, 5, 10, 2}}}, - {{{1, 5, 10, 2}}, {{1, 5, 10, 2}, {1, 5, 10, 2}}} - }, - { - {{{-1, 8, -1, -1}}, {{2, 8, 5, 7}, {1, 8, 10, 2}}}, - {{{-1, 3, -1, -1}}, {{2, 3, 5, 7}, {1, 3, 10, 2}}}, - {{{-1, -1, -1, -1}}, {{2, 16, 5, 7}, {1, 7, 10, 2}}} - } -}; + {{{-1, -1, -1, -1}, + {{2, 32, 0, 7}, {2, 32, 5, 7}, {2, 32, 5, 7}, {1, 18, 10, 2}, {2, 32, 5, 7}, {3, 8, 1, 8}, {2, 0, 5, 7}}}, + {{-1, -1, -1, -1}, + {{2, 16, 0, 7}, {2, 16, 5, 7}, {2, 16, 5, 7}, {1, 5, 10, 2}, {2, 0, 5, 7}, {3, 3, 1, 8}, {2, 16, 5, 7}}}, + {{-1, -1, -1, -1}, + {{2, 64, 0, 7}, {2, 64, 5, 7}, {2, 0, 5, 7}, {1, 45, 10, 2}, {2, 64, 5, 7}, {3, 1, 1, 8}, {2, 64, 5, 7}}}}, + {{{{1, 3}, {8, 32}, {1, 10}, {2, 8}}, {{2, 32, 5, 7}, {1, 18, 10, 2}, {3, 8, 1, 8}}}, + {{{1, 3}, {3, 16}, {1, 10}, {2, 8}}, {{2, 16, 5, 7}, {1, 5, 10, 2}, {3, 3, 1, 8}}}, + {{{1, 3}, {1, 64}, {1, 10}, {2, 8}}, {{2, 64, 5, 7}, {1, 45, 10, 2}, {3, 1, 1, 8}}}}, + {{{{1, 18, 10, 2}}, {{1, 18, 10, 2}, {1, 18, 10, 2}}}, + {{-1, -1, -1, -1}, {{1, 3, 10, 2}, {1, 5, 10, 2}}}, + {{{1, 5, 10, 2}}, {{1, 5, 10, 2}, {1, 5, 10, 2}}}}, + {{{{-1, 8, -1, -1}}, {{2, 8, 5, 7}, {1, 8, 10, 2}}}, + {{{-1, 3, -1, -1}}, {{2, 3, 5, 7}, {1, 3, 10, 2}}}, + {{{-1, -1, -1, -1}}, {{2, 16, 5, 7}, {1, 7, 10, 2}}}}}; -INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_dynamic_axis_1, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(1), - ::testing::ValuesIn(inputShapes4D_axis1), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(planar_4D_ref, planarChannels_4D)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_dynamic_axis_1, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(1), + ::testing::ValuesIn(inputShapes4D_axis1), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(planar_4D_ref, planarChannels_4D)), + ConcatLayerCPUTest::getTestCaseName); const std::vector> inputShapes4D_Block_axis2 = { - { - {{-1, 16, -1, -1}, {{2, 16, 5, 7}, {1, 16, 16, 2}, {3, 16, 2, 8}}}, - {{-1, 16, -1, -1}, {{2, 16, 1, 7}, {1, 16, 3, 2}, {3, 16, 11, 8}}}, - {{-1, 16, -1, -1}, {{2, 16, 10, 7}, {1, 16, 5, 2}, {3, 16, 1, 8}}}, - }, - { - {{{1, 3}, 16, {2, 16}, {2, 8}}, {{2, 16, 5, 7}, {1, 16, 16, 2}, {3, 16, 2, 8}}}, - {{{1, 3}, 16, {1, 11}, {2, 8}}, {{2, 16, 1, 7}, {1, 16, 3, 2}, {3, 16, 11, 8}}}, - {{{1, 3}, 16, {1, 10}, {2, 8}}, {{2, 16, 10, 7}, {1, 16, 5, 2}, {3, 16, 1, 8}}}, - }, - { - {{{1, 5}, 16, 5, 7}, {{2, 16, 5, 7}, {1, 16, 5, 7}}}, - {{{1, 5}, 16, 1, 7}, {{2, 16, 1, 7}, {1, 16, 1, 7}}}, - {{{1, 5}, 16, 10, 7}, {{2, 16, 10, 7}, {1, 16, 10, 7}}}, - }, + { + {{-1, 16, -1, -1}, {{2, 16, 5, 7}, {1, 16, 16, 2}, {3, 16, 2, 8}}}, + {{-1, 16, -1, -1}, {{2, 16, 1, 7}, {1, 16, 3, 2}, {3, 16, 11, 8}}}, + {{-1, 16, -1, -1}, {{2, 16, 10, 7}, {1, 16, 5, 2}, {3, 16, 1, 8}}}, + }, + { + {{{1, 3}, 16, {2, 16}, {2, 8}}, {{2, 16, 5, 7}, {1, 16, 16, 2}, {3, 16, 2, 8}}}, + {{{1, 3}, 16, {1, 11}, {2, 8}}, {{2, 16, 1, 7}, {1, 16, 3, 2}, {3, 16, 11, 8}}}, + {{{1, 3}, 16, {1, 10}, {2, 8}}, {{2, 16, 10, 7}, {1, 16, 5, 2}, {3, 16, 1, 8}}}, + }, + { + {{{1, 5}, 16, 5, 7}, {{2, 16, 5, 7}, {1, 16, 5, 7}}}, + {{{1, 5}, 16, 1, 7}, {{2, 16, 1, 7}, {1, 16, 1, 7}}}, + {{{1, 5}, 16, 10, 7}, {{2, 16, 10, 7}, {1, 16, 10, 7}}}, + }, }; -INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_Block_dynamic_axis_2, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(2), - ::testing::ValuesIn(inputShapes4D_Block_axis2), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(blocked8_4D_ref, blocked16_4D_ref)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_Block_dynamic_axis_2, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(2), + ::testing::ValuesIn(inputShapes4D_Block_axis2), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(blocked8_4D_ref, blocked16_4D_ref)), + ConcatLayerCPUTest::getTestCaseName); const std::vector> inputShapes4D_axis2 = { - { - {{-1, -1, -1, -1}, {{2, 16, 5, 7}, {1, 16, 16, 2}, {3, 16, 2, 8}}}, - {{-1, -1, -1, -1}, {{2, 16, 1, 7}, {1, 16, 3, 2}, {3, 16, 11, 8}}}, - {{-1, -1, -1, -1}, {{2, 16, 10, 7}, {1, 16, 5, 2}, {3, 16, 1, 8}}}, - }, - { - {{{1, 3}, {1, 16}, {2, 16}, {2, 8}}, {{2, 16, 5, 7}, {1, 16, 16, 2}, {3, 16, 2, 8}}}, - {{{1, 3}, {1, 16}, {1, 11}, {2, 8}}, {{2, 16, 1, 7}, {1, 16, 3, 2}, {3, 16, 11, 8}}}, - {{{1, 3}, {1, 16}, {1, 10}, {2, 8}}, {{2, 16, 10, 7}, {1, 16, 5, 2}, {3, 16, 1, 8}}}, - }, + { + {{-1, -1, -1, -1}, {{2, 16, 5, 7}, {1, 16, 16, 2}, {3, 16, 2, 8}}}, + {{-1, -1, -1, -1}, {{2, 16, 1, 7}, {1, 16, 3, 2}, {3, 16, 11, 8}}}, + {{-1, -1, -1, -1}, {{2, 16, 10, 7}, {1, 16, 5, 2}, {3, 16, 1, 8}}}, + }, + { + {{{1, 3}, {1, 16}, {2, 16}, {2, 8}}, {{2, 16, 5, 7}, {1, 16, 16, 2}, {3, 16, 2, 8}}}, + {{{1, 3}, {1, 16}, {1, 11}, {2, 8}}, {{2, 16, 1, 7}, {1, 16, 3, 2}, {3, 16, 11, 8}}}, + {{{1, 3}, {1, 16}, {1, 10}, {2, 8}}, {{2, 16, 10, 7}, {1, 16, 5, 2}, {3, 16, 1, 8}}}, + }, }; -INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_dynamic_axis_2, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(2, -2), - ::testing::ValuesIn(inputShapes4D_axis2), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(planar_4D_ref, planarChannels_4D)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_dynamic_axis_2, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(2, -2), + ::testing::ValuesIn(inputShapes4D_axis2), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(planar_4D_ref, planarChannels_4D)), + ConcatLayerCPUTest::getTestCaseName); const std::vector> inputShapes4D_Block_axis3 = { - { - {{-1, 32, -1, -1}, {{2, 32, 4, 5}, {1, 32, 1, 16}, {3, 32, 7, 2}, }}, - {{-1, 32, -1, -1}, {{2, 32, 4, 1}, {1, 32, 1, 3}, {3, 32, 7, 11}}}, - {{-1, 32, -1, -1}, {{2, 32, 4, 10}, {1, 32, 1, 5}, {3, 32, 7, 1}}}, - }, - { - {{{1, 3}, 32, {1, 7}, {2, 16}}, {{2, 32, 4, 5}, {1, 32, 1, 16}, {3, 32, 7, 2}}}, - {{{1, 3}, 32, {1, 7}, {1, 11}}, {{2, 32, 4, 1}, {1, 32, 1, 3}, {3, 32, 7, 11}}}, - {{{1, 3}, 32, {1, 7}, {1, 10}}, {{2, 32, 4, 10}, {1, 32, 1, 5}, {3, 32, 7, 1}}}, - }, + { + {{-1, 32, -1, -1}, + { + {2, 32, 4, 5}, + {1, 32, 1, 16}, + {3, 32, 7, 2}, + }}, + {{-1, 32, -1, -1}, {{2, 32, 4, 1}, {1, 32, 1, 3}, {3, 32, 7, 11}}}, + {{-1, 32, -1, -1}, {{2, 32, 4, 10}, {1, 32, 1, 5}, {3, 32, 7, 1}}}, + }, + { + {{{1, 3}, 32, {1, 7}, {2, 16}}, {{2, 32, 4, 5}, {1, 32, 1, 16}, {3, 32, 7, 2}}}, + {{{1, 3}, 32, {1, 7}, {1, 11}}, {{2, 32, 4, 1}, {1, 32, 1, 3}, {3, 32, 7, 11}}}, + {{{1, 3}, 32, {1, 7}, {1, 10}}, {{2, 32, 4, 10}, {1, 32, 1, 5}, {3, 32, 7, 1}}}, + }, }; -INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_Block_dynamic_axis_3, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(3), - ::testing::ValuesIn(inputShapes4D_Block_axis3), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(blocked8_4D_ref, blocked16_4D_ref)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_Block_dynamic_axis_3, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(3), + ::testing::ValuesIn(inputShapes4D_Block_axis3), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(blocked8_4D_ref, blocked16_4D_ref)), + ConcatLayerCPUTest::getTestCaseName); const std::vector> inputShapes4D_axis3 = { - { - {{-1, -1, -1, -1}, {{2, 32, 4, 5}, {1, 32, 1, 16}, {3, 32, 7, 2}}}, - {{-1, -1, -1, -1}, {{2, 32, 4, 1}, {1, 32, 1, 3}, {3, 32, 7, 11}}}, - {{-1, -1, -1, -1}, {{2, 32, 4, 10}, {1, 32, 1, 5}, {3, 32, 7, 1}}}, - }, - { - {{{1, 3}, {1, 32}, {1, 7}, {2, 16}}, {{2, 32, 4, 5}, {1, 32, 1, 16}, {3, 32, 7, 2}}}, - {{{1, 3}, {1, 32}, {1, 7}, {1, 11}}, {{2, 32, 4, 1}, {1, 32, 1, 3}, {3, 32, 7, 11}}}, - {{{1, 3}, {1, 32}, {1, 7}, {1, 10}}, {{2, 32, 4, 10}, {1, 32, 1, 5}, {3, 32, 7, 1}}}, - }, - { - {{{1, 3}, 32, 4, 5}, {{1, 32, 4, 5}, {2, 32, 4, 5}}}, - {{{1, 3}, 32, 4, 1}, {{1, 32, 4, 1}, {2, 32, 4, 1}}}, - {{{1, 3}, 32, 4, 10}, {{1, 32, 4, 10}, {2, 32, 4, 10}}}, - }, + { + {{-1, -1, -1, -1}, {{2, 32, 4, 5}, {1, 32, 1, 16}, {3, 32, 7, 2}}}, + {{-1, -1, -1, -1}, {{2, 32, 4, 1}, {1, 32, 1, 3}, {3, 32, 7, 11}}}, + {{-1, -1, -1, -1}, {{2, 32, 4, 10}, {1, 32, 1, 5}, {3, 32, 7, 1}}}, + }, + { + {{{1, 3}, {1, 32}, {1, 7}, {2, 16}}, {{2, 32, 4, 5}, {1, 32, 1, 16}, {3, 32, 7, 2}}}, + {{{1, 3}, {1, 32}, {1, 7}, {1, 11}}, {{2, 32, 4, 1}, {1, 32, 1, 3}, {3, 32, 7, 11}}}, + {{{1, 3}, {1, 32}, {1, 7}, {1, 10}}, {{2, 32, 4, 10}, {1, 32, 1, 5}, {3, 32, 7, 1}}}, + }, + { + {{{1, 3}, 32, 4, 5}, {{1, 32, 4, 5}, {2, 32, 4, 5}}}, + {{{1, 3}, 32, 4, 1}, {{1, 32, 4, 1}, {2, 32, 4, 1}}}, + {{{1, 3}, 32, 4, 10}, {{1, 32, 4, 10}, {2, 32, 4, 10}}}, + }, }; -INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_dynamic_axis_3, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(3, -1), - ::testing::ValuesIn(inputShapes4D_axis3), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(planar_4D_ref, planarChannels_4D)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_dynamic_axis_3, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(3, -1), + ::testing::ValuesIn(inputShapes4D_axis3), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(planar_4D_ref, planarChannels_4D)), + ConcatLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_Block8_static, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(2, 3, -2), - ::testing::Values(static_shapes_to_test_representation({{2, 16, 3, 5, 7}, {2, 16, 3, 5, 7}})), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(planar_5D_ref, planarChannels_5D, blocked8_5D_ref)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_Block8_static, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(2, 3, -2), + ::testing::Values(static_shapes_to_test_representation({{2, 16, 3, 5, 7}, + {2, 16, 3, 5, 7}})), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(planar_5D_ref, planarChannels_5D, blocked8_5D_ref)), + ConcatLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_Block16_static, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(2, 3, 4), - ::testing::Values(static_shapes_to_test_representation({{2, 32, 3, 5, 7}, {2, 32, 3, 5, 7}})), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(blocked16_5D_ref)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_Block16_static, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(2, 3, 4), + ::testing::Values(static_shapes_to_test_representation({{2, 32, 3, 5, 7}, + {2, 32, 3, 5, 7}})), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(blocked16_5D_ref)), + ConcatLayerCPUTest::getTestCaseName); const std::vector> inputShapes5D_Block_axis1 = { - { - {{-1, 32, -1, -1, -1}, {{2, 32, 5, 7, 6}, {1, 32, 10, 2, 8}, {3, 32, 1, 8, 10}}}, - {{-1, 16, -1, -1, -1}, {{2, 16, 5, 7, 6}, {1, 16, 10, 2, 8}, {3, 16, 1, 8, 10}}}, - {{-1, 64, -1, -1, -1}, {{2, 64, 5, 7, 6}, {1, 64, 10, 2, 8}, {3, 64, 1, 8, 10}}}, - }, - { - {{{1, 3}, 32, {1, 10}, {2, 8}, {6, 10}}, {{2, 32, 5, 7, 6}, {1, 32, 10, 2, 8}, {3, 32, 1, 8, 10}}}, - {{{1, 3}, 16, {1, 10}, {2, 8}, {6, 10}}, {{2, 16, 5, 7, 6}, {1, 16, 10, 2, 8}, {3, 16, 1, 8, 10}}}, - {{{1, 3}, 64, {1, 10}, {2, 8}, {6, 10}}, {{2, 64, 5, 7, 6}, {1, 64, 10, 2, 8}, {3, 64, 1, 8, 10}}}, - }, + { + {{-1, 32, -1, -1, -1}, {{2, 32, 5, 7, 6}, {1, 32, 10, 2, 8}, {3, 32, 1, 8, 10}}}, + {{-1, 16, -1, -1, -1}, {{2, 16, 5, 7, 6}, {1, 16, 10, 2, 8}, {3, 16, 1, 8, 10}}}, + {{-1, 64, -1, -1, -1}, {{2, 64, 5, 7, 6}, {1, 64, 10, 2, 8}, {3, 64, 1, 8, 10}}}, + }, + { + {{{1, 3}, 32, {1, 10}, {2, 8}, {6, 10}}, {{2, 32, 5, 7, 6}, {1, 32, 10, 2, 8}, {3, 32, 1, 8, 10}}}, + {{{1, 3}, 16, {1, 10}, {2, 8}, {6, 10}}, {{2, 16, 5, 7, 6}, {1, 16, 10, 2, 8}, {3, 16, 1, 8, 10}}}, + {{{1, 3}, 64, {1, 10}, {2, 8}, {6, 10}}, {{2, 64, 5, 7, 6}, {1, 64, 10, 2, 8}, {3, 64, 1, 8, 10}}}, + }, }; -INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_Block_dynamic_axis_1, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(1), - ::testing::ValuesIn(inputShapes5D_Block_axis1), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(blocked8_5D_ref, blocked16_5D_ref)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_Block_dynamic_axis_1, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(1), + ::testing::ValuesIn(inputShapes5D_Block_axis1), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(blocked8_5D_ref, blocked16_5D_ref)), + ConcatLayerCPUTest::getTestCaseName); const std::vector> inputShapes5D_axis1 = { - { - {{-1, -1, -1, -1, -1}, {{2, 5, 5, 7, 6}, {1, 3, 10, 2, 8}, {3, 4, 1, 8, 10}}}, - {{-1, -1, -1, -1, -1}, {{2, 16, 5, 7, 6}, {1, 20, 10, 2, 8}, {3, 5, 1, 8, 10}, }}, - {{-1, -1, -1, -1, -1}, {{2, 1, 5, 7, 6}, {1, 17, 10, 2, 8}, {3, 5, 1, 8, 10}}}, - }, - { - {{{1, 3}, {3, 5}, {1, 10}, {2, 8}, {6, 10}}, {{2, 5, 5, 7, 6}, {1, 3, 10, 2, 8}, {3, 4, 1, 8, 10}}}, - {{{1, 3}, {5, 20}, {1, 10}, {2, 8}, {4, 10}}, {{2, 16, 5, 7, 6}, {1, 20, 10, 2, 8}, {3, 5, 1, 8, 10}, }}, - {{{1, 3}, {1, 17}, {1, 10}, {2, 8}, {6, 10}}, {{2, 1, 5, 7, 6}, {1, 17, 10, 2, 8}, {3, 5, 1, 8, 10}}}, - }, + { + {{-1, -1, -1, -1, -1}, {{2, 5, 5, 7, 6}, {1, 3, 10, 2, 8}, {3, 4, 1, 8, 10}}}, + {{-1, -1, -1, -1, -1}, + { + {2, 16, 5, 7, 6}, + {1, 20, 10, 2, 8}, + {3, 5, 1, 8, 10}, + }}, + {{-1, -1, -1, -1, -1}, {{2, 1, 5, 7, 6}, {1, 17, 10, 2, 8}, {3, 5, 1, 8, 10}}}, + }, + { + {{{1, 3}, {3, 5}, {1, 10}, {2, 8}, {6, 10}}, {{2, 5, 5, 7, 6}, {1, 3, 10, 2, 8}, {3, 4, 1, 8, 10}}}, + {{{1, 3}, {5, 20}, {1, 10}, {2, 8}, {4, 10}}, + { + {2, 16, 5, 7, 6}, + {1, 20, 10, 2, 8}, + {3, 5, 1, 8, 10}, + }}, + {{{1, 3}, {1, 17}, {1, 10}, {2, 8}, {6, 10}}, {{2, 1, 5, 7, 6}, {1, 17, 10, 2, 8}, {3, 5, 1, 8, 10}}}, + }, }; -INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_dynamic_axis_1, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(1), - ::testing::ValuesIn(inputShapes5D_axis1), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(planar_5D_ref, planarChannels_5D)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_dynamic_axis_1, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(1), + ::testing::ValuesIn(inputShapes5D_axis1), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(planar_5D_ref, planarChannels_5D)), + ConcatLayerCPUTest::getTestCaseName); const std::vector> inputShapes5D_Block_axis2 = { - { - {{-1, 16, -1, -1, -1}, {{2, 16, 5, 8, 7}, {1, 16, 16, 1, 2}, {3, 16, 2, 5, 8}, }}, - {{-1, 16, -1, -1, -1}, {{2, 16, 1, 8, 7}, {1, 16, 3, 1, 2}, {3, 16, 11, 5, 8}}}, - {{-1, 16, -1, -1, -1}, {{2, 16, 10, 8, 7}, {1, 16, 5, 1, 2}, {3, 16, 1, 5, 8}}}, - }, - { - {{{1, 3}, 16, {2, 16}, {1, 8}, {2, 8}}, {{2, 16, 5, 8, 7}, {1, 16, 16, 1, 2}, {3, 16, 2, 5, 8}, }}, - {{{1, 5}, 16, {1, 11}, {1, 8}, {1, 8}}, {{2, 16, 1, 8, 7}, {1, 16, 3, 1, 2}, {3, 16, 11, 5, 8}}}, - {{{1, 6}, 16, {1, 10}, {1, 8}, {2, 10}}, {{2, 16, 10, 8, 7}, {1, 16, 5, 1, 2}, {3, 16, 1, 5, 8}}}, - }, + { + {{-1, 16, -1, -1, -1}, + { + {2, 16, 5, 8, 7}, + {1, 16, 16, 1, 2}, + {3, 16, 2, 5, 8}, + }}, + {{-1, 16, -1, -1, -1}, {{2, 16, 1, 8, 7}, {1, 16, 3, 1, 2}, {3, 16, 11, 5, 8}}}, + {{-1, 16, -1, -1, -1}, {{2, 16, 10, 8, 7}, {1, 16, 5, 1, 2}, {3, 16, 1, 5, 8}}}, + }, + { + {{{1, 3}, 16, {2, 16}, {1, 8}, {2, 8}}, + { + {2, 16, 5, 8, 7}, + {1, 16, 16, 1, 2}, + {3, 16, 2, 5, 8}, + }}, + {{{1, 5}, 16, {1, 11}, {1, 8}, {1, 8}}, {{2, 16, 1, 8, 7}, {1, 16, 3, 1, 2}, {3, 16, 11, 5, 8}}}, + {{{1, 6}, 16, {1, 10}, {1, 8}, {2, 10}}, {{2, 16, 10, 8, 7}, {1, 16, 5, 1, 2}, {3, 16, 1, 5, 8}}}, + }, }; -INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_Block_dynamic_axis_2, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(-3), - ::testing::ValuesIn(inputShapes5D_Block_axis2), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(blocked8_5D_ref, blocked16_5D_ref)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_Block_dynamic_axis_2, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(-3), + ::testing::ValuesIn(inputShapes5D_Block_axis2), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(blocked8_5D_ref, blocked16_5D_ref)), + ConcatLayerCPUTest::getTestCaseName); const std::vector> inputShapes5D_axis2 = { - { - {{-1, -1, -1, -1, -1}, {{2, 4, 5, 8, 7}, {1, 20, 16, 1, 2}, {3, 8, 2, 5, 8}}}, - {{-1, -1, -1, -1, -1}, {{2, 4, 1, 8, 7}, {1, 20, 3, 1, 2}, {3, 8, 11, 5, 8}}}, - {{-1, -1, -1, -1, -1}, {{2, 4, 10, 8, 7}, {1, 20, 5, 1, 2}, {3, 8, 1, 5, 8}}}, - }, - { - {{{1, 3}, {4, 20}, {1, 16}, {1, 8}, {2, 8}}, {{2, 4, 5, 8, 7}, {1, 20, 16, 1, 2}, {3, 8, 2, 5, 8}}}, - {{{1, 3}, {4, 20}, {1, 11}, {1, 10}, {1, 15}}, {{2, 4, 1, 8, 7}, {1, 20, 3, 1, 2}, {3, 8, 11, 5, 8}}}, - {{{1, 3}, {1, 20}, {1, 15}, {1, 10}, {2, 8}}, {{2, 4, 10, 8, 7}, {1, 20, 5, 1, 2}, {3, 8, 1, 5, 8}}}, - }, + { + {{-1, -1, -1, -1, -1}, {{2, 4, 5, 8, 7}, {1, 20, 16, 1, 2}, {3, 8, 2, 5, 8}}}, + {{-1, -1, -1, -1, -1}, {{2, 4, 1, 8, 7}, {1, 20, 3, 1, 2}, {3, 8, 11, 5, 8}}}, + {{-1, -1, -1, -1, -1}, {{2, 4, 10, 8, 7}, {1, 20, 5, 1, 2}, {3, 8, 1, 5, 8}}}, + }, + { + {{{1, 3}, {4, 20}, {1, 16}, {1, 8}, {2, 8}}, {{2, 4, 5, 8, 7}, {1, 20, 16, 1, 2}, {3, 8, 2, 5, 8}}}, + {{{1, 3}, {4, 20}, {1, 11}, {1, 10}, {1, 15}}, {{2, 4, 1, 8, 7}, {1, 20, 3, 1, 2}, {3, 8, 11, 5, 8}}}, + {{{1, 3}, {1, 20}, {1, 15}, {1, 10}, {2, 8}}, {{2, 4, 10, 8, 7}, {1, 20, 5, 1, 2}, {3, 8, 1, 5, 8}}}, + }, }; -INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_dynamic_axis_2, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(2), - ::testing::ValuesIn(inputShapes5D_axis2), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(planar_5D_ref, planarChannels_5D)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_dynamic_axis_2, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(2), + ::testing::ValuesIn(inputShapes5D_axis2), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(planar_5D_ref, planarChannels_5D)), + ConcatLayerCPUTest::getTestCaseName); const std::vector> inputShapes5D_Block_axis3 = { - { - {{-1, 32, -1, -1, -1}, {{2, 32, 4, 5, 7}, {1, 32, 1, 16, 3}, {3, 32, 7, 2, 4}}}, - {{-1, 32, -1, -1, -1}, {{2, 32, 4, 1, 7}, {1, 32, 1, 3, 3}, {3, 32, 7, 11, 4}}}, - {{-1, 32, -1, -1, -1}, {{2, 32, 4, 10, 7}, {1, 32, 1, 5, 3}, {3, 32, 7, 1, 4}}}, - }, - { - {{{1, 3}, 32, {1, 7}, {2, 16}, {3, 7}}, {{2, 32, 4, 5, 7}, {1, 32, 1, 16, 3}, {3, 32, 7, 2, 4}, }}, - {{{1, 5}, 32, {1, 7}, {1, 11}, {3, 7}}, {{2, 32, 4, 1, 7}, {1, 32, 1, 3, 3}, {3, 32, 7, 11, 4}}}, - {{{1, 6}, 32, {1, 15}, {1, 10}, {1, 20}}, {{2, 32, 4, 10, 7}, {1, 32, 1, 5, 3}, {3, 32, 7, 1, 4}}}, - }, + { + {{-1, 32, -1, -1, -1}, {{2, 32, 4, 5, 7}, {1, 32, 1, 16, 3}, {3, 32, 7, 2, 4}}}, + {{-1, 32, -1, -1, -1}, {{2, 32, 4, 1, 7}, {1, 32, 1, 3, 3}, {3, 32, 7, 11, 4}}}, + {{-1, 32, -1, -1, -1}, {{2, 32, 4, 10, 7}, {1, 32, 1, 5, 3}, {3, 32, 7, 1, 4}}}, + }, + { + {{{1, 3}, 32, {1, 7}, {2, 16}, {3, 7}}, + { + {2, 32, 4, 5, 7}, + {1, 32, 1, 16, 3}, + {3, 32, 7, 2, 4}, + }}, + {{{1, 5}, 32, {1, 7}, {1, 11}, {3, 7}}, {{2, 32, 4, 1, 7}, {1, 32, 1, 3, 3}, {3, 32, 7, 11, 4}}}, + {{{1, 6}, 32, {1, 15}, {1, 10}, {1, 20}}, {{2, 32, 4, 10, 7}, {1, 32, 1, 5, 3}, {3, 32, 7, 1, 4}}}, + }, }; -INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_Block_dynamic_axis_3, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(3), - ::testing::ValuesIn(inputShapes5D_Block_axis3), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(blocked8_5D_ref, blocked16_5D_ref)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_Block_dynamic_axis_3, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(3), + ::testing::ValuesIn(inputShapes5D_Block_axis3), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(blocked8_5D_ref, blocked16_5D_ref)), + ConcatLayerCPUTest::getTestCaseName); const std::vector> inputShapes5D_axis3 = { - { - {{-1, -1, -1, -1, -1}, {{2, 32, 4, 5, 7}, {1, 11, 1, 16, 3}, {3, 7, 7, 2, 4}}}, - {{-1, -1, -1, -1, -1}, {{2, 32, 4, 1, 7}, {1, 11, 1, 3, 3}, {3, 7, 7, 11, 4}}}, - {{-1, -1, -1, -1, -1}, {{2, 32, 4, 10, 7}, {1, 11, 1, 5, 3}, {3, 7, 7, 1, 4}}}, - }, - { - {{{1, 7}, {7, 32}, {1, 7}, {1, 16}, {3, 14}}, {{2, 32, 4, 5, 7}, {1, 11, 1, 16, 3}, {3, 7, 7, 2, 4}, }}, - {{{1, 7}, {7, 32}, {1, 10}, {1, 11}, {3, 7}}, {{2, 32, 4, 1, 7}, {1, 11, 1, 3, 3}, {3, 7, 7, 11, 4}}}, - {{{1, 7}, {1, 32}, {1, 10}, {1, 10}, {1, 10}}, {{2, 32, 4, 10, 7}, {1, 11, 1, 5, 3}, {3, 7, 7, 1, 4}}}, - }, + { + {{-1, -1, -1, -1, -1}, {{2, 32, 4, 5, 7}, {1, 11, 1, 16, 3}, {3, 7, 7, 2, 4}}}, + {{-1, -1, -1, -1, -1}, {{2, 32, 4, 1, 7}, {1, 11, 1, 3, 3}, {3, 7, 7, 11, 4}}}, + {{-1, -1, -1, -1, -1}, {{2, 32, 4, 10, 7}, {1, 11, 1, 5, 3}, {3, 7, 7, 1, 4}}}, + }, + { + {{{1, 7}, {7, 32}, {1, 7}, {1, 16}, {3, 14}}, + { + {2, 32, 4, 5, 7}, + {1, 11, 1, 16, 3}, + {3, 7, 7, 2, 4}, + }}, + {{{1, 7}, {7, 32}, {1, 10}, {1, 11}, {3, 7}}, {{2, 32, 4, 1, 7}, {1, 11, 1, 3, 3}, {3, 7, 7, 11, 4}}}, + {{{1, 7}, {1, 32}, {1, 10}, {1, 10}, {1, 10}}, {{2, 32, 4, 10, 7}, {1, 11, 1, 5, 3}, {3, 7, 7, 1, 4}}}, + }, }; -INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_dynamic_axis_3, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(3), - ::testing::ValuesIn(inputShapes5D_axis3), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(planar_5D_ref, planarChannels_5D)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_dynamic_axis_3, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(3), + ::testing::ValuesIn(inputShapes5D_axis3), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(planar_5D_ref, planarChannels_5D)), + ConcatLayerCPUTest::getTestCaseName); const std::vector> inputShapes5D_Block_axis4 = { - { - {{-1, 32, -1, -1, -1}, {{2, 32, 4, 5, 5}, {1, 32, 1, 1, 16}, {3, 32, 7, 9, 2}, }}, - {{-1, 32, -1, -1, -1}, {{2, 32, 4, 5, 1}, {1, 32, 1, 1, 3}, {3, 32, 7, 9, 11}}}, - {{-1, 32, -1, -1, -1}, {{2, 32, 4, 5, 10}, {1, 32, 1, 1, 5}, {3, 32, 7, 9, 1}}}, - }, - { - {{{1, 15}, 32, {1, 10}, {1, 10}, {1, 16}}, {{2, 32, 4, 5, 5}, {1, 32, 1, 1, 16}, {3, 32, 7, 9, 2}, }}, - {{{1, 15}, 32, {1, 10}, {1, 10}, {1, 11}}, {{2, 32, 4, 5, 1}, {1, 32, 1, 1, 3}, {3, 32, 7, 9, 11}}}, - {{{1, 15}, 32, {1, 10}, {1, 10}, {1, 11}}, {{2, 32, 4, 5, 10}, {1, 32, 1, 1, 5}, {3, 32, 7, 9, 1}}}, - }, + { + {{-1, 32, -1, -1, -1}, + { + {2, 32, 4, 5, 5}, + {1, 32, 1, 1, 16}, + {3, 32, 7, 9, 2}, + }}, + {{-1, 32, -1, -1, -1}, {{2, 32, 4, 5, 1}, {1, 32, 1, 1, 3}, {3, 32, 7, 9, 11}}}, + {{-1, 32, -1, -1, -1}, {{2, 32, 4, 5, 10}, {1, 32, 1, 1, 5}, {3, 32, 7, 9, 1}}}, + }, + { + {{{1, 15}, 32, {1, 10}, {1, 10}, {1, 16}}, + { + {2, 32, 4, 5, 5}, + {1, 32, 1, 1, 16}, + {3, 32, 7, 9, 2}, + }}, + {{{1, 15}, 32, {1, 10}, {1, 10}, {1, 11}}, {{2, 32, 4, 5, 1}, {1, 32, 1, 1, 3}, {3, 32, 7, 9, 11}}}, + {{{1, 15}, 32, {1, 10}, {1, 10}, {1, 11}}, {{2, 32, 4, 5, 10}, {1, 32, 1, 1, 5}, {3, 32, 7, 9, 1}}}, + }, }; -INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_Block_dynamic_axis_4, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(4), - ::testing::ValuesIn(inputShapes5D_Block_axis4), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(blocked8_5D_ref, blocked16_5D_ref)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_Block_dynamic_axis_4, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(4), + ::testing::ValuesIn(inputShapes5D_Block_axis4), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(blocked8_5D_ref, blocked16_5D_ref)), + ConcatLayerCPUTest::getTestCaseName); const std::vector> inputShapes5D_axis4 = { - { - {{-1, -1, -1, -1, -1}, {{2, 1, 4, 5, 5}, {1, 4, 1, 1, 16}, {3, 14, 7, 9, 2}}}, - {{-1, -1, -1, -1, -1}, {{2, 1, 4, 5, 1}, {1, 4, 1, 1, 3}, {3, 14, 7, 9, 11}}}, - {{-1, -1, -1, -1, -1}, {{2, 1, 4, 5, 10}, {1, 4, 1, 1, 5}, {3, 14, 7, 9, 1}}}, - }, - { - {{{1, 3}, {1, 14}, {1, 7}, {1, 10}, {2, 16}}, {{2, 1, 4, 5, 5}, {1, 4, 1, 1, 16}, {3, 14, 7, 9, 2}}}, - {{{1, 3}, {1, 14}, {1, 7}, {1, 9}, {1, 11}}, {{2, 1, 4, 5, 1}, {1, 4, 1, 1, 3}, {3, 14, 7, 9, 11}}}, - {{{1, 3}, {1, 14}, {1, 7}, {1, 9}, {1, 10}}, {{2, 1, 4, 5, 10}, {1, 4, 1, 1, 5}, {3, 14, 7, 9, 1}}}, - }, + { + {{-1, -1, -1, -1, -1}, {{2, 1, 4, 5, 5}, {1, 4, 1, 1, 16}, {3, 14, 7, 9, 2}}}, + {{-1, -1, -1, -1, -1}, {{2, 1, 4, 5, 1}, {1, 4, 1, 1, 3}, {3, 14, 7, 9, 11}}}, + {{-1, -1, -1, -1, -1}, {{2, 1, 4, 5, 10}, {1, 4, 1, 1, 5}, {3, 14, 7, 9, 1}}}, + }, + { + {{{1, 3}, {1, 14}, {1, 7}, {1, 10}, {2, 16}}, {{2, 1, 4, 5, 5}, {1, 4, 1, 1, 16}, {3, 14, 7, 9, 2}}}, + {{{1, 3}, {1, 14}, {1, 7}, {1, 9}, {1, 11}}, {{2, 1, 4, 5, 1}, {1, 4, 1, 1, 3}, {3, 14, 7, 9, 11}}}, + {{{1, 3}, {1, 14}, {1, 7}, {1, 9}, {1, 10}}, {{2, 1, 4, 5, 10}, {1, 4, 1, 1, 5}, {3, 14, 7, 9, 1}}}, + }, }; -INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_dynamic_axis_4, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(4), - ::testing::ValuesIn(inputShapes5D_axis4), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(planar_5D_ref, planarChannels_5D)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_dynamic_axis_4, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(4), + ::testing::ValuesIn(inputShapes5D_axis4), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(planar_5D_ref, planarChannels_5D)), + ConcatLayerCPUTest::getTestCaseName); const std::vector> inputShapes_byBatch_static = { - static_shapes_to_test_representation({{5, 2, 2, 2}, {2, 2, 2, 2}}), - static_shapes_to_test_representation({{1, 3, 5}, {3, 3, 5}}), - static_shapes_to_test_representation({{4, 3, 2}, {1, 3, 2}}) -}; + static_shapes_to_test_representation({{5, 2, 2, 2}, {2, 2, 2, 2}}), + static_shapes_to_test_representation({{1, 3, 5}, {3, 3, 5}}), + static_shapes_to_test_representation({{4, 3, 2}, {1, 3, 2}})}; const std::vector> inputShapes_byBatch_dynamic = { - // 5D - { - {{-1, -1, -1, -1, -1}, {{10, 32, 4, 5, 5}, {4, 7, 1, 1, 3}, {3, 20, 7, 9, 1}, }}, - {{-1, -1, -1, -1, -1}, {{5, 32, 4, 5, 5}, {7, 7, 1, 1, 3}, {3, 20, 7, 9, 1}}}, - {{-1, -1, -1, -1, -1}, {{1, 32, 4, 5, 5}, {1, 7, 1, 1, 3}, {6, 20, 7, 9, 1}}}, - }, - { - {{{3, 10}, {7, 32}, {1, 9}, {1, 10}, {1, 5}}, {{10, 32, 4, 5, 5}, {4, 7, 1, 1, 3}, {3, 20, 7, 9, 1}, }}, - {{{3, 7}, {7, 32}, {1, 7}, {1, 9}, {1, 5}}, {{5, 32, 4, 5, 5}, {7, 7, 1, 1, 3}, {3, 20, 7, 9, 1}}}, - {{{1, 6}, {7, 32}, {1, 7}, {1, 9}, {1, 5}}, {{1, 32, 4, 5, 5}, {1, 7, 1, 1, 3}, {6, 20, 7, 9, 1}}}, - }, - // 4D - { - {{-1, -1, -1, -1}, {{10, 32, 4, 5}, {4, 7, 1, 1}, {3, 20, 7, 9}, }}, - {{-1, -1, -1, -1}, {{5, 32, 4, 5}, {7, 7, 1, 1}, {3, 20, 7, 9}}}, - {{-1, -1, -1, -1}, {{1, 32, 4, 5}, {1, 7, 1, 1}, {6, 20, 7, 9}}}, - }, - { - {{{1, 10}, {1, 32}, {1, 7}, {1, 9}}, {{10, 32, 4, 5}, {4, 7, 1, 1}, {3, 20, 7, 9}, }}, - {{{3, 7}, {7, 32}, {1, 7}, {1, 9}}, {{5, 32, 4, 5}, {7, 7, 1, 1}, {3, 20, 7, 9}}}, - {{{1, 6}, {7, 32}, {1, 7}, {1, 9}}, {{1, 32, 4, 5}, {1, 7, 1, 1}, {6, 20, 7, 9}}}, - }, - { - {{{1, 10}, 32, 4, 5}, {{10, 32, 4, 5}, {4, 32, 4, 5}}}, - {{{1, 10}, 32, 4, 5}, {{5, 32, 4, 5}, {7, 32, 4, 5}}}, - {{{1, 10}, 32, 4, 5}, {{1, 32, 4, 5}, {1, 32, 4, 5}}}, - } -}; + // 5D + { + {{-1, -1, -1, -1, -1}, + { + {10, 32, 4, 5, 5}, + {4, 7, 1, 1, 3}, + {3, 20, 7, 9, 1}, + }}, + {{-1, -1, -1, -1, -1}, {{5, 32, 4, 5, 5}, {7, 7, 1, 1, 3}, {3, 20, 7, 9, 1}}}, + {{-1, -1, -1, -1, -1}, {{1, 32, 4, 5, 5}, {1, 7, 1, 1, 3}, {6, 20, 7, 9, 1}}}, + }, + { + {{{3, 10}, {7, 32}, {1, 9}, {1, 10}, {1, 5}}, + { + {10, 32, 4, 5, 5}, + {4, 7, 1, 1, 3}, + {3, 20, 7, 9, 1}, + }}, + {{{3, 7}, {7, 32}, {1, 7}, {1, 9}, {1, 5}}, {{5, 32, 4, 5, 5}, {7, 7, 1, 1, 3}, {3, 20, 7, 9, 1}}}, + {{{1, 6}, {7, 32}, {1, 7}, {1, 9}, {1, 5}}, {{1, 32, 4, 5, 5}, {1, 7, 1, 1, 3}, {6, 20, 7, 9, 1}}}, + }, + // 4D + { + {{-1, -1, -1, -1}, + { + {10, 32, 4, 5}, + {4, 7, 1, 1}, + {3, 20, 7, 9}, + }}, + {{-1, -1, -1, -1}, {{5, 32, 4, 5}, {7, 7, 1, 1}, {3, 20, 7, 9}}}, + {{-1, -1, -1, -1}, {{1, 32, 4, 5}, {1, 7, 1, 1}, {6, 20, 7, 9}}}, + }, + { + {{{1, 10}, {1, 32}, {1, 7}, {1, 9}}, + { + {10, 32, 4, 5}, + {4, 7, 1, 1}, + {3, 20, 7, 9}, + }}, + {{{3, 7}, {7, 32}, {1, 7}, {1, 9}}, {{5, 32, 4, 5}, {7, 7, 1, 1}, {3, 20, 7, 9}}}, + {{{1, 6}, {7, 32}, {1, 7}, {1, 9}}, {{1, 32, 4, 5}, {1, 7, 1, 1}, {6, 20, 7, 9}}}, + }, + { + {{{1, 10}, 32, 4, 5}, {{10, 32, 4, 5}, {4, 32, 4, 5}}}, + {{{1, 10}, 32, 4, 5}, {{5, 32, 4, 5}, {7, 32, 4, 5}}}, + {{{1, 10}, 32, 4, 5}, {{1, 32, 4, 5}, {1, 32, 4, 5}}}, + }}; -INSTANTIATE_TEST_SUITE_P(smoke_Concat_byBatch_static, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(0), - ::testing::ValuesIn(inputShapes_byBatch_static), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(CPUSpecificParams{{}, {}, {}, "unknown"})), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat_byBatch_static, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(0), + ::testing::ValuesIn(inputShapes_byBatch_static), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "unknown"})), + ConcatLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_Concat_byBatch_dynamic, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(0), - ::testing::ValuesIn(inputShapes_byBatch_dynamic), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat_byBatch_dynamic, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(0), + ::testing::ValuesIn(inputShapes_byBatch_dynamic), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), + ConcatLayerCPUTest::getTestCaseName); const std::vector> inputShapes3D_axis1 = { - static_shapes_to_test_representation({{2, 4, 5}, {2, 4, 5}}), - { - {{-1, -1, -1}, {{2, 5, 12}, {1, 16, 1}, {5, 2, 6}, }}, - {{-1, -1, -1}, {{2, 1, 12}, {1, 3, 1}, {5, 11, 6}}}, - {{-1, -1, -1}, {{2, 10, 12}, {1, 5, 1}, {5, 1, 6}}}, - }, - { - {{{1, 5}, {2, 16}, {1, 12}}, {{2, 5, 12}, {1, 16, 1}, {5, 2, 6}, }}, - {{{1, 5}, {1, 11}, {1, 21}}, {{2, 1, 12}, {1, 3, 1}, {5, 11, 6}}}, - {{{1, 5}, {1, 10}, {1, 12}}, {{2, 10, 12}, {1, 5, 1}, {5, 1, 6}}}, - }, + static_shapes_to_test_representation({{2, 4, 5}, {2, 4, 5}}), + { + {{-1, -1, -1}, + { + {2, 5, 12}, + {1, 16, 1}, + {5, 2, 6}, + }}, + {{-1, -1, -1}, {{2, 1, 12}, {1, 3, 1}, {5, 11, 6}}}, + {{-1, -1, -1}, {{2, 10, 12}, {1, 5, 1}, {5, 1, 6}}}, + }, + { + {{{1, 5}, {2, 16}, {1, 12}}, + { + {2, 5, 12}, + {1, 16, 1}, + {5, 2, 6}, + }}, + {{{1, 5}, {1, 11}, {1, 21}}, {{2, 1, 12}, {1, 3, 1}, {5, 11, 6}}}, + {{{1, 5}, {1, 10}, {1, 12}}, {{2, 10, 12}, {1, 5, 1}, {5, 1, 6}}}, + }, }; -INSTANTIATE_TEST_SUITE_P(smoke_Concat_3D_axis1, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(1), - ::testing::ValuesIn(inputShapes3D_axis1), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat_3D_axis1, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(1), + ::testing::ValuesIn(inputShapes3D_axis1), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), + ConcatLayerCPUTest::getTestCaseName); const std::vector> inputShapes3D_axis2 = { - static_shapes_to_test_representation({{2, 4, 5}, {2, 4, 5}}), - { - {{-1, -1, -1}, {{4, 4, 5}, {3, 2, 16}, {1, 1, 2}}}, - {{-1, -1, -1}, {{4, 4, 1}, {3, 2, 3}, {1, 1, 11}}}, - {{-1, -1, -1}, {{4, 4, 10}, {3, 2, 5}, {1, 1, 1}}}, - }, - { - {{{1, 4}, {1, 4}, {2, 16}}, {{4, 4, 5}, {3, 2, 16}, {1, 1, 2}, }}, - {{{1, 4}, {1, 4}, {1, 11}}, {{4, 4, 1}, {3, 2, 3}, {1, 1, 11}}}, - {{{1, 4}, {1, 4}, {1, 10}}, {{4, 4, 10}, {3, 2, 5}, {1, 1, 1}}}, - }, + static_shapes_to_test_representation({{2, 4, 5}, {2, 4, 5}}), + { + {{-1, -1, -1}, {{4, 4, 5}, {3, 2, 16}, {1, 1, 2}}}, + {{-1, -1, -1}, {{4, 4, 1}, {3, 2, 3}, {1, 1, 11}}}, + {{-1, -1, -1}, {{4, 4, 10}, {3, 2, 5}, {1, 1, 1}}}, + }, + { + {{{1, 4}, {1, 4}, {2, 16}}, + { + {4, 4, 5}, + {3, 2, 16}, + {1, 1, 2}, + }}, + {{{1, 4}, {1, 4}, {1, 11}}, {{4, 4, 1}, {3, 2, 3}, {1, 1, 11}}}, + {{{1, 4}, {1, 4}, {1, 10}}, {{4, 4, 10}, {3, 2, 5}, {1, 1, 1}}}, + }, }; -INSTANTIATE_TEST_SUITE_P(smoke_Concat_3D_axis2, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(2), - ::testing::ValuesIn(inputShapes3D_axis2), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat_3D_axis2, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(2), + ::testing::ValuesIn(inputShapes3D_axis2), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), + ConcatLayerCPUTest::getTestCaseName); const std::vector> inputShapes2D_axis1 = { - static_shapes_to_test_representation({{3, 2}, {3, 10}}), - { - {{-1, -1}, {{19, 5}, {1, 16}, {8, 2}, }}, - {{-1, -1}, {{19, 1}, {1, 3}, {8, 11}}}, - {{-1, -1}, {{19, 10}, {1, 5}, {8, 1}}}, - }, - { - {{{1, 19}, {2, 16}}, {{19, 5}, {1, 16}, {8, 2}, }}, - {{{1, 19}, {1, 11}}, {{19, 1}, {1, 3}, {8, 11}}}, - {{{1, 19}, {1, 10}}, {{19, 10}, {1, 5}, {8, 1}}}, - }, + static_shapes_to_test_representation({{3, 2}, {3, 10}}), + { + {{-1, -1}, + { + {19, 5}, + {1, 16}, + {8, 2}, + }}, + {{-1, -1}, {{19, 1}, {1, 3}, {8, 11}}}, + {{-1, -1}, {{19, 10}, {1, 5}, {8, 1}}}, + }, + { + {{{1, 19}, {2, 16}}, + { + {19, 5}, + {1, 16}, + {8, 2}, + }}, + {{{1, 19}, {1, 11}}, {{19, 1}, {1, 3}, {8, 11}}}, + {{{1, 19}, {1, 10}}, {{19, 10}, {1, 5}, {8, 1}}}, + }, }; -INSTANTIATE_TEST_SUITE_P(smoke_Concat_2D_axis1, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(1), - ::testing::ValuesIn(inputShapes2D_axis1), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat_2D_axis1, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(1), + ::testing::ValuesIn(inputShapes2D_axis1), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), + ConcatLayerCPUTest::getTestCaseName); const std::vector> inputShapes1D_static = { - static_shapes_to_test_representation({ov::Shape{5}, ov::Shape{5}}), - static_shapes_to_test_representation({ov::Shape{2}, ov::Shape{2}}), - static_shapes_to_test_representation({ov::Shape{1}, ov::Shape{1}}), - static_shapes_to_test_representation({ov::Shape{3}, ov::Shape{3}}) -}; + static_shapes_to_test_representation({ov::Shape{5}, ov::Shape{5}}), + static_shapes_to_test_representation({ov::Shape{2}, ov::Shape{2}}), + static_shapes_to_test_representation({ov::Shape{1}, ov::Shape{1}}), + static_shapes_to_test_representation({ov::Shape{3}, ov::Shape{3}})}; const std::vector> inputShapes1D_dynamic = { - { - {{-1}, {{19}, {8}, {5}}}, - {{-1}, {{19}, {8}, {5}}}, - {{-1}, {{19}, {8}, {5}}}, - }, - { - {{{1, 20}}, {{19}, {8}, {5}}}, - {{{1, 20}}, {{19}, {8}, {5}}}, - {{{1, 20}}, {{19}, {8}, {5}}}, - }, + { + {{-1}, {{19}, {8}, {5}}}, + {{-1}, {{19}, {8}, {5}}}, + {{-1}, {{19}, {8}, {5}}}, + }, + { + {{{1, 20}}, {{19}, {8}, {5}}}, + {{{1, 20}}, {{19}, {8}, {5}}}, + {{{1, 20}}, {{19}, {8}, {5}}}, + }, }; -INSTANTIATE_TEST_SUITE_P(smoke_Concat_1D_static, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(0), - ::testing::ValuesIn(inputShapes1D_static), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(CPUSpecificParams{{}, {}, {}, "unknown"})), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat_1D_static, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(0), + ::testing::ValuesIn(inputShapes1D_static), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "unknown"})), + ConcatLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_Concat_1D_dynamic, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(0), - ::testing::ValuesIn(inputShapes1D_dynamic), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat_1D_dynamic, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(0), + ::testing::ValuesIn(inputShapes1D_dynamic), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), + ConcatLayerCPUTest::getTestCaseName); // ============================================== inPlace cases ============================================ -INSTANTIATE_TEST_SUITE_P(concat_Concat4D_CPU_Block8inPlace, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(0, 1), - ::testing::Values(std::vector{ - {{}, {{1, 16, 5, 7}}}, - {{}, {{1, 16, 5, 7}}}, - {{}, {{1, 16, 5, 7}}}, - }, - std::vector{ - {{1, 16, -1, -1}, {{1, 16, 5, 7}, {1, 16, 16, 2}, {1, 16, 2, 8}}}, - {{1, 16, -1, -1}, {{1, 16, 5, 7}, {1, 16, 16, 2}, {1, 16, 2, 8}}}, - {{1, 16, -1, -1}, {{1, 16, 5, 7}, {1, 16, 16, 2}, {1, 16, 2, 8}}}, - }), - ::testing::Values(ElementType::f32), - ::testing::Values(planar_4D, blocked8_4D)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(concat_Concat4D_CPU_Block8inPlace, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(0, 1), + ::testing::Values( + std::vector{ + {{}, {{1, 16, 5, 7}}}, + {{}, {{1, 16, 5, 7}}}, + {{}, {{1, 16, 5, 7}}}, + }, + std::vector{ + {{1, 16, -1, -1}, {{1, 16, 5, 7}, {1, 16, 16, 2}, {1, 16, 2, 8}}}, + {{1, 16, -1, -1}, {{1, 16, 5, 7}, {1, 16, 16, 2}, {1, 16, 2, 8}}}, + {{1, 16, -1, -1}, {{1, 16, 5, 7}, {1, 16, 16, 2}, {1, 16, 2, 8}}}, + }), + ::testing::Values(ElementType::f32), + ::testing::Values(planar_4D, blocked8_4D)), + ConcatLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_Block16inPlace_0, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(0), - ::testing::Values(std::vector{ - {{}, {{1, 32, 5, 7}}}, - {{}, {{1, 32, 5, 7}}}, - {{}, {{1, 32, 5, 7}}}, - }, - std::vector{ - {{1, 32, -1, -1}, {{1, 32, 5, 7}, {1, 32, 16, 2}, {1, 32, 2, 8}}}, - {{1, 32, -1, -1}, {{1, 32, 5, 7}, {1, 32, 16, 2}, {1, 32, 2, 8}}}, - {{1, 32, -1, -1}, {{1, 32, 5, 7}, {1, 32, 16, 2}, {1, 32, 2, 8}}}, - }), - ::testing::Values(ElementType::f32), - ::testing::Values(blocked16_4D)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_Block16inPlace_0, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(0), + ::testing::Values( + std::vector{ + {{}, {{1, 32, 5, 7}}}, + {{}, {{1, 32, 5, 7}}}, + {{}, {{1, 32, 5, 7}}}, + }, + std::vector{ + {{1, 32, -1, -1}, {{1, 32, 5, 7}, {1, 32, 16, 2}, {1, 32, 2, 8}}}, + {{1, 32, -1, -1}, {{1, 32, 5, 7}, {1, 32, 16, 2}, {1, 32, 2, 8}}}, + {{1, 32, -1, -1}, {{1, 32, 5, 7}, {1, 32, 16, 2}, {1, 32, 2, 8}}}, + }), + ::testing::Values(ElementType::f32), + ::testing::Values(blocked16_4D)), + ConcatLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_Block16inPlace_1, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(1), - ::testing::Values(std::vector{ - {{}, {{1, 32, 5, 7}}}, - {{}, {{1, 16, 5, 7}}}, - {{}, {{1, 32, 5, 7}}}, - }, - std::vector{ - {{1, 32, -1, -1}, {{1, 32, 5, 7}, {1, 32, 16, 2}, {1, 32, 2, 8}}}, - {{1, 16, -1, -1}, {{1, 16, 5, 7}, {1, 16, 16, 2}, {1, 16, 2, 8}}}, - {{1, 32, -1, -1}, {{1, 32, 5, 7}, {1, 32, 16, 2}, {1, 32, 2, 8}}}, - }), - ::testing::Values(ElementType::f32), - ::testing::Values(blocked16_4D)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat4D_CPU_Block16inPlace_1, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(1), + ::testing::Values( + std::vector{ + {{}, {{1, 32, 5, 7}}}, + {{}, {{1, 16, 5, 7}}}, + {{}, {{1, 32, 5, 7}}}, + }, + std::vector{ + {{1, 32, -1, -1}, {{1, 32, 5, 7}, {1, 32, 16, 2}, {1, 32, 2, 8}}}, + {{1, 16, -1, -1}, {{1, 16, 5, 7}, {1, 16, 16, 2}, {1, 16, 2, 8}}}, + {{1, 32, -1, -1}, {{1, 32, 5, 7}, {1, 32, 16, 2}, {1, 32, 2, 8}}}, + }), + ::testing::Values(ElementType::f32), + ::testing::Values(blocked16_4D)), + ConcatLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(concat_Concat5D_CPU_Block8inPlace, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(0, 1), - ::testing::Values(std::vector{ - {{}, {{1, 16, 3, 5, 7}}}, - {{}, {{1, 16, 3, 5, 7}}}, - {{}, {{1, 16, 3, 5, 7}}}, - }, - std::vector{ - {{1, 32, -1, -1, -1}, {{1, 32, 5, 7, 3}, {1, 32, 16, 2, 3}, {1, 32, 2, 8, 3}}}, - {{1, 32, -1, -1, -1}, {{1, 32, 5, 7, 3}, {1, 32, 16, 2, 3}, {1, 32, 2, 8, 3}}}, - {{1, 32, -1, -1, -1}, {{1, 32, 5, 7, 3}, {1, 32, 16, 2, 3}, {1, 32, 2, 8, 3}}}, - }), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(planar_5D, blocked8_5D)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P( + concat_Concat5D_CPU_Block8inPlace, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(0, 1), + ::testing::Values( + std::vector{ + {{}, {{1, 16, 3, 5, 7}}}, + {{}, {{1, 16, 3, 5, 7}}}, + {{}, {{1, 16, 3, 5, 7}}}, + }, + std::vector{ + {{1, 32, -1, -1, -1}, {{1, 32, 5, 7, 3}, {1, 32, 16, 2, 3}, {1, 32, 2, 8, 3}}}, + {{1, 32, -1, -1, -1}, {{1, 32, 5, 7, 3}, {1, 32, 16, 2, 3}, {1, 32, 2, 8, 3}}}, + {{1, 32, -1, -1, -1}, {{1, 32, 5, 7, 3}, {1, 32, 16, 2, 3}, {1, 32, 2, 8, 3}}}, + }), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(planar_5D, blocked8_5D)), + ConcatLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_Concat5D_CPU_Block16inPlace, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(0, 1), - ::testing::Values(std::vector{ - {{}, {{1, 32, 3, 5, 7}}}, - {{}, {{1, 32, 3, 5, 7}}}, - {{}, {{1, 32, 3, 5, 7}}}, - }, - std::vector{ - {{1, 32, -1, -1, -1}, {{1, 32, 5, 7, 3}, {1, 32, 16, 2, 3}, {1, 32, 2, 8, 3}}}, - {{1, 32, -1, -1, -1}, {{1, 32, 5, 7, 3}, {1, 32, 16, 2, 3}, {1, 32, 2, 8, 3}}}, - {{1, 32, -1, -1, -1}, {{1, 32, 5, 7, 3}, {1, 32, 16, 2, 3}, {1, 32, 2, 8, 3}}}, - }), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(blocked16_5D)), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P( + smoke_Concat5D_CPU_Block16inPlace, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(0, 1), + ::testing::Values( + std::vector{ + {{}, {{1, 32, 3, 5, 7}}}, + {{}, {{1, 32, 3, 5, 7}}}, + {{}, {{1, 32, 3, 5, 7}}}, + }, + std::vector{ + {{1, 32, -1, -1, -1}, {{1, 32, 5, 7, 3}, {1, 32, 16, 2, 3}, {1, 32, 2, 8, 3}}}, + {{1, 32, -1, -1, -1}, {{1, 32, 5, 7, 3}, {1, 32, 16, 2, 3}, {1, 32, 2, 8, 3}}}, + {{1, 32, -1, -1, -1}, {{1, 32, 5, 7, 3}, {1, 32, 16, 2, 3}, {1, 32, 2, 8, 3}}}, + }), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(blocked16_5D)), + ConcatLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_Concat_inPlace, ConcatLayerCPUTest, - ::testing::Combine( - ::testing::Values(0, 1, 2, -1), - ::testing::ValuesIn(std::vector>{ - static_shapes_to_test_representation({{1, 1, 1, 10}, {1, 1, 1, 10}}), - static_shapes_to_test_representation({{1, 1, 5}, {1, 1, 5}})}), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(CPUSpecificParams{{}, {}, {}, "unknown"})), - ConcatLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_Concat_inPlace, + ConcatLayerCPUTest, + ::testing::Combine(::testing::Values(0, 1, 2, -1), + ::testing::ValuesIn(std::vector>{ + static_shapes_to_test_representation({{1, 1, 1, 10}, {1, 1, 1, 10}}), + static_shapes_to_test_representation({{1, 1, 5}, {1, 1, 5}})}), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "unknown"})), + ConcatLayerCPUTest::getTestCaseName); -} // namespace +} // namespace -} // namespace CPULayerTestsDefinitions +} // namespace test +} // namespace ov diff --git a/src/plugins/intel_cpu/tests/functional/single_layer_tests/convert_to_plugin_specific_node.cpp b/src/plugins/intel_cpu/tests/functional/single_layer_tests/convert_to_plugin_specific_node.cpp index 92e2e20e00a..e4c9658218c 100644 --- a/src/plugins/intel_cpu/tests/functional/single_layer_tests/convert_to_plugin_specific_node.cpp +++ b/src/plugins/intel_cpu/tests/functional/single_layer_tests/convert_to_plugin_specific_node.cpp @@ -2,35 +2,36 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "test_utils/cpu_test_utils.hpp" +#include "common_test_utils/node_builders/eltwise.hpp" #include "ov_models/builders.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "test_utils/cpu_test_utils.hpp" -using namespace ngraph; -using namespace InferenceEngine; using namespace CPUTestUtils; -namespace CPULayerTestsDefinitions { +namespace ov { +namespace test { -using ConvertToPluginSpecificNodeParams = std::tuple; // expected number of constant node +using ConvertToPluginSpecificNodeParams = std::tuple; // expected number of constant node class ConvertToPluginSpecificNode : public testing::WithParamInterface, - public LayerTestsUtils::LayerTestsCommon { + public SubgraphBaseStaticTest { public: static std::string getTestCaseName(testing::TestParamInfo obj) { - SizeVector nonConstShape, constShape; - Precision prc; - helpers::EltwiseTypes nodeType; + ov::Shape nonConstShape, constShape; + ov::element::Type prc; + ov::test::utils::EltwiseTypes nodeType; size_t port, constNodeNum; std::tie(nonConstShape, constShape, prc, nodeType, port, constNodeNum) = obj.param; std::ostringstream result; - result << "IS_NON_CONST=" << ov::test::utils::vec2str(nonConstShape) << "_"; - result << "IS_CONST=" << ov::test::utils::vec2str(constShape) << "_"; + result << "IS_NON_CONST=" << nonConstShape << "_"; + result << "IS_CONST=" << constShape << "_"; result << "PRC=" << prc << "_"; result << "NODE=" << nodeType << "_"; result << "PORT=" << port << "_"; @@ -45,39 +46,36 @@ protected: void SetUp() override { targetDevice = ov::test::utils::DEVICE_CPU; - SizeVector nonConstShape, constShape; - Precision prc; - helpers::EltwiseTypes nodeType; + ov::Shape nonConstShape, constShape; + ov::element::Type prc; + ov::test::utils::EltwiseTypes nodeType; size_t port; std::tie(nonConstShape, constShape, prc, nodeType, port, constNodeNum) = this->GetParam(); OPENVINO_ASSERT(shape_size(constShape) == 1); - const auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(prc); - const auto param = std::make_shared(ngPrc, ngraph::Shape(nonConstShape)); - const auto constNode = builder::makeConstant(ngPrc, ngraph::Shape(constShape), std::vector{}, true); + const auto param = std::make_shared(prc, ov::Shape(nonConstShape)); + const auto constNode = ngraph::builder::makeConstant(prc, constShape, std::vector{}, true); OutputVector inputs(2); inputs[port] = constNode; inputs[1 - port] = param; - auto powerStatic = ngraph::builder::makeEltwise(inputs[0], inputs[1], nodeType); + auto powerStatic = ov::test::utils::makeEltwise(inputs[0], inputs[1], nodeType); - function = std::make_shared(powerStatic, ParameterVector{param}, "ConvertToPluginSpecificNode"); + function = std::make_shared(powerStatic, ParameterVector{param}, "ConvertToPluginSpecificNode"); } }; TEST_P(ConvertToPluginSpecificNode, CompareWithRefs) { - Run(); - CheckNumberOfNodesWithType(executableNetwork, "Const", constNodeNum); + run(); + CheckNumberOfNodesWithType(compiledModel, "Const", constNodeNum); } namespace { -const std::vector> nonConstIS = { - {3, 4, 5, 6} -}; +const std::vector nonConstIS = {{3, 4, 5, 6}}; -const std::vector> constIS = { +const std::vector constIS = { {}, {1}, {1, 1}, @@ -85,34 +83,37 @@ const std::vector> constIS = { {1, 1, 1, 1}, }; -std::vector nodeTypes = { - ngraph::helpers::EltwiseTypes::ADD, - ngraph::helpers::EltwiseTypes::SUBTRACT, - ngraph::helpers::EltwiseTypes::MULTIPLY -}; +std::vector nodeTypes = {ov::test::utils::EltwiseTypes::ADD, + ov::test::utils::EltwiseTypes::SUBTRACT, + ov::test::utils::EltwiseTypes::MULTIPLY}; -const std::vector port = { - 0, 1 -}; +const std::vector port = {0, 1}; const auto testParamsEltwise = ::testing::Combine(::testing::ValuesIn(nonConstIS), ::testing::ValuesIn(constIS), - ::testing::Values(Precision::FP32), + ::testing::Values(ov::element::f32), ::testing::ValuesIn(nodeTypes), ::testing::ValuesIn(port), ::testing::Values(0)); -INSTANTIATE_TEST_SUITE_P(smoke_CheckEltwise, ConvertToPluginSpecificNode, testParamsEltwise, ConvertToPluginSpecificNode::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_CheckEltwise, + ConvertToPluginSpecificNode, + testParamsEltwise, + ConvertToPluginSpecificNode::getTestCaseName); const auto testParamsPower = ::testing::Combine(::testing::ValuesIn(nonConstIS), ::testing::ValuesIn(constIS), - ::testing::Values(Precision::FP32), - ::testing::Values(ngraph::helpers::EltwiseTypes::POWER), + ::testing::Values(ov::element::f32), + ::testing::Values(ov::test::utils::EltwiseTypes::POWER), ::testing::Values(1), ::testing::Values(0)); -INSTANTIATE_TEST_SUITE_P(smoke_CheckPower, ConvertToPluginSpecificNode, testParamsPower, ConvertToPluginSpecificNode::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_CheckPower, + ConvertToPluginSpecificNode, + testParamsPower, + ConvertToPluginSpecificNode::getTestCaseName); -} // namespace +} // namespace -} // namespace CPULayerTestsDefinitions +} // namespace test +} // namespace ov