From 0b39f586b3a3698f1292fd236539156786723319 Mon Sep 17 00:00:00 2001 From: Andrei Gorbachev Date: Fri, 12 Jan 2024 03:52:39 +0000 Subject: [PATCH] [GPU] Refactor (#22077) * strided_slice * add strided_slice * Update strided_slice.cpp --------- Co-authored-by: Pavel Durandin --- .../single_layer_tests/strided_slice.cpp | 202 +++++++++++------- 1 file changed, 125 insertions(+), 77 deletions(-) diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/strided_slice.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/strided_slice.cpp index b9cc742705184c..93ea0f2448d57b 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/strided_slice.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/strided_slice.cpp @@ -2,103 +2,151 @@ // SPDX-License-Identifier: Apache-2.0 // -#include - -#include "single_layer_tests/strided_slice.hpp" +#include "single_op_tests/strided_slice.hpp" #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; - namespace { +using ov::test::StridedSliceLayerTest; +using ov::test::StridedSliceSpecificParams; +using ov::test::StridedSliceParams; + std::vector ss_only_test_cases_fp32 = { - StridedSliceSpecificParams{ { 128, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 1, 1 }, - { 0, 1, 1 }, { 0, 1, 1 }, { 1, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, - StridedSliceSpecificParams{ { 128, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 1, 1}, - { 1, 0, 1 }, { 1, 0, 1 }, { 0, 1, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, - StridedSliceSpecificParams{ { 1, 12, 100 }, { 0, -1, 0 }, { 0, 0, 0 }, { 1, 1, 1 }, - { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 1, 0 }, { 0, 0, 0 } }, - StridedSliceSpecificParams{ { 1, 12, 100 }, { 0, 9, 0 }, { 0, 11, 0 }, { 1, 1, 1 }, - { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, - StridedSliceSpecificParams{ { 1, 12, 100 }, { 0, 1, 0 }, { 0, -1, 0 }, { 1, 1, 1 }, - { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, - StridedSliceSpecificParams{ { 1, 12, 100 }, { 0, 9, 0 }, { 0, 7, 0 }, { -1, -1, -1 }, - { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, - StridedSliceSpecificParams{ { 1, 12, 100 }, { 0, 7, 0 }, { 0, 9, 0 }, { -1, 1, -1 }, - { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, - StridedSliceSpecificParams{ { 1, 12, 100 }, { 0, 4, 0 }, { 0, 9, 0 }, { -1, 2, -1 }, - { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, - StridedSliceSpecificParams{ { 1, 12, 100 }, { 0, 4, 0 }, { 0, 10, 0 }, { -1, 2, -1 }, - { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, - StridedSliceSpecificParams{ { 1, 12, 100 }, { 0, 9, 0 }, { 0, 4, 0 }, { -1, -2, -1 }, - { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, - StridedSliceSpecificParams{ { 1, 12, 100 }, { 0, 10, 0 }, { 0, 4, 0 }, { -1, -2, -1 }, - { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, - StridedSliceSpecificParams{ { 1, 12, 100 }, { 0, 11, 0 }, { 0, 0, 0 }, { -1, -2, -1 }, - { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, - StridedSliceSpecificParams{ { 1, 12, 100 }, { 0, -6, 0 }, { 0, -8, 0 }, { -1, -2, -1 }, - { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, - StridedSliceSpecificParams{ { 1, 12, 100, 1, 1 }, { 0, -1, 0, 0 }, { 0, 0, 0, 0 }, { 1, 1, 1, 1 }, - { 1, 0, 1, 0 }, { 1, 0, 1, 0 }, { }, { 0, 1, 0, 1 }, {} }, - StridedSliceSpecificParams{ { 2, 2, 2, 2 }, { 0, 0, 0, 0 }, { 2, 2, 2, 2 }, { 1, 1, 1, 1 }, - {1, 1, 1, 1}, {1, 1, 1, 1}, {}, {}, {} }, - StridedSliceSpecificParams{ { 2, 2, 2, 2 }, { 1, 1, 1, 1 }, { 2, 2, 2, 2 }, { 1, 1, 1, 1 }, - {0, 0, 0, 0}, {1, 1, 1, 1}, {}, {}, {} }, - StridedSliceSpecificParams{ { 1, 2, 128, 2 }, { 0, 0, 0, 1 }, { 0, 1, 0, 2 }, { 1, 1, 1, 1 }, - {1, 0, 1, 0}, {1, 0, 1, 0}, {0, 0, 0, 0}, {0, 1, 0, 1}, {0, 0, 0, 0} }, - StridedSliceSpecificParams{ { 2, 2, 2, 2 }, { 1, 1, 1, 1 }, { 2, 2, 2, 2 }, { 1, 1, 1, 1 }, - {0, 0, 0, 0}, {0, 0, 0, 0}, {}, {}, {} }, - StridedSliceSpecificParams{ { 2, 2, 4, 3 }, { 0, 0, 0, 0 }, { 2, 2, 4, 3 }, { 1, 1, 2, 1 }, - {1, 1, 1, 1}, {1, 1, 1, 1}, {}, {}, {} }, - StridedSliceSpecificParams{ { 2, 2, 4, 2 }, { 1, 0, 0, 1 }, { 2, 2, 4, 2 }, { 1, 1, 2, 1 }, - {0, 1, 1, 0}, {1, 1, 0, 0}, {}, {}, {} }, - StridedSliceSpecificParams{ { 1, 2, 4, 2 }, { 1, 0, 0, 0 }, { 1, 2, 4, 2 }, { 1, 1, -2, -1 }, - {1, 1, 1, 1}, {1, 1, 1, 1}, {}, {}, {} }, - StridedSliceSpecificParams{ { 2, 2, 4, 2 }, { 1, 0, 0, 0 }, { 1, 2, 4, 2 }, { 1, 1, -2, -1 }, - {0, 1, 1, 1}, {1, 1, 1, 1}, {}, {}, {} }, - StridedSliceSpecificParams{ { 2, 3, 4, 5, 6 }, { 0, 1, 0, 0, 0 }, { 2, 3, 4, 5, 6 }, { 1, 1, 1, 1, 1 }, - {1, 0, 1, 1, 1}, {1, 0, 1, 1, 1}, {}, {0, 1, 0, 0, 0}, {} }, - StridedSliceSpecificParams{ { 1, 5, 30, 30, 30 }, { 0, 0, 0, 0, 0 }, { 0, 0, 29, 29, 29 }, { 1, 1, 1, 1, 1 }, - {1, 1, 1, 1, 1}, {1, 1, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0} }, - StridedSliceSpecificParams{ { 10, 12 }, { -1, 1 }, { -9999, 0 }, { -1, 1 }, - { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }, - StridedSliceSpecificParams{ { 5, 5, 5, 5 }, { -1, 0, -1, 0 }, { -50, 0, -60, 0 }, { -1, 1, -1, 1 }, - { 0, 0, 0, 0 }, { 0, 1, 0, 1 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } }, - StridedSliceSpecificParams{ { 128, 1, 1024 }, { -1, 0, 0 }, { 0, 0, 0 }, { 1, 1, 1 }, - { 0, 1, 1 }, { 0, 1, 1 }, { 0, 0, 0 }, { 1, 0, 0 }, { 0, 0, 0 } }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 128, 1 }})), + { 0, 0, 0 }, { 0, 0, 0 }, { 1, 1, 1 }, { 0, 1, 1 }, + { 0, 1, 1 }, { 1, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 128, 1 }})), + { 0, 0, 0 }, { 0, 0, 0 }, { 1, 1, 1}, + { 1, 0, 1 }, { 1, 0, 1 }, { 0, 1, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 1, 12, 100 }})), + { 0, -1, 0 }, { 0, 0, 0 }, { 1, 1, 1 }, + { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 1, 0 }, { 0, 0, 0 } }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 1, 12, 100 }})), + { 0, 9, 0 }, { 0, 11, 0 }, { 1, 1, 1 }, + { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 1, 12, 100 }})), + { 0, 1, 0 }, { 0, -1, 0 }, { 1, 1, 1 }, + { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 1, 12, 100 }})), + { 0, 9, 0 }, { 0, 7, 0 }, { -1, -1, -1 }, + { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 1, 12, 100 }})), + { 0, 7, 0 }, { 0, 9, 0 }, { -1, 1, -1 }, + { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 1, 12, 100 }})), + { 0, 4, 0 }, { 0, 9, 0 }, { -1, 2, -1 }, + { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 1, 12, 100 }})), + { 0, 4, 0 }, { 0, 10, 0 }, { -1, 2, -1 }, + { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 1, 12, 100 }})), + { 0, 9, 0 }, { 0, 4, 0 }, { -1, -2, -1 }, + { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 1, 12, 100 }})), + { 0, 10, 0 }, { 0, 4, 0 }, { -1, -2, -1 }, + { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 1, 12, 100 }})), + { 0, 11, 0 }, { 0, 0, 0 }, { -1, -2, -1 }, + { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 1, 12, 100 }})), + { 0, -6, 0 }, { 0, -8, 0 }, { -1, -2, -1 }, + { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 1, 12, 100, 1, 1 }})), + { 0, -1, 0, 0 }, { 0, 0, 0, 0 }, { 1, 1, 1, 1 }, + { 1, 0, 1, 0 }, { 1, 0, 1, 0 }, { }, { 0, 1, 0, 1 }, {} }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 2, 2, 2, 2 }})), + { 0, 0, 0, 0 }, { 2, 2, 2, 2 }, { 1, 1, 1, 1 }, + {1, 1, 1, 1}, {1, 1, 1, 1}, {}, {}, {} }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 2, 2, 2, 2 }})), + { 1, 1, 1, 1 }, { 2, 2, 2, 2 }, { 1, 1, 1, 1 }, + {0, 0, 0, 0}, {1, 1, 1, 1}, {}, {}, {} }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 1, 2, 128, 2 }})), + { 0, 0, 0, 1 }, { 0, 1, 0, 2 }, { 1, 1, 1, 1 }, + {1, 0, 1, 0}, {1, 0, 1, 0}, {0, 0, 0, 0}, {0, 1, 0, 1}, {0, 0, 0, 0} }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 2, 2, 2, 2 }})), + { 1, 1, 1, 1 }, { 2, 2, 2, 2 }, { 1, 1, 1, 1 }, + {0, 0, 0, 0}, {0, 0, 0, 0}, {}, {}, {} }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 2, 2, 4, 3 }})), + { 0, 0, 0, 0 }, { 2, 2, 4, 3 }, { 1, 1, 2, 1 }, + {1, 1, 1, 1}, {1, 1, 1, 1}, {}, {}, {} }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 2, 2, 4, 2 }})), + { 1, 0, 0, 1 }, { 2, 2, 4, 2 }, { 1, 1, 2, 1 }, + {0, 1, 1, 0}, {1, 1, 0, 0}, {}, {}, {} }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 1, 2, 4, 2 }})), + { 1, 0, 0, 0 }, { 1, 2, 4, 2 }, { 1, 1, -2, -1 }, + {1, 1, 1, 1}, {1, 1, 1, 1}, {}, {}, {} }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 2, 2, 4, 2 }})), + { 1, 0, 0, 0 }, { 1, 2, 4, 2 }, { 1, 1, -2, -1 }, + {0, 1, 1, 1}, {1, 1, 1, 1}, {}, {}, {} }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 2, 3, 4, 5, 6 }})), + { 0, 1, 0, 0, 0 }, { 2, 3, 4, 5, 6 }, { 1, 1, 1, 1, 1 }, + {1, 0, 1, 1, 1}, {1, 0, 1, 1, 1}, {}, {0, 1, 0, 0, 0}, {} }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 1, 5, 30, 30, 30 }})), + { 0, 0, 0, 0, 0 }, { 0, 0, 29, 29, 29 }, { 1, 1, 1, 1, 1 }, + {1, 1, 1, 1, 1}, {1, 1, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0} }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 10, 12 }})), + { -1, 1 }, { -9999, 0 }, { -1, 1 }, + { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 5, 5, 5, 5 }})), + { -1, 0, -1, 0 }, { -50, 0, -60, 0 }, { -1, 1, -1, 1 }, + { 0, 0, 0, 0 }, { 0, 1, 0, 1 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 128, 1, 1024 }})), + { -1, 0, 0 }, { 0, 0, 0 }, { 1, 1, 1 }, + { 0, 1, 1 }, { 0, 1, 1 }, { 0, 0, 0 }, { 1, 0, 0 }, { 0, 0, 0 } }, }; std::vector ss_only_test_cases_i64 = { - StridedSliceSpecificParams{ { 2, 2, 2, 2 }, { 0, 0, 0, 0 }, { 2, 2, 2, 2 }, { 1, 1, 1, 1 }, - {1, 1, 1, 1}, {1, 1, 1, 1}, {}, {}, {} }, - StridedSliceSpecificParams{ { 2, 2, 2, 2 }, { 1, 1, 1, 1 }, { 2, 2, 2, 2 }, { 1, 1, 1, 1 }, - {0, 0, 0, 0}, {0, 0, 0, 0}, {}, {}, {} }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 2, 2, 2, 2 }})), + { 0, 0, 0, 0 }, { 2, 2, 2, 2 }, { 1, 1, 1, 1 }, + {1, 1, 1, 1}, {1, 1, 1, 1}, {}, {}, {} }, + StridedSliceSpecificParams{ ov::test::static_shapes_to_test_representation(std::vector({ + { 2, 2, 2, 2 }})), + { 1, 1, 1, 1 }, { 2, 2, 2, 2 }, { 1, 1, 1, 1 }, + {0, 0, 0, 0}, {0, 0, 0, 0}, {}, {}, {} }, }; INSTANTIATE_TEST_SUITE_P( smoke_CLDNN_FP32, StridedSliceLayerTest, ::testing::Combine( ::testing::ValuesIn(ss_only_test_cases_fp32), - ::testing::Values(InferenceEngine::Precision::FP32), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(ov::test::utils::DEVICE_GPU), - ::testing::Values(std::map())), + ::testing::Values(ov::element::f32), + ::testing::Values(ov::test::utils::DEVICE_GPU)), StridedSliceLayerTest::getTestCaseName); INSTANTIATE_TEST_SUITE_P( smoke_CLDNN_I64, StridedSliceLayerTest, ::testing::Combine( ::testing::ValuesIn(ss_only_test_cases_i64), - ::testing::Values(InferenceEngine::Precision::I64), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(ov::test::utils::DEVICE_GPU), - ::testing::Values(std::map())), + ::testing::Values(ov::element::i64), + ::testing::Values(ov::test::utils::DEVICE_GPU)), StridedSliceLayerTest::getTestCaseName); } // namespace