From e5acf880ada3edc25c0046e824b5a323568f1886 Mon Sep 17 00:00:00 2001 From: Vitaliy Urusovskij Date: Thu, 21 Sep 2023 16:36:26 +0400 Subject: [PATCH] `Slice8`, `ShuffleChannels`, `ShapeOf` layer tests to API2.0 (#19975) * `Slice8LayerTest` to API2.0 * `ShuffleChannelsLayerTest` to API2.0 * `ShapeOfLayerTest` to API2.0 --- .../single_layer_tests/shape_of.cpp | 16 ++--- .../single_layer_tests/shuffle_channels.cpp | 64 ++++++------------- .../single_layer_tests/slice.cpp | 61 +++++++----------- .../include/single_op_tests/shape_of.hpp | 15 +++++ .../single_op_tests/shuffle_channels.hpp | 15 +++++ .../shared/include/single_op_tests/slice.hpp | 15 +++++ .../single_op/shape_of.hpp | 32 ++++++++++ .../single_op/shuffle_channels.hpp | 38 +++++++++++ .../shared_test_classes/single_op/slice.hpp | 40 ++++++++++++ .../src/single_op/shape_of.cpp | 46 +++++++++++++ .../src/single_op/shuffle_channels.cpp | 55 ++++++++++++++++ .../src/single_op/slice.cpp | 64 +++++++++++++++++++ 12 files changed, 371 insertions(+), 90 deletions(-) create mode 100644 src/tests/functional/plugin/shared/include/single_op_tests/shape_of.hpp create mode 100644 src/tests/functional/plugin/shared/include/single_op_tests/shuffle_channels.hpp create mode 100644 src/tests/functional/plugin/shared/include/single_op_tests/slice.hpp create mode 100644 src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/shape_of.hpp create mode 100644 src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/shuffle_channels.hpp create mode 100644 src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/slice.hpp create mode 100644 src/tests/functional/shared_test_classes/src/single_op/shape_of.cpp create mode 100644 src/tests/functional/shared_test_classes/src/single_op/shuffle_channels.cpp create mode 100644 src/tests/functional/shared_test_classes/src/single_op/slice.cpp diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/shape_of.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/shape_of.cpp index 7f4653dd954..0e9a8e218be 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/shape_of.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/shape_of.cpp @@ -4,22 +4,22 @@ #include -#include "single_layer_tests/shape_of.hpp" +#include "single_op_tests/shape_of.hpp" #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; +using ov::test::ShapeOfLayerTest; namespace { - const std::vector netPrecisions = { - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::I32 + const std::vector model_types = { + ov::element::f32, + ov::element::i32 }; INSTANTIATE_TEST_SUITE_P(smoke_Check, ShapeOfLayerTest, ::testing::Combine( - ::testing::ValuesIn(netPrecisions), - ::testing::Values(InferenceEngine::Precision::I64), - ::testing::Values(std::vector({10, 10, 10})), + ::testing::ValuesIn(model_types), + ::testing::Values(ov::element::i64), + ::testing::Values(ov::test::static_shapes_to_test_representation({{10, 10, 10}})), ::testing::Values(ov::test::utils::DEVICE_CPU)), ShapeOfLayerTest::getTestCaseName); } // namespace diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/shuffle_channels.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/shuffle_channels.cpp index 5aa51ab1487..7d5b606e3ab 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/shuffle_channels.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/shuffle_channels.cpp @@ -4,35 +4,31 @@ #include -#include "single_layer_tests/shuffle_channels.hpp" +#include "single_op_tests/shuffle_channels.hpp" -using namespace LayerTestsDefinitions; +using ov::test::ShuffleChannelsLayerTest; namespace { -const std::vector netPrecisions = { - InferenceEngine::Precision::U8, - InferenceEngine::Precision::U16, - InferenceEngine::Precision::FP32 +const std::vector model_types = { + ov::element::u8, + ov::element::u16, + ov::element::f32 }; const std::vector axes = {-4, -3, -2, -1, 0, 1, 2, 3}; const std::vector groups = {1, 2, 3, 6}; -const auto shuffleChannelsParams4D = ::testing::Combine( +const auto shuffle_channels_params_4D = ::testing::Combine( ::testing::ValuesIn(axes), ::testing::ValuesIn(groups) ); INSTANTIATE_TEST_SUITE_P(smoke_ShuffleChannels4D, ShuffleChannelsLayerTest, ::testing::Combine( - shuffleChannelsParams4D, - ::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({12, 18, 30, 36})), + shuffle_channels_params_4D, + ::testing::ValuesIn(model_types), + ::testing::Values(ov::test::static_shapes_to_test_representation({{12, 18, 30, 36}})), ::testing::Values(ov::test::utils::DEVICE_CPU)), ShuffleChannelsLayerTest::getTestCaseName); @@ -40,60 +36,40 @@ INSTANTIATE_TEST_SUITE_P(smoke_ShuffleChannels4D, ShuffleChannelsLayerTest, INSTANTIATE_TEST_SUITE_P(smoke_ShuffleChannels6D, ShuffleChannelsLayerTest, ::testing::Combine( ::testing::Values(std::tuple(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({24, 6, 12, 18, 30, 36})), + ::testing::ValuesIn(model_types), + ::testing::Values(ov::test::static_shapes_to_test_representation({{24, 6, 12, 18, 30, 36}})), ::testing::Values(ov::test::utils::DEVICE_CPU)), ShuffleChannelsLayerTest::getTestCaseName); INSTANTIATE_TEST_SUITE_P(smoke_ShuffleChannels5D, ShuffleChannelsLayerTest, ::testing::Combine( ::testing::Values(std::tuple(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({6, 12, 18, 30, 36})), + ::testing::ValuesIn(model_types), + ::testing::Values(ov::test::static_shapes_to_test_representation({{6, 12, 18, 30, 36}})), ::testing::Values(ov::test::utils::DEVICE_CPU)), ShuffleChannelsLayerTest::getTestCaseName); INSTANTIATE_TEST_SUITE_P(smoke_ShuffleChannels3D, ShuffleChannelsLayerTest, ::testing::Combine( ::testing::Values(std::tuple(1, 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({18, 30, 36})), + ::testing::ValuesIn(model_types), + ::testing::Values(ov::test::static_shapes_to_test_representation({{18, 30, 36}})), ::testing::Values(ov::test::utils::DEVICE_CPU)), ShuffleChannelsLayerTest::getTestCaseName); INSTANTIATE_TEST_SUITE_P(smoke_ShuffleChannels2D, ShuffleChannelsLayerTest, ::testing::Combine( ::testing::Values(std::tuple(1, 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({18, 30})), + ::testing::ValuesIn(model_types), + ::testing::Values(ov::test::static_shapes_to_test_representation({{18, 30}})), ::testing::Values(ov::test::utils::DEVICE_CPU)), ShuffleChannelsLayerTest::getTestCaseName); INSTANTIATE_TEST_SUITE_P(smoke_ShuffleChannels1D, ShuffleChannelsLayerTest, ::testing::Combine( ::testing::Values(std::tuple(0, 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})), + ::testing::ValuesIn(model_types), + ::testing::Values(ov::test::static_shapes_to_test_representation({ov::Shape{30}})), ::testing::Values(ov::test::utils::DEVICE_CPU)), ShuffleChannelsLayerTest::getTestCaseName); diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/slice.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/slice.cpp index 4b7b01f9da4..440e57c16d0 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/slice.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/slice.cpp @@ -4,28 +4,28 @@ #include -#include "single_layer_tests/slice.hpp" +#include "single_op_tests/slice.hpp" #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; -using namespace ov::test; +using ov::test::Slice8LayerTest; +using ov::test::Slice8SpecificParams; namespace { -const std::vector inputPrecisions = { - ElementType::f32, - ElementType::bf16, - ElementType::i8 +const std::vector model_types = { + ov::element::f32, + ov::element::bf16, + ov::element::i8 }; -const std::vector inputPrecisionsOther = { - ElementType::i64, - ElementType::i32, - ElementType::i16, - ElementType::u8 +const std::vector model_types_extra = { + ov::element::i64, + ov::element::i32, + ov::element::i16, + ov::element::u8 }; -std::vector staticParams = { +std::vector static_params = { Slice8SpecificParams{ {{{}, {{ 16 }}}}, { 4 }, { 12 }, { 1 }, { 0 } }, Slice8SpecificParams{ {{{}, {{ 16 }}}}, { 0 }, { 8 }, { 2 }, { 0 } }, Slice8SpecificParams{ {{{}, {{ 20, 10, 5 }}}}, { 0, 0}, { 10, 20}, { 1, 1 }, { 1, 0 } }, @@ -68,30 +68,20 @@ std::vector staticParams = { INSTANTIATE_TEST_SUITE_P(smoke_Static, Slice8LayerTest, ::testing::Combine( - ::testing::ValuesIn(staticParams), - ::testing::ValuesIn(inputPrecisions), - ::testing::Values(ElementType::undefined), - ::testing::Values(ElementType::undefined), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(ov::test::utils::DEVICE_CPU), - ::testing::Values(std::map())), + ::testing::ValuesIn(static_params), + ::testing::ValuesIn(model_types), + ::testing::Values(ov::test::utils::DEVICE_CPU)), Slice8LayerTest::getTestCaseName); INSTANTIATE_TEST_SUITE_P(smoke_PrecisionTransformation, Slice8LayerTest, ::testing::Combine( - ::testing::Values(staticParams[0]), - ::testing::ValuesIn(inputPrecisionsOther), - ::testing::Values(ElementType::undefined), - ::testing::Values(ElementType::undefined), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(ov::test::utils::DEVICE_CPU), - ::testing::Values(std::map())), + ::testing::Values(static_params[0]), + ::testing::ValuesIn(model_types_extra), + ::testing::Values(ov::test::utils::DEVICE_CPU)), Slice8LayerTest::getTestCaseName); -std::vector dynamicParams = { +std::vector dynamic_params = { Slice8SpecificParams{ {{{ -1 }, {{ 8 }, { 16 }}}}, { 4 }, { 12 }, { 1 }, { 0 } }, Slice8SpecificParams{ {{{ ov::Dimension(2, 20) }, {{ 5 }, { 15 }}}}, { 0 }, { 8 }, { 2 }, { 0 } }, Slice8SpecificParams{ {{{ -1, -1, -1 }, {{ 20, 10, 5 }, {5, 10, 20}}}}, { 0, 0}, { 10, 20}, { 1, 1 }, { 1, 0 } }, @@ -115,13 +105,8 @@ std::vector dynamicParams = { INSTANTIATE_TEST_SUITE_P(smoke_Dynamic, Slice8LayerTest, ::testing::Combine( - ::testing::ValuesIn(dynamicParams), - ::testing::ValuesIn(inputPrecisions), - ::testing::Values(ElementType::undefined), - ::testing::Values(ElementType::undefined), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(ov::test::utils::DEVICE_CPU), - ::testing::Values(std::map())), + ::testing::ValuesIn(dynamic_params), + ::testing::ValuesIn(model_types), + ::testing::Values(ov::test::utils::DEVICE_CPU)), Slice8LayerTest::getTestCaseName); } // namespace diff --git a/src/tests/functional/plugin/shared/include/single_op_tests/shape_of.hpp b/src/tests/functional/plugin/shared/include/single_op_tests/shape_of.hpp new file mode 100644 index 00000000000..50b9a388e9b --- /dev/null +++ b/src/tests/functional/plugin/shared/include/single_op_tests/shape_of.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/shape_of.hpp" + +namespace ov { +namespace test { +TEST_P(ShapeOfLayerTest, Inference) { + run(); +} +} // namespace test +} // namespace ov diff --git a/src/tests/functional/plugin/shared/include/single_op_tests/shuffle_channels.hpp b/src/tests/functional/plugin/shared/include/single_op_tests/shuffle_channels.hpp new file mode 100644 index 00000000000..10d0af958f3 --- /dev/null +++ b/src/tests/functional/plugin/shared/include/single_op_tests/shuffle_channels.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/shuffle_channels.hpp" + +namespace ov { +namespace test { +TEST_P(ShuffleChannelsLayerTest, Inference) { + run(); +} +} // namespace test +} // namespace ov diff --git a/src/tests/functional/plugin/shared/include/single_op_tests/slice.hpp b/src/tests/functional/plugin/shared/include/single_op_tests/slice.hpp new file mode 100644 index 00000000000..b452ce192fa --- /dev/null +++ b/src/tests/functional/plugin/shared/include/single_op_tests/slice.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/slice.hpp" + +namespace ov { +namespace test { +TEST_P(Slice8LayerTest, Inference) { + run(); +} +} // namespace test +} // namespace ov diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/shape_of.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/shape_of.hpp new file mode 100644 index 00000000000..f48238967c8 --- /dev/null +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/shape_of.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 { +typedef std::tuple< + ov::element::Type, // Model type + ov::element::Type, // Output type + std::vector, // Input shapes + ov::test::TargetDevice // Device name +> shapeOfParams; + +class ShapeOfLayerTest : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseTest { +public: + static std::string getTestCaseName(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/shuffle_channels.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/shuffle_channels.hpp new file mode 100644 index 00000000000..8f315bde169 --- /dev/null +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/shuffle_channels.hpp @@ -0,0 +1,38 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include +#include +#include + +#include "shared_test_classes/base/layer_test_utils.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" + +namespace ov { +namespace test { +typedef std::tuple< + int, // axis + int // group +> shuffleChannelsSpecificParams; + +typedef std::tuple< + shuffleChannelsSpecificParams, + ov::element::Type, // Model type + std::vector, // Input shapes + ov::test::TargetDevice // Device name +> shuffleChannelsLayerTestParamsSet; + +class ShuffleChannelsLayerTest : 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/slice.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/slice.hpp new file mode 100644 index 00000000000..f98fd74cb74 --- /dev/null +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/slice.hpp @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright (C) 2018-2023 Intel Corporation +// + +#pragma once + +#include +#include +#include +#include + +#include "shared_test_classes/base/layer_test_utils.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" + +namespace ov { +namespace test { +struct Slice8SpecificParams { + std::vector shapes; + std::vector start; + std::vector stop; + std::vector step; + std::vector axes; +}; + +using Slice8Params = std::tuple< + Slice8SpecificParams, // Slice-8 specific parameters + ov::element::Type, // Model type + ov::test::TargetDevice // Device name +>; + +class Slice8LayerTest : 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/shape_of.cpp b/src/tests/functional/shared_test_classes/src/single_op/shape_of.cpp new file mode 100644 index 00000000000..2d0cd3896ae --- /dev/null +++ b/src/tests/functional/shared_test_classes/src/single_op/shape_of.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "shared_test_classes/single_op/shape_of.hpp" + +namespace ov { +namespace test { +std::string ShapeOfLayerTest::getTestCaseName(testing::TestParamInfo obj) { + std::vector input_shapes; + ov::element::Type model_type, out_type; + std::string target_device; + std::tie(model_type, out_type, input_shapes, 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 << "outType=" << out_type.to_string() << "_"; + result << "trgDev=" << target_device; + return result.str(); +} + +void ShapeOfLayerTest::SetUp() { + std::vector input_shapes; + ov::element::Type model_type; + std::tie(model_type, outType, input_shapes, targetDevice) = this->GetParam(); + + init_input_shapes(input_shapes); + + auto param = std::make_shared(model_type, inputDynamicShapes.front()); + auto shape_of = std::make_shared(param, outType); + function = std::make_shared(shape_of->outputs(), ov::ParameterVector{param}, "ShapeOf"); +} +} // namespace test +} // namespace ov diff --git a/src/tests/functional/shared_test_classes/src/single_op/shuffle_channels.cpp b/src/tests/functional/shared_test_classes/src/single_op/shuffle_channels.cpp new file mode 100644 index 00000000000..f67cab21070 --- /dev/null +++ b/src/tests/functional/shared_test_classes/src/single_op/shuffle_channels.cpp @@ -0,0 +1,55 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "shared_test_classes/single_op/shuffle_channels.hpp" + +namespace ov { +namespace test { +std::string ShuffleChannelsLayerTest::getTestCaseName(const testing::TestParamInfo& obj) { + shuffleChannelsSpecificParams test_params; + ov::element::Type model_type; + std::vector input_shapes; + std::string target_device; + std::tie(test_params, model_type, input_shapes, target_device) = obj.param; + int axis, group; + std::tie(axis, group) = test_params; + + 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 << "Axis=" << std::to_string(axis) << "_"; + result << "Group=" << std::to_string(group) << "_"; + result << "modelType=" << model_type.to_string() << "_"; + result << "trgDev=" << target_device; + return result.str(); +} + +void ShuffleChannelsLayerTest::SetUp() { + shuffleChannelsSpecificParams test_params; + ov::element::Type model_type; + std::vector input_shapes; + std::string target_device; + std::tie(test_params, model_type, input_shapes, targetDevice) = this->GetParam(); + int axis, group; + std::tie(axis, group) = test_params; + + init_input_shapes(input_shapes); + + auto param = std::make_shared(model_type, inputDynamicShapes.front()); + auto shuffle_channels = std::make_shared(param, axis, group); + function = std::make_shared(shuffle_channels->outputs(), ov::ParameterVector{param}, "ShuffleChannels"); +} +} // namespace test +} // namespace ov diff --git a/src/tests/functional/shared_test_classes/src/single_op/slice.cpp b/src/tests/functional/shared_test_classes/src/single_op/slice.cpp new file mode 100644 index 00000000000..9257ffe8123 --- /dev/null +++ b/src/tests/functional/shared_test_classes/src/single_op/slice.cpp @@ -0,0 +1,64 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "shared_test_classes/single_op/slice.hpp" + +namespace ov { +namespace test { +std::string Slice8LayerTest::getTestCaseName(const testing::TestParamInfo &obj) { + Slice8SpecificParams params; + ov::element::Type model_type; + std::string target_device; + std::tie(params, model_type, target_device) = obj.param; + std::ostringstream result; + result << "IS=("; + for (size_t i = 0lu; i < params.shapes.size(); i++) { + result << ov::test::utils::partialShape2str({params.shapes[i].first}) + << (i < params.shapes.size() - 1lu ? "_" : ""); + } + result << ")_TS="; + for (size_t i = 0lu; i < params.shapes.front().second.size(); i++) { + result << "{"; + for (size_t j = 0lu; j < params.shapes.size(); j++) { + result << ov::test::utils::vec2str(params.shapes[j].second[i]) << (j < params.shapes.size() - 1lu ? "_" : ""); + } + result << "}_"; + } + result << "start=" << ov::test::utils::vec2str(params.start) << "_"; + result << "stop=" << ov::test::utils::vec2str(params.stop) << "_"; + result << "step=" << ov::test::utils::vec2str(params.step) << "_"; + result << "axes=" << ov::test::utils::vec2str(params.axes) << "_"; + result << "modelType=" << model_type.to_string() << "_"; + result << "trgDev=" << target_device; + return result.str(); +} + +void Slice8LayerTest::SetUp() { + Slice8SpecificParams test_params; + ov::element::Type model_type; + std::tie(test_params, model_type, targetDevice) = this->GetParam(); + + init_input_shapes(test_params.shapes); + + auto param = std::make_shared(model_type, inputDynamicShapes.front()); + ov::Shape const_shape = {test_params.start.size()}; + + ASSERT_EQ(shape_size(const_shape), test_params.stop.size()); + ASSERT_EQ(shape_size(const_shape), test_params.step.size()); + + auto begin_node = std::make_shared(ov::element::i64, const_shape, test_params.start.data()); + auto end_node = std::make_shared(ov::element::i64, const_shape, test_params.stop.data()); + auto stride_node = std::make_shared(ov::element::i64, const_shape, test_params.step.data()); + std::shared_ptr slice; + if (!test_params.axes.empty()) { + ASSERT_EQ(shape_size(const_shape), test_params.axes.size()); + auto axesNode = std::make_shared(ov::element::i64, const_shape, test_params.axes.data()); + slice = std::make_shared(param, begin_node, end_node, stride_node, axesNode); + } else { + slice = std::make_shared(param, begin_node, end_node, stride_node); + } + function = std::make_shared(slice->outputs(), ov::ParameterVector{param}, "Slice-8"); +} +} // namespace test +} // namespace ov