From a71283ea94ba622121619367b1b1dc3b5dbf4b69 Mon Sep 17 00:00:00 2001 From: Vitaliy Urusovskij Date: Wed, 25 Oct 2023 10:16:28 +0400 Subject: [PATCH] `RNNSequence`, `Result`, `Reshape`, `ReorgYolo`, `RegionYolo` layer tests to API2.0 (#20644) * `RNNSequenceTest` to API2.0 * `Result` to API2.0 * `Reshape` to API2.0 * `ReorgYolo` to API2.0 * `RegionYolo` to API2.0 * Alignment fixes * Skip more `RNNSequenceTest` cases --- .../single_layer_tests/region_yolo.cpp | 34 ++--- .../single_layer_tests/reorg_yolo.cpp | 56 +++---- .../single_layer_tests/reshape.cpp | 28 ++-- .../single_layer_tests/result.cpp | 35 +++-- .../single_layer_tests/rnn_sequence.cpp | 39 ++--- .../skip_tests_config.cpp | 4 + .../include/single_op_tests/region_yolo.hpp | 15 ++ .../include/single_op_tests/reorg_yolo.hpp | 15 ++ .../include/single_op_tests/reshape.hpp | 15 ++ .../shared/include/single_op_tests/result.hpp | 15 ++ .../include/single_op_tests/rnn_sequence.hpp | 15 ++ .../single_op/region_yolo.hpp | 37 +++++ .../single_op/reorg_yolo.hpp | 31 ++++ .../shared_test_classes/single_op/reshape.hpp | 32 ++++ .../shared_test_classes/single_op/result.hpp | 31 ++++ .../single_op/rnn_sequence.hpp | 43 ++++++ .../src/single_op/region_yolo.cpp | 52 +++++++ .../src/single_op/reorg_yolo.cpp | 33 +++++ .../src/single_op/reshape.cpp | 39 +++++ .../src/single_op/result.cpp | 32 ++++ .../src/single_op/rnn_sequence.cpp | 139 ++++++++++++++++++ 21 files changed, 643 insertions(+), 97 deletions(-) create mode 100644 src/tests/functional/plugin/shared/include/single_op_tests/region_yolo.hpp create mode 100644 src/tests/functional/plugin/shared/include/single_op_tests/reorg_yolo.hpp create mode 100644 src/tests/functional/plugin/shared/include/single_op_tests/reshape.hpp create mode 100644 src/tests/functional/plugin/shared/include/single_op_tests/result.hpp create mode 100644 src/tests/functional/plugin/shared/include/single_op_tests/rnn_sequence.hpp create mode 100644 src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/region_yolo.hpp create mode 100644 src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/reorg_yolo.hpp create mode 100644 src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/reshape.hpp create mode 100644 src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/result.hpp create mode 100644 src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/rnn_sequence.hpp create mode 100644 src/tests/functional/shared_test_classes/src/single_op/region_yolo.cpp create mode 100644 src/tests/functional/shared_test_classes/src/single_op/reorg_yolo.cpp create mode 100644 src/tests/functional/shared_test_classes/src/single_op/reshape.cpp create mode 100644 src/tests/functional/shared_test_classes/src/single_op/result.cpp create mode 100644 src/tests/functional/shared_test_classes/src/single_op/rnn_sequence.cpp diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/region_yolo.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/region_yolo.cpp index ab9700b56c9f3b..1be3333cfbf3db 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/region_yolo.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/region_yolo.cpp @@ -4,16 +4,16 @@ #include -#include "single_layer_tests/region_yolo.hpp" +#include "single_op_tests/region_yolo.hpp" #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; +using ov::test::RegionYoloLayerTest; -const std::vector inShapes_caffe = { +const std::vector> in_shapes_caffe = { {1, 125, 13, 13} }; -const std::vector inShapes_mxnet = { +const std::vector> in_shapes_mxnet = { {1, 75, 52, 52}, {1, 75, 32, 32}, {1, 75, 26, 26}, @@ -22,7 +22,7 @@ const std::vector inShapes_mxnet = { {1, 75, 8, 8} }; -const std::vector inShapes_v3 = { +const std::vector> in_shapes_v3 = { {1, 255, 52, 52}, {1, 255, 26, 26}, {1, 255, 13, 13} @@ -41,8 +41,8 @@ const size_t coords = 4; const int start_axis = 1; const int end_axis = 3; -const auto testCase_yolov3 = ::testing::Combine( - ::testing::ValuesIn(inShapes_v3), +const auto test_case_yolov3 = ::testing::Combine( + ::testing::ValuesIn(in_shapes_v3), ::testing::Values(classes[0]), ::testing::Values(coords), ::testing::Values(num_regions[1]), @@ -50,12 +50,12 @@ const auto testCase_yolov3 = ::testing::Combine( ::testing::Values(masks[2]), ::testing::Values(start_axis), ::testing::Values(end_axis), - ::testing::Values(InferenceEngine::Precision::FP32), + ::testing::Values(ov::element::f32), ::testing::Values(ov::test::utils::DEVICE_CPU) ); -const auto testCase_yolov3_mxnet = ::testing::Combine( - ::testing::ValuesIn(inShapes_mxnet), +const auto test_case_yolov3_mxnet = ::testing::Combine( + ::testing::ValuesIn(in_shapes_mxnet), ::testing::Values(classes[1]), ::testing::Values(coords), ::testing::Values(num_regions[1]), @@ -63,12 +63,12 @@ const auto testCase_yolov3_mxnet = ::testing::Combine( ::testing::Values(masks[1]), ::testing::Values(start_axis), ::testing::Values(end_axis), - ::testing::Values(InferenceEngine::Precision::FP32), + ::testing::Values(ov::element::f32), ::testing::Values(ov::test::utils::DEVICE_CPU) ); -const auto testCase_yolov2_caffe = ::testing::Combine( - ::testing::ValuesIn(inShapes_caffe), +const auto test_case_yolov2_caffe = ::testing::Combine( + ::testing::ValuesIn(in_shapes_caffe), ::testing::Values(classes[1]), ::testing::Values(coords), ::testing::Values(num_regions[0]), @@ -76,10 +76,10 @@ const auto testCase_yolov2_caffe = ::testing::Combine( ::testing::Values(masks[0]), ::testing::Values(start_axis), ::testing::Values(end_axis), - ::testing::Values(InferenceEngine::Precision::FP32), + ::testing::Values(ov::element::f32), ::testing::Values(ov::test::utils::DEVICE_CPU) ); -INSTANTIATE_TEST_SUITE_P(smoke_TestsRegionYolov3, RegionYoloLayerTest, testCase_yolov3, RegionYoloLayerTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_TestsRegionYoloMxnet, RegionYoloLayerTest, testCase_yolov3_mxnet, RegionYoloLayerTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_TestsRegionYoloCaffe, RegionYoloLayerTest, testCase_yolov2_caffe, RegionYoloLayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_TestsRegionYolov3, RegionYoloLayerTest, test_case_yolov3, RegionYoloLayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_TestsRegionYoloMxnet, RegionYoloLayerTest, test_case_yolov3_mxnet, RegionYoloLayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_TestsRegionYoloCaffe, RegionYoloLayerTest, test_case_yolov2_caffe, RegionYoloLayerTest::getTestCaseName); diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/reorg_yolo.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/reorg_yolo.cpp index 48b38d09c845eb..f0eb0076330554 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/reorg_yolo.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/reorg_yolo.cpp @@ -4,16 +4,16 @@ #include -#include "single_layer_tests/reorg_yolo.hpp" +#include "single_op_tests/reorg_yolo.hpp" #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; +using ov::test::ReorgYoloLayerTest; -const std::vector inShapes_caffe_yolov2 = { +const std::vector> in_shapes_caffe_yolov2 = { {1, 64, 26, 26}, }; -const std::vector inShapes = { +const std::vector> in_shapes = { {1, 4, 4, 4}, {1, 8, 4, 4}, {1, 9, 3, 3}, @@ -25,51 +25,51 @@ const std::vector strides = { 2, 3 }; -const auto testCase_caffe_yolov2 = ::testing::Combine( - ::testing::ValuesIn(inShapes_caffe_yolov2), +const auto test_case_caffe_yolov2 = ::testing::Combine( + ::testing::ValuesIn(in_shapes_caffe_yolov2), ::testing::Values(strides[0]), - ::testing::Values(InferenceEngine::Precision::FP32), + ::testing::Values(ov::element::f32), ::testing::Values(ov::test::utils::DEVICE_CPU) ); -const auto testCase_smallest = ::testing::Combine( - ::testing::Values(inShapes[0]), +const auto test_case_smallest = ::testing::Combine( + ::testing::Values(in_shapes[0]), ::testing::Values(strides[0]), - ::testing::Values(InferenceEngine::Precision::FP32), + ::testing::Values(ov::element::f32), ::testing::Values(ov::test::utils::DEVICE_CPU) ); -const auto testCase_stride_2 = ::testing::Combine( - ::testing::Values(inShapes[1]), +const auto test_case_stride_2 = ::testing::Combine( + ::testing::Values(in_shapes[1]), ::testing::Values(strides[0]), - ::testing::Values(InferenceEngine::Precision::FP32), + ::testing::Values(ov::element::f32), ::testing::Values(ov::test::utils::DEVICE_CPU) ); -const auto testCase_stride_3 = ::testing::Combine( - ::testing::Values(inShapes[2]), +const auto test_case_stride_3 = ::testing::Combine( + ::testing::Values(in_shapes[2]), ::testing::Values(strides[1]), - ::testing::Values(InferenceEngine::Precision::FP32), + ::testing::Values(ov::element::f32), ::testing::Values(ov::test::utils::DEVICE_CPU) ); -const auto testCase_smaller_h = ::testing::Combine( - ::testing::Values(inShapes[4]), +const auto test_case_smaller_h = ::testing::Combine( + ::testing::Values(in_shapes[4]), ::testing::Values(strides[0]), - ::testing::Values(InferenceEngine::Precision::FP32), + ::testing::Values(ov::element::f32), ::testing::Values(ov::test::utils::DEVICE_CPU) ); -const auto testCase_batch_2 = ::testing::Combine( - ::testing::Values(inShapes[3]), +const auto test_case_batch_2 = ::testing::Combine( + ::testing::Values(in_shapes[3]), ::testing::Values(strides[0]), - ::testing::Values(InferenceEngine::Precision::FP32), + ::testing::Values(ov::element::f32), ::testing::Values(ov::test::utils::DEVICE_CPU) ); -INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_caffe_YoloV2, ReorgYoloLayerTest, testCase_caffe_yolov2, ReorgYoloLayerTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_stride_2_smallest, ReorgYoloLayerTest, testCase_smallest, ReorgYoloLayerTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_stride_2, ReorgYoloLayerTest, testCase_stride_2, ReorgYoloLayerTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_stride_3, ReorgYoloLayerTest, testCase_stride_3, ReorgYoloLayerTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_smaller_h, ReorgYoloLayerTest, testCase_smaller_h, ReorgYoloLayerTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_batch_2, ReorgYoloLayerTest, testCase_batch_2, ReorgYoloLayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_caffe_YoloV2, ReorgYoloLayerTest, test_case_caffe_yolov2, ReorgYoloLayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_stride_2_smallest, ReorgYoloLayerTest, test_case_smallest, ReorgYoloLayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_stride_2, ReorgYoloLayerTest, test_case_stride_2, ReorgYoloLayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_stride_3, ReorgYoloLayerTest, test_case_stride_3, ReorgYoloLayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_smaller_h, ReorgYoloLayerTest, test_case_smaller_h, ReorgYoloLayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_batch_2, ReorgYoloLayerTest, test_case_batch_2, ReorgYoloLayerTest::getTestCaseName); diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/reshape.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/reshape.cpp index e27fd06948cf4f..2f690eaeef01a7 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/reshape.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/reshape.cpp @@ -4,42 +4,32 @@ #include -#include "single_layer_tests/reshape.hpp" +#include "single_op_tests/reshape.hpp" #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; +using ov::test::ReshapeLayerTest; namespace { -const std::vector netPrecisions = { - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::FP16 +const std::vector model_types = { + ov::element::f32, + ov::element::f16 }; INSTANTIATE_TEST_SUITE_P(smoke_ReshapeCheck, ReshapeLayerTest, ::testing::Combine( ::testing::Values(true), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), + ::testing::ValuesIn(model_types), ::testing::Values(std::vector({10, 10, 10, 10})), ::testing::Values(std::vector({10, 0, 100})), - ::testing::Values(ov::test::utils::DEVICE_CPU), - ::testing::Values(std::map({}))), + ::testing::Values(ov::test::utils::DEVICE_CPU)), ReshapeLayerTest::getTestCaseName); INSTANTIATE_TEST_SUITE_P(smoke_ReshapeCheckNegative, ReshapeLayerTest, ::testing::Combine( ::testing::Values(true), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), + ::testing::ValuesIn(model_types), ::testing::Values(std::vector({10, 10, 10, 10})), ::testing::Values(std::vector({10, -1, 100})), - ::testing::Values(ov::test::utils::DEVICE_CPU), - ::testing::Values(std::map({}))), + ::testing::Values(ov::test::utils::DEVICE_CPU)), ReshapeLayerTest::getTestCaseName); } // namespace diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/result.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/result.cpp index dfa40dd6fb1f60..5ba9264ae07c14 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/result.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/result.cpp @@ -4,28 +4,33 @@ #include -#include "shared_test_classes/single_layer/result.hpp" +#include "single_op_tests/result.hpp" -using namespace LayerTestsDefinitions; -using namespace InferenceEngine; +using ov::test::ResultLayerTest; namespace { -std::vector inputDims = { - {7}, {1000}, {3, 5}, {65, 33}, {33, 65}, - {1, 1000}, {223, 217, 21}, {3, 4, 5, 1}, {3, 4, 1, 5, 1}}; - -std::vector inputPrecisions = { - InferenceEngine::Precision::U8, InferenceEngine::Precision::FP32, - InferenceEngine::Precision::I32, +std::vector> input_shapes = { + {7}, + {1000}, + {3, 5}, + {65, 33}, + {33, 65}, + {1, 1000}, + {223, 217, 21}, + {3, 4, 5, 1}, + {3, 4, 1, 5, 1} }; -ConfigMap config; +std::vector model_types = { + ov::element::u8, + ov::element::f32, + ov::element::i32, +}; INSTANTIATE_TEST_SUITE_P( smoke_ResultLayerTest, ResultLayerTest, - ::testing::Combine(::testing::ValuesIn(inputDims), - ::testing::ValuesIn(inputPrecisions), - ::testing::Values(ov::test::utils::DEVICE_CPU), - ::testing::Values(config)), + ::testing::Combine(::testing::ValuesIn(input_shapes), + ::testing::ValuesIn(model_types), + ::testing::Values(ov::test::utils::DEVICE_CPU)), ResultLayerTest::getTestCaseName); } // namespace diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/rnn_sequence.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/rnn_sequence.cpp index 2ad71e186d7451..18ecb101bf0824 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/rnn_sequence.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/rnn_sequence.cpp @@ -3,21 +3,24 @@ // #include -#include -#include "single_layer_tests/rnn_sequence.hpp" +#include "openvino/op/util/attr_types.hpp" +#include "single_op_tests/rnn_sequence.hpp" #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; +using ov::test::RNNSequenceTest; +using ov::test::utils::SequenceTestsMode; +using ov::test::utils::InputLayerType; +using ov::op::RecurrentSequenceDirection; namespace { - std::vector mode{ngraph::helpers::SequenceTestsMode::CONVERT_TO_TI_MAX_SEQ_LEN_CONST, - ngraph::helpers::SequenceTestsMode::CONVERT_TO_TI_RAND_SEQ_LEN_CONST, - ngraph::helpers::SequenceTestsMode::CONVERT_TO_TI_RAND_SEQ_LEN_PARAM, - ngraph::helpers::SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_PARAM, - ngraph::helpers::SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_CONST, - ngraph::helpers::SequenceTestsMode::PURE_SEQ}; + std::vector mode{SequenceTestsMode::CONVERT_TO_TI_MAX_SEQ_LEN_CONST, + SequenceTestsMode::CONVERT_TO_TI_RAND_SEQ_LEN_CONST, + SequenceTestsMode::CONVERT_TO_TI_RAND_SEQ_LEN_PARAM, + SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_PARAM, + SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_CONST, + SequenceTestsMode::PURE_SEQ}; // output values increase rapidly without clip, so use only seq_lengths = 2 - std::vector seq_lengths_zero_clip{2}; + std::vector seq_lengths_zero_clip{10}; std::vector seq_lengths_clip_non_zero{20}; std::vector batch{1, 10}; std::vector hidden_size{1, 10}; @@ -25,11 +28,11 @@ namespace { std::vector> activations = {{"relu"}, {"sigmoid"}, {"tanh"}}; std::vector clip{0.f}; std::vector clip_non_zeros{0.7f}; - std::vector direction = {ngraph::op::RecurrentSequenceDirection::FORWARD, - ngraph::op::RecurrentSequenceDirection::REVERSE, - ngraph::op::RecurrentSequenceDirection::BIDIRECTIONAL, + std::vector direction = {RecurrentSequenceDirection::FORWARD, + RecurrentSequenceDirection::REVERSE, + RecurrentSequenceDirection::BIDIRECTIONAL, }; - std::vector netPrecisions = {InferenceEngine::Precision::FP32}; + std::vector model_types = {ov::element::f32}; INSTANTIATE_TEST_SUITE_P(smoke_RNNSequenceCommonZeroClip, RNNSequenceTest, ::testing::Combine( @@ -41,8 +44,8 @@ namespace { ::testing::ValuesIn(activations), ::testing::ValuesIn(clip), ::testing::ValuesIn(direction), - ::testing::Values(ngraph::helpers::InputLayerType::CONSTANT), - ::testing::ValuesIn(netPrecisions), + ::testing::Values(InputLayerType::CONSTANT), + ::testing::ValuesIn(model_types), ::testing::Values(ov::test::utils::DEVICE_CPU)), RNNSequenceTest::getTestCaseName); @@ -56,8 +59,8 @@ namespace { ::testing::ValuesIn(activations), ::testing::ValuesIn(clip_non_zeros), ::testing::ValuesIn(direction), - ::testing::Values(ngraph::helpers::InputLayerType::CONSTANT), - ::testing::ValuesIn(netPrecisions), + ::testing::Values(InputLayerType::CONSTANT), + ::testing::ValuesIn(model_types), ::testing::Values(ov::test::utils::DEVICE_CPU)), RNNSequenceTest::getTestCaseName); diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp index 508e766728b24b..4a3f3f8ddffa35 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp @@ -193,6 +193,8 @@ std::vector disabledTestPatterns() { R"(smoke_Interpolate_Basic_Down_Sample_Tail/InterpolateLayerTest.Inference.*(asymmetric|align_corners).*f16.*)", // Need to generate sequence exactly in the i64 data type. Enable in scope of i64 enabling. R"(.*RandomUniformLayerTestCPU.*OutPrc=i64.*)", + // Issue: 123321 + R"(.*smoke_RNNSequenceCommonZeroClip/RNNSequenceTest.Inference.*hidden_size=10.*relu.*)", }; #if defined(OPENVINO_ARCH_X86) @@ -217,6 +219,8 @@ std::vector disabledTestPatterns() { retVector.emplace_back(R"(smoke_CPU_OVClassLoadNetworkAndCheckWithSecondaryPropertiesDoubleTest/OVClassLoadNetworkAndCheckSecondaryPropertiesTest.LoadNetworkAndCheckSecondaryPropertiesTest.*)"); retVector.emplace_back(R"(smoke_CPU_OVClassCompileModelAndCheckSecondaryPropertiesTest.*)"); retVector.emplace_back(R"(smoke_CPU_OVClassCompileModelAndCheckWithSecondaryPropertiesDoubleTest.*)"); + // Issue: 123321 + retVector.emplace_back(R"(.*smoke_RNNSequenceCommonZeroClip/RNNSequenceTest.Inference.*hidden_size=1.*relu.*direction=reverse.*)"); } // invalid test: checks u8 precision for runtime graph, while it should be f32 retVector.emplace_back(R"(smoke_NegativeQuantizedMatMulMultiplyFusion.*)"); diff --git a/src/tests/functional/plugin/shared/include/single_op_tests/region_yolo.hpp b/src/tests/functional/plugin/shared/include/single_op_tests/region_yolo.hpp new file mode 100644 index 00000000000000..14b9235cf3f3d2 --- /dev/null +++ b/src/tests/functional/plugin/shared/include/single_op_tests/region_yolo.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/region_yolo.hpp" + +namespace ov { +namespace test { +TEST_P(RegionYoloLayerTest, Inference) { + run(); +}; +} // namespace test +} // namespace ov diff --git a/src/tests/functional/plugin/shared/include/single_op_tests/reorg_yolo.hpp b/src/tests/functional/plugin/shared/include/single_op_tests/reorg_yolo.hpp new file mode 100644 index 00000000000000..6088da8a97648c --- /dev/null +++ b/src/tests/functional/plugin/shared/include/single_op_tests/reorg_yolo.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/reorg_yolo.hpp" + +namespace ov { +namespace test { +TEST_P(ReorgYoloLayerTest, Inference) { + run(); +}; +} // namespace test +} // namespace ov diff --git a/src/tests/functional/plugin/shared/include/single_op_tests/reshape.hpp b/src/tests/functional/plugin/shared/include/single_op_tests/reshape.hpp new file mode 100644 index 00000000000000..741f44038983a4 --- /dev/null +++ b/src/tests/functional/plugin/shared/include/single_op_tests/reshape.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/reshape.hpp" + +namespace ov { +namespace test { +TEST_P(ReshapeLayerTest, Inference) { + run(); +}; +} // namespace test +} // namespace ov diff --git a/src/tests/functional/plugin/shared/include/single_op_tests/result.hpp b/src/tests/functional/plugin/shared/include/single_op_tests/result.hpp new file mode 100644 index 00000000000000..4915f5126e3100 --- /dev/null +++ b/src/tests/functional/plugin/shared/include/single_op_tests/result.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/result.hpp" + +namespace ov { +namespace test { +TEST_P(ResultLayerTest, Inference) { + run(); +}; +} // namespace test +} // namespace ov diff --git a/src/tests/functional/plugin/shared/include/single_op_tests/rnn_sequence.hpp b/src/tests/functional/plugin/shared/include/single_op_tests/rnn_sequence.hpp new file mode 100644 index 00000000000000..18985f620b9452 --- /dev/null +++ b/src/tests/functional/plugin/shared/include/single_op_tests/rnn_sequence.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/rnn_sequence.hpp" + +namespace ov { +namespace test { +TEST_P(RNNSequenceTest, Inference) { + run(); +}; +} // namespace test +} // namespace ov diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/region_yolo.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/region_yolo.hpp new file mode 100644 index 00000000000000..8fd145748b5148 --- /dev/null +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/region_yolo.hpp @@ -0,0 +1,37 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include +#include + +#include "shared_test_classes/base/ov_subgraph.hpp" + +namespace ov { +namespace test { +using regionYoloParamsTuple = std::tuple< + std::vector, // Input shape + size_t, // Classes + size_t, // Coordinates + size_t, // Num regions + bool, // Do softmax + std::vector, // Mask + int, // Start axis + int, // End axis + ov::element::Type, // Model type + ov::test::TargetDevice // Device name +>; + +class RegionYoloLayerTest : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseStaticTest { +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/reorg_yolo.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/reorg_yolo.hpp new file mode 100644 index 00000000000000..4a7e586cadcd40 --- /dev/null +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/reorg_yolo.hpp @@ -0,0 +1,31 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include +#include + +#include "shared_test_classes/base/ov_subgraph.hpp" + +namespace ov { +namespace test { +using ReorgYoloParamsTuple = typename std::tuple< + std::vector, // Input shape + size_t, // Stride + ov::element::Type, // Model type + ov::test::TargetDevice // Device name +>; + +class ReorgYoloLayerTest : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseStaticTest { +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/reshape.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/reshape.hpp new file mode 100644 index 00000000000000..1a2567a6c010b5 --- /dev/null +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/reshape.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 reshapeParams = std::tuple< + bool, // SpecialZero + ov::element::Type, // Model type + std::vector, // Input shapes + std::vector, // OutForm shapes + ov::test::TargetDevice // Device name +>; +class ReshapeLayerTest : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseStaticTest { +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/result.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/result.hpp new file mode 100644 index 00000000000000..024d38cd6edc09 --- /dev/null +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/result.hpp @@ -0,0 +1,31 @@ +// 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 ResultTestParamSet = std::tuple< + std::vector, // Input shapes + ov::element::Type, // Model type + ov::test::TargetDevice // Device name +>; + +class ResultLayerTest : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseStaticTest { +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/rnn_sequence.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/rnn_sequence.hpp new file mode 100644 index 00000000000000..31b1386c168505 --- /dev/null +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/rnn_sequence.hpp @@ -0,0 +1,43 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include +#include +#include + +#include +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "ov_models/builders.hpp" +#include "common_test_utils/test_enums.hpp" + +namespace ov { +namespace test { + +using RNNSequenceParams = typename std::tuple< + ov::test::utils::SequenceTestsMode, // Pure Sequence or TensorIterator + size_t, // Sequence lengths + size_t, // Batch + size_t, // Hidden size + size_t, // Input size + std::vector, // Activations + float, // Clip + ov::op::RecurrentSequenceDirection, // Direction + ov::test::utils::InputLayerType, // WRB input type (Constant or Parameter) + ov::element::Type, // Model type + ov::test::TargetDevice // Device name +>; + +class RNNSequenceTest : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseStaticTest { +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/region_yolo.cpp b/src/tests/functional/shared_test_classes/src/single_op/region_yolo.cpp new file mode 100644 index 00000000000000..d5c0e0481f20f8 --- /dev/null +++ b/src/tests/functional/shared_test_classes/src/single_op/region_yolo.cpp @@ -0,0 +1,52 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "shared_test_classes/single_op/region_yolo.hpp" + +namespace ov { +namespace test { +std::string RegionYoloLayerTest::getTestCaseName(const testing::TestParamInfo &obj) { + std::vector input_shape; + ov::element::Type model_type; + std::string target_device; + size_t classes; + size_t coords; + size_t num_regions; + bool do_softmax; + std::vector mask; + int start_axis; + int end_axis; + std::tie(input_shape, classes, coords, num_regions, do_softmax , mask, start_axis, end_axis, model_type, target_device) = obj.param; + std::ostringstream result; + result << "IS=" << ov::test::utils::vec2str(input_shape) << "_"; + result << "classes=" << classes << "_"; + result << "coords=" << coords << "_"; + result << "num=" << num_regions << "_"; + result << "doSoftmax=" << do_softmax << "_"; + result << "axis=" << start_axis << "_"; + result << "endAxis=" << end_axis << "_"; + result << "modelType=" << model_type.to_string() << "_"; + result << "trgDev=" << target_device; + return result.str(); +} + +void RegionYoloLayerTest::SetUp() { + std::vector input_shape; + ov::element::Type model_type; + size_t classes; + size_t coords; + size_t num_regions; + bool do_softmax; + std::vector mask; + int start_axis; + int end_axis; + std::tie(input_shape, classes, coords, num_regions, do_softmax, mask, start_axis, end_axis, model_type, targetDevice) = this->GetParam(); + + auto param = std::make_shared(model_type, ov::Shape(input_shape)); + auto region_yolo = std::make_shared(param, coords, classes, num_regions, do_softmax, mask, start_axis, end_axis); + function = std::make_shared(region_yolo->outputs(), ov::ParameterVector{param}, "RegionYolo"); +} +} // namespace test +} // namespace ov + diff --git a/src/tests/functional/shared_test_classes/src/single_op/reorg_yolo.cpp b/src/tests/functional/shared_test_classes/src/single_op/reorg_yolo.cpp new file mode 100644 index 00000000000000..9b7efc87220515 --- /dev/null +++ b/src/tests/functional/shared_test_classes/src/single_op/reorg_yolo.cpp @@ -0,0 +1,33 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "shared_test_classes/single_op/reorg_yolo.hpp" + +namespace ov { +namespace test { +std::string ReorgYoloLayerTest::getTestCaseName(const testing::TestParamInfo &obj) { + std::vector input_shape; + ov::element::Type model_type; + size_t stride; + std::string target_device; + std::tie(input_shape, stride, model_type, target_device) = obj.param; + std::ostringstream result; + result << "IS=" << ov::test::utils::vec2str(input_shape) << "_"; + result << "stride=" << stride << "_"; + result << "modelType=" << model_type.to_string() << "_"; + result << "trgDev=" << target_device; + return result.str(); +} + +void ReorgYoloLayerTest::SetUp() { + std::vector input_shape; + ov::element::Type model_type; + size_t stride; + std::tie(input_shape, stride, model_type, targetDevice) = this->GetParam(); + auto param = std::make_shared(model_type, ov::Shape(input_shape)); + auto reorg_yolo = std::make_shared(param, stride); + function = std::make_shared(reorg_yolo->outputs(), ov::ParameterVector{param}, "ReorgYolo"); +} +} // namespace test +} // namespace ov diff --git a/src/tests/functional/shared_test_classes/src/single_op/reshape.cpp b/src/tests/functional/shared_test_classes/src/single_op/reshape.cpp new file mode 100644 index 00000000000000..27c058f50aa68b --- /dev/null +++ b/src/tests/functional/shared_test_classes/src/single_op/reshape.cpp @@ -0,0 +1,39 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "shared_test_classes/single_op/reshape.hpp" + +namespace ov { +namespace test { +std::string ReshapeLayerTest::getTestCaseName(const testing::TestParamInfo& obj) { + std::vector input_shape; + ov::element::Type model_type; + std::vector out_form_shapes; + std::string target_device; + bool special_zero; + std::tie(special_zero, model_type, input_shape, out_form_shapes, target_device) = obj.param; + std::ostringstream result; + result << "IS=" << ov::test::utils::vec2str(input_shape) << "_"; + result << "OS=" << ov::test::utils::vec2str(out_form_shapes) << "_"; + result << "specialZero=" << special_zero << "_"; + result << "modelType=" << model_type.to_string() << "_"; + result << "trgDev=" << target_device; + return result.str(); +} + +void ReshapeLayerTest::SetUp() { + std::vector input_shape; + ov::element::Type model_type; + std::vector out_form_shapes; + bool special_zero; + std::tie(special_zero, model_type, input_shape, out_form_shapes, targetDevice) = this->GetParam(); + + auto param = std::make_shared(model_type, ov::Shape(input_shape)); + auto const_node = std::make_shared(ov::element::i64, ov::Shape{out_form_shapes.size()}, out_form_shapes); + auto reshape = std::make_shared(param, const_node, special_zero); + function = std::make_shared(reshape->outputs(), ov::ParameterVector{param}, "Reshape"); +} +} // namespace test +} // namespace ov + diff --git a/src/tests/functional/shared_test_classes/src/single_op/result.cpp b/src/tests/functional/shared_test_classes/src/single_op/result.cpp new file mode 100644 index 00000000000000..0a8fef223e062c --- /dev/null +++ b/src/tests/functional/shared_test_classes/src/single_op/result.cpp @@ -0,0 +1,32 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "shared_test_classes/single_op/result.hpp" + +namespace ov { +namespace test { +std::string ResultLayerTest::getTestCaseName(const testing::TestParamInfo& obj) { + std::vector input_shape; + ov::element::Type model_type; + std::string target_device; + std::tie(input_shape, model_type, target_device) = obj.param; + + std::ostringstream result; + result << "IS=" << ov::test::utils::vec2str(input_shape) << "_"; + result << "modelType=" << model_type.to_string() << "_"; + result << "trgDev=" << target_device; + return result.str(); +} + +void ResultLayerTest::SetUp() { + std::vector input_shape; + ov::element::Type model_type; + std::tie(input_shape, model_type, targetDevice) = GetParam(); + + ov::ParameterVector params{std::make_shared(model_type, ov::Shape(input_shape))}; + auto result = std::make_shared(params[0]); + function = std::make_shared(result->outputs(), params, "result"); +} +} // namespace test +} // namespace ov diff --git a/src/tests/functional/shared_test_classes/src/single_op/rnn_sequence.cpp b/src/tests/functional/shared_test_classes/src/single_op/rnn_sequence.cpp new file mode 100644 index 00000000000000..109aacdacbc277 --- /dev/null +++ b/src/tests/functional/shared_test_classes/src/single_op/rnn_sequence.cpp @@ -0,0 +1,139 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "openvino/pass/manager.hpp" +#include "transformations/op_conversions/bidirectional_sequences_decomposition.hpp" +#include "transformations/op_conversions/convert_sequences_to_tensor_iterator.hpp" +#include "shared_test_classes/single_op/rnn_sequence.hpp" +#include "common_test_utils/ov_tensor_utils.hpp" +// #include "ov_models/utils/ov_helpers.hpp" + +using ov::test::utils::InputLayerType; +using ov::test::utils::SequenceTestsMode; + +namespace ov { +namespace test { + +std::string RNNSequenceTest::getTestCaseName(const testing::TestParamInfo &obj) { + SequenceTestsMode mode; + size_t seq_lengths; + size_t batch; + size_t hidden_size; + size_t input_size; + std::vector activations; + std::vector activations_alpha; + std::vector activations_beta; + float clip; + ov::op::RecurrentSequenceDirection direction; + ov::element::Type model_type; + InputLayerType WRBType; + std::string target_device; + std::tie(mode, seq_lengths, batch, hidden_size, input_size, activations, clip, direction, WRBType, + model_type, target_device) = obj.param; + std::vector> input_shapes = { + {{batch, input_size}, {batch, hidden_size}, {batch, hidden_size}, {hidden_size, input_size}, + {hidden_size, hidden_size}, {hidden_size}}, + }; + std::ostringstream result; + result << "mode=" << mode << "_"; + result << "seq_lengths=" << seq_lengths << "_"; + result << "batch=" << batch << "_"; + result << "hidden_size=" << hidden_size << "_"; + result << "input_size=" << input_size << "_"; + result << "IS=" << ov::test::utils::vec2str(input_shapes) << "_"; + result << "activations=" << ov::test::utils::vec2str(activations) << "_"; + result << "direction=" << direction << "_"; + result << "clip=" << clip << "_"; + result << "modelType=" << model_type.to_string() << "_"; + result << "targetDevice=" << target_device; + return result.str(); +} + +void RNNSequenceTest::SetUp() { + SequenceTestsMode mode; + size_t seq_lengths; + size_t batch; + size_t hidden_size; + size_t input_size; + std::vector activations; + std::vector activations_alpha; + std::vector activations_beta; + float clip; + ov::op::RecurrentSequenceDirection direction; + InputLayerType WRBType; + ov::element::Type model_type; + std::tie(mode, seq_lengths, batch, hidden_size, input_size, activations, clip, direction, WRBType, + model_type, targetDevice) = this->GetParam(); + + size_t num_directions = direction == ov::op::RecurrentSequenceDirection::BIDIRECTIONAL ? 2 : 1; + std::vector input_shapes = { + {{batch, seq_lengths, input_size}, {batch, num_directions, hidden_size}, {batch}, + {num_directions, hidden_size, input_size}, {num_directions, hidden_size, hidden_size}, + {num_directions, hidden_size}}, + }; + + ov::ParameterVector params{std::make_shared(model_type, ov::Shape(input_shapes[0])), + std::make_shared(model_type, ov::Shape(input_shapes[1]))}; + std::shared_ptr seq_lengths_node; + if (mode == SequenceTestsMode::CONVERT_TO_TI_MAX_SEQ_LEN_PARAM || + mode == SequenceTestsMode::CONVERT_TO_TI_RAND_SEQ_LEN_PARAM || + mode == SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_PARAM) { + auto param = std::make_shared(ov::element::i64, input_shapes[2]); + param->set_friendly_name("seq_lengths"); + params.push_back(param); + seq_lengths_node = param; + } else if (mode == ov::test::utils::SequenceTestsMode::CONVERT_TO_TI_RAND_SEQ_LEN_CONST || + mode == ov::test::utils::SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_CONST) { + auto tensor = ov::test::utils::create_and_fill_tensor(ov::element::i64, input_shapes[2], static_cast(seq_lengths), 0.f); + seq_lengths_node = std::make_shared(tensor); + } else { + std::vector lengths(batch, seq_lengths); + seq_lengths_node = std::make_shared(ov::element::i64, input_shapes[2], lengths); + } + + const auto& W_shape = input_shapes[3]; + const auto& R_shape = input_shapes[4]; + const auto& B_shape = input_shapes[5]; + + std::shared_ptr W, R, B; + if (WRBType == InputLayerType::PARAMETER) { + const auto W_param = std::make_shared(model_type, W_shape); + const auto R_param = std::make_shared(model_type, R_shape); + const auto B_param = std::make_shared(model_type, B_shape); + W = W_param; + R = R_param; + B = B_param; + params.push_back(W_param); + params.push_back(R_param); + params.push_back(B_param); + } else { + const auto W_tensor = ov::test::utils::create_and_fill_tensor(model_type, W_shape); + const auto R_tensor = ov::test::utils::create_and_fill_tensor(model_type, R_shape); + const auto B_tensor = ov::test::utils::create_and_fill_tensor(model_type, B_shape); + W = std::make_shared(W_tensor); + R = std::make_shared(R_tensor); + B = std::make_shared(B_tensor); + } + + auto rnn_sequence = std::make_shared(params[0], params[1], seq_lengths_node, W, R, B, hidden_size, direction, + activations, activations_alpha, activations_beta, clip); + function = std::make_shared(rnn_sequence->outputs(), params, "rnn_sequence"); + bool is_pure_sequence = (mode == SequenceTestsMode::PURE_SEQ || + mode == SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_PARAM || + mode == SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_CONST); + if (!is_pure_sequence) { + ov::pass::Manager manager; + if (direction == ov::op::RecurrentSequenceDirection::BIDIRECTIONAL) + manager.register_pass(); + manager.register_pass(); + manager.run_passes(function); + bool ti_found = ngraph::helpers::is_tensor_iterator_exist(function); + EXPECT_EQ(ti_found, true); + } else { + bool ti_found = ngraph::helpers::is_tensor_iterator_exist(function); + EXPECT_EQ(ti_found, false); + } +} +} // namespace test +} // namespace ov