diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/space_to_batch.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/space_to_batch.cpp index e5b37defab7..a661149078d 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/space_to_batch.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/space_to_batch.cpp @@ -4,71 +4,65 @@ #include -#include "single_layer_tests/space_to_batch.hpp" +#include "single_op_tests/space_to_batch.hpp" #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; +using ov::test::SpaceToBatchLayerTest; namespace { -const std::vector> blockShapes4D { +const std::vector> block_shapes_4D { {1, 1, 2, 2} }; -const std::vector> padsBegins4D { +const std::vector> pads_begins_4D { {0, 0, 0, 0}, {0, 0, 0, 2} }; -const std::vector> padsEnds4D { +const std::vector> pads_ends_4D { {0, 0, 0, 0}, {0, 0, 0, 2} }; -const std::vector> dataShapes4D { - {1, 1, 2, 2}, {1, 3, 2, 2}, {1, 1, 4, 4}, {2, 1, 2, 4} -}; +const auto data_shapes_4D = ov::test::static_shapes_to_test_representation( + std::vector>{ + {{1, 1, 2, 2}}, {{1, 3, 2, 2}}, {{1, 1, 4, 4}}, {{2, 1, 2, 4}} +}); -const auto SpaceToBatch4D = ::testing::Combine( - ::testing::ValuesIn(blockShapes4D), - ::testing::ValuesIn(padsBegins4D), - ::testing::ValuesIn(padsEnds4D), - ::testing::ValuesIn(dataShapes4D), - ::testing::Values(InferenceEngine::Precision::FP32), - ::testing::Values(InferenceEngine::Precision::FP32), - ::testing::Values(InferenceEngine::Precision::FP32), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), +const auto space_to_batch_4D = ::testing::Combine( + ::testing::ValuesIn(block_shapes_4D), + ::testing::ValuesIn(pads_begins_4D), + ::testing::ValuesIn(pads_ends_4D), + ::testing::ValuesIn(data_shapes_4D), + ::testing::Values(ov::element::f32), ::testing::Values(ov::test::utils::DEVICE_CPU) ); INSTANTIATE_TEST_SUITE_P( - smoke_spacetobatch4D, SpaceToBatchLayerTest, SpaceToBatch4D, + smoke_spacetobatch4D, SpaceToBatchLayerTest, space_to_batch_4D, SpaceToBatchLayerTest::getTestCaseName); -const std::vector> blockShapes5D { +const std::vector> block_shapes_5D { {1, 1, 3, 2, 2} }; -const std::vector> padsBegins5D { +const std::vector> pads_begins_5D { {0, 0, 1, 0, 3} }; -const std::vector> padsEnds5D { +const std::vector> pads_ends_5D { {0, 0, 2, 0, 0} }; -const std::vector> dataShapes5D { - {1, 1, 3, 2, 1} -}; +const auto data_shapes_5D = ov::test::static_shapes_to_test_representation( + std::vector>{ + {{1, 1, 3, 2, 1}} +}); -const auto SpaceToBatch5D = ::testing::Combine( - ::testing::ValuesIn(blockShapes5D), - ::testing::ValuesIn(padsBegins5D), - ::testing::ValuesIn(padsEnds5D), - ::testing::ValuesIn(dataShapes5D), - ::testing::Values(InferenceEngine::Precision::FP32), - ::testing::Values(InferenceEngine::Precision::FP32), - ::testing::Values(InferenceEngine::Precision::FP32), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), +const auto space_to_batch_5D = ::testing::Combine( + ::testing::ValuesIn(block_shapes_5D), + ::testing::ValuesIn(pads_begins_5D), + ::testing::ValuesIn(pads_ends_5D), + ::testing::ValuesIn(data_shapes_5D), + ::testing::Values(ov::element::f32), ::testing::Values(ov::test::utils::DEVICE_CPU) ); INSTANTIATE_TEST_SUITE_P( - smoke_spacetobatch5D, SpaceToBatchLayerTest, SpaceToBatch5D, + smoke_spacetobatch5D, SpaceToBatchLayerTest, space_to_batch_5D, SpaceToBatchLayerTest::getTestCaseName); } // namespace diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/space_to_depth.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/space_to_depth.cpp index e7f280baece..655d1b0a164 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/space_to_depth.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/space_to_depth.cpp @@ -3,54 +3,52 @@ // #include -#include -#include "single_layer_tests/space_to_depth.hpp" +#include "single_op_tests/space_to_depth.hpp" #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; -using namespace ngraph::opset3; +using ov::test::SpaceToDepthLayerTest; namespace { -const std::vector inputPrecisions = { - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::U8, - InferenceEngine::Precision::I16, +const std::vector model_types = { + ov::element::f32, + ov::element::u8, + ov::element::i16, }; -const std::vector modes = { - SpaceToDepth::SpaceToDepthMode::BLOCKS_FIRST, - SpaceToDepth::SpaceToDepthMode::DEPTH_FIRST +const std::vector modes = { + ov::op::v0::SpaceToDepth::SpaceToDepthMode::BLOCKS_FIRST, + ov::op::v0::SpaceToDepth::SpaceToDepthMode::DEPTH_FIRST }; -const std::vector> inputShapesBS2 = { - {1, 1, 2, 2}, {1, 1, 4, 4}, {1, 1, 6, 6}, {2, 8, 6, 6}, {2, 4, 10, 8}, - {1, 1, 2, 2, 2}, {1, 1, 4, 4, 4}, {1, 1, 6, 6, 6}, {2, 8, 6, 6, 6}, {2, 4, 10, 8, 12} -}; +const auto input_shapes_BS2 = ov::test::static_shapes_to_test_representation(std::vector>{ + {{1, 1, 2, 2}}, {{1, 1, 4, 4}}, {{1, 1, 6, 6}}, {{2, 8, 6, 6}}, {{2, 4, 10, 8}}, + {{1, 1, 2, 2, 2}}, {{1, 1, 4, 4, 4}}, {{1, 1, 6, 6, 6}}, {{2, 8, 6, 6, 6}}, {{2, 4, 10, 8, 12}} +}); -const auto SpaceToDepthBS2 = ::testing::Combine( - ::testing::ValuesIn(inputShapesBS2), - ::testing::ValuesIn(inputPrecisions), +const auto space_to_depth_BS2 = ::testing::Combine( + ::testing::ValuesIn(input_shapes_BS2), + ::testing::ValuesIn(model_types), ::testing::ValuesIn(modes), ::testing::Values(1, 2), ::testing::Values(ov::test::utils::DEVICE_CPU) ); -INSTANTIATE_TEST_SUITE_P(smoke_SpaceToDepthBS2, SpaceToDepthLayerTest, SpaceToDepthBS2, SpaceToDepthLayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_SpaceToDepthBS2, SpaceToDepthLayerTest, space_to_depth_BS2, SpaceToDepthLayerTest::getTestCaseName); -const std::vector> inputShapesBS3 = { - {1, 1, 3, 3}, {1, 1, 6, 6}, {1, 1, 9, 9}, {2, 4, 9, 9}, {2, 3, 15, 12}, - {1, 1, 3, 3, 3}, {1, 1, 6, 6, 6}, {1, 1, 9, 9, 9}, {2, 4, 9, 9, 9}, {2, 3, 15, 12, 18} -}; +const auto input_shapes_BS3 = ov::test::static_shapes_to_test_representation(std::vector>{ + {{1, 1, 3, 3}}, {{1, 1, 6, 6}}, {{1, 1, 9, 9}}, {{2, 4, 9, 9}}, {{2, 3, 15, 12}}, + {{1, 1, 3, 3, 3}}, {{1, 1, 6, 6, 6}}, {{1, 1, 9, 9, 9}}, {{2, 4, 9, 9, 9}}, {{2, 3, 15, 12, 18}} +}); -const auto SpaceToDepthBS3 = ::testing::Combine( - ::testing::ValuesIn(inputShapesBS3), - ::testing::ValuesIn(inputPrecisions), +const auto space_to_depth_BS3 = ::testing::Combine( + ::testing::ValuesIn(input_shapes_BS3), + ::testing::ValuesIn(model_types), ::testing::ValuesIn(modes), ::testing::Values(1, 3), ::testing::Values(ov::test::utils::DEVICE_CPU) ); -INSTANTIATE_TEST_SUITE_P(smoke_SpaceToDepthBS3, SpaceToDepthLayerTest, SpaceToDepthBS3, SpaceToDepthLayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_SpaceToDepthBS3, SpaceToDepthLayerTest, space_to_depth_BS3, SpaceToDepthLayerTest::getTestCaseName); } // namespace diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/split.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/split.cpp index 2c949242067..b855eb73f8c 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/split.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/split.cpp @@ -4,30 +4,26 @@ #include -#include "single_layer_tests/split.hpp" +#include "single_op_tests/split.hpp" #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; +using ov::test::SplitLayerTest; namespace { -const std::vector netPrecisions = { - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::FP16, - InferenceEngine::Precision::I32, - InferenceEngine::Precision::U8 +const std::vector model_types = { + ov::element::f32, + ov::element::f16, + ov::element::i32, + ov::element::u8 }; INSTANTIATE_TEST_SUITE_P(smoke_NumSplitsCheck, SplitLayerTest, ::testing::Combine( ::testing::Values(1, 2, 3, 5), ::testing::Values(0, 1, 2, 3), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(std::vector({30, 30, 30, 30})), + ::testing::ValuesIn(model_types), + ::testing::Values(ov::test::static_shapes_to_test_representation({{30, 30, 30, 30}})), ::testing::Values(std::vector({})), ::testing::Values(ov::test::utils::DEVICE_CPU)), SplitLayerTest::getTestCaseName); @@ -36,12 +32,8 @@ INSTANTIATE_TEST_SUITE_P(smoke_splitWithUnusedOutputsTest, SplitLayerTest, ::testing::Combine( ::testing::Values(5), ::testing::Values(0), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(std::vector({30, 30, 30, 30})), + ::testing::ValuesIn(model_types), + ::testing::Values(ov::test::static_shapes_to_test_representation({{30, 30, 30, 30}})), ::testing::Values(std::vector({0, 3})), ::testing::Values(ov::test::utils::DEVICE_CPU)), SplitLayerTest::getTestCaseName); diff --git a/src/tests/functional/plugin/shared/include/single_op_tests/space_to_batch.hpp b/src/tests/functional/plugin/shared/include/single_op_tests/space_to_batch.hpp new file mode 100644 index 00000000000..074ce3be677 --- /dev/null +++ b/src/tests/functional/plugin/shared/include/single_op_tests/space_to_batch.hpp @@ -0,0 +1,15 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "shared_test_classes/single_op/space_to_batch.hpp" + +namespace ov { +namespace test { +TEST_P(SpaceToBatchLayerTest, Inference) { + run(); +} +} // namespace test +} // namespace ov diff --git a/src/tests/functional/plugin/shared/include/single_op_tests/space_to_depth.hpp b/src/tests/functional/plugin/shared/include/single_op_tests/space_to_depth.hpp new file mode 100644 index 00000000000..2ceabfcb076 --- /dev/null +++ b/src/tests/functional/plugin/shared/include/single_op_tests/space_to_depth.hpp @@ -0,0 +1,15 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "shared_test_classes/single_op/space_to_depth.hpp" + +namespace ov { +namespace test { +TEST_P(SpaceToDepthLayerTest, Inference) { + run(); +}; +} // namespace test +} // namespace ov diff --git a/src/tests/functional/plugin/shared/include/single_op_tests/split.hpp b/src/tests/functional/plugin/shared/include/single_op_tests/split.hpp new file mode 100644 index 00000000000..cc8f862fc14 --- /dev/null +++ b/src/tests/functional/plugin/shared/include/single_op_tests/split.hpp @@ -0,0 +1,15 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "shared_test_classes/single_op/split.hpp" + +namespace ov { +namespace test { +TEST_P(SplitLayerTest, Inference) { + run(); +}; +} // namespace test +} // namespace ov diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/space_to_batch.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/space_to_batch.hpp new file mode 100644 index 00000000000..0e2af06c3f9 --- /dev/null +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/space_to_batch.hpp @@ -0,0 +1,33 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include +#include +#include + +#include "shared_test_classes/base/ov_subgraph.hpp" + +namespace ov { +namespace test { +using spaceToBatchParamsTuple = typename std::tuple< + std::vector, // block_shape + std::vector, // pads_begin + std::vector, // pads_end + std::vector, // Input shapes + ov::element::Type, // Model type + std::string>; // Device name + +class SpaceToBatchLayerTest : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseTest { +public: + static std::string getTestCaseName(const testing::TestParamInfo &obj); + +protected: + void SetUp() override; +}; +} // namespace test +} // namespace ov diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/space_to_depth.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/space_to_depth.hpp new file mode 100644 index 00000000000..170c0c5d5f6 --- /dev/null +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/space_to_depth.hpp @@ -0,0 +1,32 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include +#include +#include + +#include "shared_test_classes/base/ov_subgraph.hpp" + +namespace ov { +namespace test { +using spaceToDepthParamsTuple = typename std::tuple< + std::vector, // Input shape + ov::element::Type, // Model type + ov::op::v0::SpaceToDepth::SpaceToDepthMode, // Mode + std::size_t, // Block size + std::string>; // Device name + +class SpaceToDepthLayerTest : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseTest { +public: + static std::string getTestCaseName(const testing::TestParamInfo &obj); + +protected: + void SetUp() override; +}; +} // namespace test +} // namespace ov diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/split.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/split.hpp new file mode 100644 index 00000000000..a7cb1495a34 --- /dev/null +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/split.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include +#include +#include + +#include "shared_test_classes/base/ov_subgraph.hpp" + +namespace ov { +namespace test { +typedef std::tuple< + size_t, // Num splits + int64_t, // Axis + ov::element::Type, // Model type + std::vector, // Input shapes + std::vector, // Used outputs indices + std::string // Target device name +> splitParams; + +class SplitLayerTest : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseTest { +public: + static std::string getTestCaseName(const testing::TestParamInfo& obj); + +protected: + void SetUp() override; +}; +} // namespace test +} // namespace ov diff --git a/src/tests/functional/shared_test_classes/src/single_op/space_to_batch.cpp b/src/tests/functional/shared_test_classes/src/single_op/space_to_batch.cpp new file mode 100644 index 00000000000..16c0c5871d6 --- /dev/null +++ b/src/tests/functional/shared_test_classes/src/single_op/space_to_batch.cpp @@ -0,0 +1,59 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "shared_test_classes/single_op/space_to_batch.hpp" + +namespace ov { +namespace test { +std::string SpaceToBatchLayerTest::getTestCaseName(const testing::TestParamInfo &obj) { + std::vector input_shapes; + std::vector block_shapes, pads_begin, pads_end; + ov::element::Type model_type; + std::string target_device; + std::tie(block_shapes, pads_begin, pads_end, input_shapes, model_type, target_device) = obj.param; + std::ostringstream result; + result << "IS=("; + for (size_t i = 0lu; i < input_shapes.size(); i++) { + result << ov::test::utils::partialShape2str({input_shapes[i].first}) + << (i < input_shapes.size() - 1lu ? "_" : ""); + } + result << ")_TS="; + for (size_t i = 0lu; i < input_shapes.front().second.size(); i++) { + result << "{"; + for (size_t j = 0lu; j < input_shapes.size(); j++) { + result << ov::test::utils::vec2str(input_shapes[j].second[i]) << (j < input_shapes.size() - 1lu ? "_" : ""); + } + result << "}_"; + } + result << "modelType=" << model_type.to_string() << "_"; + result << "BS=" << ov::test::utils::vec2str(block_shapes) << "_"; + result << "PB=" << ov::test::utils::vec2str(pads_begin) << "_"; + result << "PE=" << ov::test::utils::vec2str(pads_end) << "_"; + result << "trgDev=" << target_device; + return result.str(); +} + +void SpaceToBatchLayerTest::SetUp() { + std::vector input_shapes; + std::vector block_shapes, pads_begin, pads_end; + ov::element::Type model_type; + std::tie(block_shapes, pads_begin, pads_end, input_shapes, model_type, targetDevice) = this->GetParam(); + + init_input_shapes(input_shapes); + + auto param = std::make_shared(model_type, inputDynamicShapes.front()); + ov::Shape const_shape = {param->get_partial_shape().size()}; + + ASSERT_EQ(shape_size(const_shape), block_shapes.size()); + ASSERT_EQ(shape_size(const_shape), pads_begin.size()); + ASSERT_EQ(shape_size(const_shape), pads_end.size()); + + auto block_shapes_node = std::make_shared(ov::element::i64, const_shape, block_shapes.data()); + auto pads_begin_node = std::make_shared(ov::element::i64, const_shape, pads_begin.data()); + auto pads_end_node = std::make_shared(ov::element::i64, const_shape, pads_end.data()); + auto s2b = std::make_shared(param, block_shapes_node, pads_begin_node, pads_end_node); + function = std::make_shared(s2b->outputs(), ov::ParameterVector{param}, "SpaceToBatch"); +} +} // namespace test +} // namespace ov diff --git a/src/tests/functional/shared_test_classes/src/single_op/space_to_depth.cpp b/src/tests/functional/shared_test_classes/src/single_op/space_to_depth.cpp new file mode 100644 index 00000000000..328ae13f99b --- /dev/null +++ b/src/tests/functional/shared_test_classes/src/single_op/space_to_depth.cpp @@ -0,0 +1,67 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "shared_test_classes/single_op/space_to_depth.hpp" + +namespace ov { +namespace test { + +using ov::op::v0::SpaceToDepth; + +static inline std::string SpaceToDepthModeToString(const SpaceToDepth::SpaceToDepthMode& mode) { + static std::map names = { + {SpaceToDepth::SpaceToDepthMode::BLOCKS_FIRST, "BLOCKS_FIRST"}, + {SpaceToDepth::SpaceToDepthMode::DEPTH_FIRST, "DEPTH_FIRST"}, + }; + + auto i = names.find(mode); + if (i != names.end()) + return i->second; + else + throw std::runtime_error("Unsupported SpaceToDepthMode"); +} + +std::string SpaceToDepthLayerTest::getTestCaseName(const testing::TestParamInfo &obj) { + std::vector input_shapes; + SpaceToDepth::SpaceToDepthMode mode; + std::size_t block_size; + ov::element::Type model_type; + std::string target_device; + std::tie(input_shapes, model_type, mode, block_size, target_device) = obj.param; + std::ostringstream result; + result << "IS=("; + for (size_t i = 0lu; i < input_shapes.size(); i++) { + result << ov::test::utils::partialShape2str({input_shapes[i].first}) + << (i < input_shapes.size() - 1lu ? "_" : ""); + } + result << ")_TS="; + for (size_t i = 0lu; i < input_shapes.front().second.size(); i++) { + result << "{"; + for (size_t j = 0lu; j < input_shapes.size(); j++) { + result << ov::test::utils::vec2str(input_shapes[j].second[i]) << (j < input_shapes.size() - 1lu ? "_" : ""); + } + result << "}_"; + } + result << "modelType=" << model_type.to_string() << "_"; + result << "M=" << SpaceToDepthModeToString(mode) << "_"; + result << "BS=" << block_size << "_"; + result << "targetDevice=" << target_device << "_"; + return result.str(); +} + +void SpaceToDepthLayerTest::SetUp() { + std::vector input_shapes; + SpaceToDepth::SpaceToDepthMode mode; + std::size_t block_size; + ov::element::Type model_type; + std::tie(input_shapes, model_type, mode, block_size, targetDevice) = this->GetParam(); + + init_input_shapes(input_shapes); + + auto param = std::make_shared(model_type, inputDynamicShapes.front()); + auto s2d = std::make_shared(param, mode, block_size); + function = std::make_shared(s2d->outputs(), ov::ParameterVector{param}, "SpaceToDepth"); +} +} // namespace test +} // namespace ov diff --git a/src/tests/functional/shared_test_classes/src/single_op/split.cpp b/src/tests/functional/shared_test_classes/src/single_op/split.cpp new file mode 100644 index 00000000000..fa4a3b83ab0 --- /dev/null +++ b/src/tests/functional/shared_test_classes/src/single_op/split.cpp @@ -0,0 +1,62 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "shared_test_classes/single_op/split.hpp" + +namespace ov { +namespace test { +std::string SplitLayerTest::getTestCaseName(const testing::TestParamInfo& obj) { + size_t num_splits; + int64_t axis; + ov::element::Type model_type; + std::vector out_indices; + std::vector input_shapes; + std::string target_device; + std::tie(num_splits, axis, model_type, input_shapes, out_indices, target_device) = obj.param; + std::ostringstream result; + result << "IS=("; + for (size_t i = 0lu; i < input_shapes.size(); i++) { + result << ov::test::utils::partialShape2str({input_shapes[i].first}) + << (i < input_shapes.size() - 1lu ? "_" : ""); + } + result << ")_TS="; + for (size_t i = 0lu; i < input_shapes.front().second.size(); i++) { + result << "{"; + for (size_t j = 0lu; j < input_shapes.size(); j++) { + result << ov::test::utils::vec2str(input_shapes[j].second[i]) << (j < input_shapes.size() - 1lu ? "_" : ""); + } + result << "}_"; + } + result << "numSplits=" << num_splits << "_"; + result << "axis=" << axis << "_"; + if (!out_indices.empty()) { + result << "outIndices" << ov::test::utils::vec2str(out_indices) << "_"; + } + result << "IS"; + result << "modelType=" << model_type.to_string() << "_"; + result << "trgDev=" << target_device; + return result.str(); +} + +void SplitLayerTest::SetUp() { + size_t num_splits; + int64_t axis; + ov::element::Type model_type; + std::vector out_indices; + std::vector input_shapes; + std::tie(num_splits, axis, model_type, input_shapes, out_indices, targetDevice) = this->GetParam(); + if (out_indices.empty()) { + for (int i = 0; i < num_splits; ++i) + out_indices.push_back(i); + } + init_input_shapes(input_shapes); + + auto param = std::make_shared(model_type, inputDynamicShapes.front()); + auto split_axis_op = + std::make_shared(ov::element::Type_t::i64, ov::Shape{}, std::vector{axis}); + auto splitNode = std::make_shared(param, split_axis_op, num_splits); + function = std::make_shared(splitNode->outputs(), ov::ParameterVector{param}, "Split"); +} +} // namespace test +} // namespace ov