diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/activation.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/activation.cpp index 44d84c31d6bc98..eddfc1a28e7a66 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/activation.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/activation.cpp @@ -2,107 +2,105 @@ // SPDX-License-Identifier: Apache-2.0 // -#include -#include "single_layer_tests/activation.hpp" +#include "single_op_tests/activation.hpp" #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; -using namespace ngraph::helpers; namespace { -// Common params -const std::vector inputPrecisions = { - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::FP16, - InferenceEngine::Precision::I16, - InferenceEngine::Precision::U8 -}; +using ov::test::ActivationLayerTest; +using ov::test::ActivationParamLayerTest; +using ov::test::utils::ActivationTypes; -const std::vector netPrecisions = { - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::FP16 +// Common params +const std::vector netPrecisions = { + ov::element::f32, + ov::element::f16 }; const std::map>> activationTypes = { - {Sigmoid, {}}, - {Tanh, {}}, - {Relu, {}}, - {Exp, {}}, - {Log, {}}, - {Sign, {}}, - {Abs, {}}, - {Gelu, {}}, - {Clamp, {{-2.0f, 2.0f}}}, - {Negative, {}}, - {Acos, {}}, - {Acosh, {}}, - {Asin, {}}, - {Asinh, {}}, - {Atan, {}}, - {Atanh, {}}, - {Cos, {}}, - {Cosh, {}}, - {Floor, {}}, - {Sin, {}}, - {Sinh, {}}, - {Sqrt, {}}, - {Tan, {}}, - {Elu, {{0.1f}}}, - {Erf, {}}, - {HardSigmoid, {{0.2f, 0.5f}}}, - {Selu, {{1.6732f, 1.0507f}}}, - {Ceiling, {}}, - {Mish, {}}, - {HSwish, {}}, - {SoftPlus, {}}, - {HSigmoid, {}}, - {Swish, {{0.5f}}}, - {RoundHalfToEven, {}}, - {RoundHalfAwayFromZero, {}}, - {GeluErf, {}}, - {GeluTanh, {}}, - {SoftSign, {}}, + {ActivationTypes::Sigmoid, {}}, + {ActivationTypes::Tanh, {}}, + {ActivationTypes::Relu, {}}, + {ActivationTypes::Exp, {}}, + {ActivationTypes::Log, {}}, + {ActivationTypes::Sign, {}}, + {ActivationTypes::Abs, {}}, + {ActivationTypes::Gelu, {}}, + {ActivationTypes::Clamp, {{-2.0f, 2.0f}}}, + {ActivationTypes::Negative, {}}, + {ActivationTypes::Acos, {}}, + {ActivationTypes::Acosh, {}}, + {ActivationTypes::Asin, {}}, + {ActivationTypes::Asinh, {}}, + {ActivationTypes::Atan, {}}, + {ActivationTypes::Atanh, {}}, + {ActivationTypes::Cos, {}}, + {ActivationTypes::Cosh, {}}, + {ActivationTypes::Floor, {}}, + {ActivationTypes::Sin, {}}, + {ActivationTypes::Sinh, {}}, + {ActivationTypes::Sqrt, {}}, + {ActivationTypes::Tan, {}}, + {ActivationTypes::Elu, {{0.1f}}}, + {ActivationTypes::Erf, {}}, + {ActivationTypes::HardSigmoid, {{0.2f, 0.5f}}}, + {ActivationTypes::Selu, {{1.6732f, 1.0507f}}}, + {ActivationTypes::Ceiling, {}}, + {ActivationTypes::Mish, {}}, + {ActivationTypes::HSwish, {}}, + {ActivationTypes::SoftPlus, {}}, + {ActivationTypes::HSigmoid, {}}, + {ActivationTypes::Swish, {{0.5f}}}, + {ActivationTypes::RoundHalfToEven, {}}, + {ActivationTypes::RoundHalfAwayFromZero, {}}, + {ActivationTypes::GeluErf, {}}, + {ActivationTypes::GeluTanh, {}}, + {ActivationTypes::SoftSign, {}}, }; const std::map>> big_rank_activation_types = { - {Relu, {}}, - {Exp, {}}, - {Log, {}}, - {Abs, {}}, - {Clamp, {{-2.0f, 2.0f}}}, - {Ceiling, {}}, - {Swish, {{0.5f}}}, + {ActivationTypes::Relu, {}}, + {ActivationTypes::Exp, {}}, + {ActivationTypes::Log, {}}, + {ActivationTypes::Abs, {}}, + {ActivationTypes::Clamp, {{-2.0f, 2.0f}}}, + {ActivationTypes::Ceiling, {}}, + {ActivationTypes::Swish, {{0.5f}}}, }; const std::map>> activationParamTypes = { - {PReLu, {{-0.01f}}}, - {LeakyRelu, {{0.01f}}} + {ActivationTypes::PReLu, {{-0.01f}}}, + {ActivationTypes::LeakyRelu, {{0.01f}}} +}; + +std::map, std::vector> basic = { + {{{1, 50}}, {{}}}, + {{{1, 128}}, {{}}}, }; -std::map, std::vector>> basic = { - {{1, 50}, {{}}}, - {{1, 128}, {{}}}, +std::map, std::vector> big_ranks = { + {{{1, 2, 3, 4, 5, 3}}, {{}}}, + {{{1, 2, 3, 4, 1, 3, 2}}, {{}}}, + {{{1, 2, 3, 4, 3, 2, 1, 2}}, {{}}}, }; -std::map, std::vector>> big_ranks = { - {{1, 2, 3, 4, 5, 3}, {{}}}, - {{1, 2, 3, 4, 1, 3, 2}, {{}}}, - {{1, 2, 3, 4, 3, 2, 1, 2}, {{}}}, +std::map, std::vector> preluBasic = { + {{{1, 10, 20}}, {{10}, {20}, {10, 20}}}, + {{{1, 128}}, {{1}, {128}}}, }; -std::map, std::vector>> preluBasic = { - {{1, 10, 20}, {{10}, {20}, {10, 20}}}, - {{1, 128}, {{1}, {128}}}, +auto static_shapes_param_transform = [](const std::vector, ov::Shape>>& original_shapes) { + std::vector, ov::Shape>> new_shapes; + for (const auto& shape_element : original_shapes) { + new_shapes.emplace_back(ov::test::static_shapes_to_test_representation(shape_element.first), shape_element.second); + } + return new_shapes; }; const auto basicCases = []() { return ::testing::Combine( ::testing::ValuesIn(ov::test::utils::combineParams(activationTypes)), ::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(ov::test::utils::combineParams(basic)), + ::testing::ValuesIn(static_shapes_param_transform(ov::test::utils::combineParams(basic))), ::testing::Values(ov::test::utils::DEVICE_GPU)); }; @@ -110,11 +108,7 @@ const auto basicPreluCases = []() { return ::testing::Combine( ::testing::ValuesIn(ov::test::utils::combineParams(activationParamTypes)), ::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(ov::test::utils::combineParams(preluBasic)), + ::testing::ValuesIn(static_shapes_param_transform(ov::test::utils::combineParams(preluBasic))), ::testing::Values(ov::test::utils::DEVICE_GPU)); }; @@ -122,11 +116,7 @@ const auto big_rank_cases = []() { return ::testing::Combine( ::testing::ValuesIn(ov::test::utils::combineParams(big_rank_activation_types)), ::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(ov::test::utils::combineParams(big_ranks)), + ::testing::ValuesIn(static_shapes_param_transform(ov::test::utils::combineParams(big_ranks))), ::testing::Values(ov::test::utils::DEVICE_GPU)); }; diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/dft.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/dft.cpp index 5ea870c8792e19..845a8cfdfb92dc 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/dft.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/dft.cpp @@ -3,25 +3,25 @@ // #include -#include -#include +#include namespace { +using ov::test::DFTLayerTest; -const std::vector opTypes = { - ngraph::helpers::DFTOpType::FORWARD, - ngraph::helpers::DFTOpType::INVERSE, +const std::vector opTypes = { + ov::test::utils::DFTOpType::FORWARD, + ov::test::utils::DFTOpType::INVERSE, }; -const std::vector inputPrecisions = { - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::FP16, +const std::vector inputPrecisions = { + ov::element::f32, + ov::element::f16, }; -const auto combine = [](const std::vector& inputShapes, +const auto combine = [](const std::vector>& inputShapes, const std::vector>& axes, const std::vector>& signalSizes) { - return testing::Combine(testing::ValuesIn(inputShapes), + return testing::Combine(testing::ValuesIn(ov::test::static_shapes_to_test_representation(inputShapes)), testing::ValuesIn(inputPrecisions), testing::ValuesIn(axes), testing::ValuesIn(signalSizes), @@ -29,60 +29,58 @@ const auto combine = [](const std::vector& inputSha testing::Values(ov::test::utils::DEVICE_GPU)); }; -using namespace LayerTestsDefinitions; - INSTANTIATE_TEST_SUITE_P(smoke_DFT_2d, DFTLayerTest, - combine({{10, 2}}, // input shapes + combine({{{10, 2}}}, // input shapes {{0}}, // axes {{}, {3}}), // signal sizes DFTLayerTest::getTestCaseName); INSTANTIATE_TEST_SUITE_P(smoke_DFT_3d, DFTLayerTest, - combine({{10, 4, 2}}, // input shapes + combine({{{10, 4, 2}}}, // input shapes {{0, 1}}, // axes {{}, {3, 10}}), // signal sizes DFTLayerTest::getTestCaseName); INSTANTIATE_TEST_SUITE_P(smoke_DFT_4d, DFTLayerTest, - combine({{10, 4, 8, 2}}, // input shapes + combine({{{10, 4, 8, 2}}}, // input shapes {{0, 1, 2}}, // axes {{}, {3, 10, 8}}), // signal sizes DFTLayerTest::getTestCaseName); INSTANTIATE_TEST_SUITE_P(smoke_DFT_4d_negative_reversed_axes, DFTLayerTest, - combine({{10, 4, 8, 2}}, // input shapes + combine({{{10, 4, 8, 2}}}, // input shapes {{-1, -2, -3}}, // axes {{}, {8, 10, 3}}), // signal sizes DFTLayerTest::getTestCaseName); INSTANTIATE_TEST_SUITE_P(smoke_DFT_4d_single_axis, DFTLayerTest, - combine({{10, 4, 8, 2}}, // input shapes + combine({{{10, 4, 8, 2}}}, // input shapes {{0}, {1}, {2}}, // axes {{}, {1}, {5}, {20}}), // signal sizes DFTLayerTest::getTestCaseName); INSTANTIATE_TEST_SUITE_P(smoke_DFT_5d, DFTLayerTest, - combine({{10, 4, 8, 2, 2}}, // input shapes + combine({{{10, 4, 8, 2, 2}}}, // input shapes {{0, 1, 2, 3}}, // axes {{}, {3, 10, 8, 6}}), // signal sizes DFTLayerTest::getTestCaseName); INSTANTIATE_TEST_SUITE_P(smoke_DFT_6d, DFTLayerTest, - combine({{10, 4, 8, 2, 5, 2}}, // input shapes + combine({{{10, 4, 8, 2, 5, 2}}}, // input shapes {{0, 1, 2, 3, 4}}, // axes {{}, {3, 10, 8, 6, 2}}), // signal sizes DFTLayerTest::getTestCaseName); INSTANTIATE_TEST_SUITE_P(smoke_DFT_6d_zero, DFTLayerTest, - combine({{10, 4, 8, 2, 5, 2}}, // input shapes + combine({{{10, 4, 8, 2, 5, 2}}}, // input shapes {{}}, // axes {{}}), // signal sizes DFTLayerTest::getTestCaseName); diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/generate_proposals.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/generate_proposals.cpp index 15d0f943014d46..6d1881512f5db2 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/generate_proposals.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/generate_proposals.cpp @@ -2,151 +2,16 @@ // SPDX-License-Identifier: Apache-2.0 // -#include - -#include "single_layer_tests/generate_proposals.hpp" -#include "common_test_utils/ov_tensor_utils.hpp" - -using namespace ov::test; -using namespace ov::test::subgraph; +#include "single_op_tests/generate_proposals.hpp" namespace { +using ov::test::GenerateProposalsLayerTest; +using ov::test::InputShape; const std::vector min_size = { 1.0f, 0.0f }; const std::vector nms_threshold = { 0.7f }; const std::vector post_nms_count = { 6 }; const std::vector pre_nms_count = { 14, 1000 }; - -template -const std::vector>> getInputTensors() { - const std::vector>> input_tensors = { - { - "empty", - { - // 3 - ov::test::utils::create_tensor(ov::element::from(), ov::Shape{2, 3}, {1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f}), - // 2 x 6 x 3 x 4 = 144 - ov::test::utils::create_tensor(ov::element::from(), ov::Shape{2, 6, 3, 4}, std::vector(144, 1.0f)), - // 2 x 12 x 2 x 6 = 144 * 2 - ov::test::utils::create_tensor(ov::element::from(), ov::Shape{2, 12, 2, 6}, std::vector(288, 1.0f)), - // {2 x 3 x 2 x 6} = 36 * 2 - ov::test::utils::create_tensor(ov::element::from(), ov::Shape{2, 3, 2, 6}, { - 5.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 4.0f, 1.0f, 1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 8.0f, 1.0f, - 5.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 4.0f, 1.0f, 1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 8.0f, 1.0f}) - } - }, - { - "filled2", - { - ov::test::utils::create_tensor(ov::element::from(), ov::Shape{2, 3}, {200.0f, 200.0f, 4.0f, 200.0f, 200.0f, 4.0f}), - ov::test::utils::create_tensor(ov::element::from(), ov::Shape{2, 6, 3, 4}, {0.0f, 1.0f, 2.0f, 3.0f, - 4.0f, 5.0f, 6.0f, 7.0f, - 8.0f, 9.0f, 10.0f, 11.0f, - 12.0f, 13.0f, 14.0f, 15.0f, - 16.0f, 17.0f, 18.0f, 19.0f, - 20.0f, 21.0f, 22.0f, 23.0f, - 24.0f, 25.0f, 26.0f, 27.0f, - 28.0f, 29.0f, 30.0f, 31.0f, - 32.0f, 33.0f, 34.0f, 35.0f, - 36.0f, 37.0f, 38.0f, 39.0f, - 40.0f, 41.0f, 42.0f, 43.0f, - 44.0f, 45.0f, 46.0f, 47.0f, - 48.0f, 49.0f, 50.0f, 51.0f, - 52.0f, 53.0f, 54.0f, 55.0f, - 56.0f, 57.0f, 58.0f, 59.0f, - 60.0f, 61.0f, 62.0f, 63.0f, - 64.0f, 65.0f, 66.0f, 67.0f, - 68.0f, 69.0f, 70.0f, 71.0f, - 72.0f, 73.0f, 74.0f, 75.0f, - 76.0f, 77.0f, 78.0f, 79.0f, - 80.0f, 81.0f, 82.0f, 83.0f, - 84.0f, 85.0f, 86.0f, 87.0f, - 88.0f, 89.0f, 90.0f, 91.0f, - 92.0f, 93.0f, 94.0f, 95.0f, - 96.0f, 97.0f, 98.0f, 99.0f, - 100.0f, 101.0f, 102.0f, 103.0f, - 104.0f, 105.0f, 106.0f, 107.0f, - 108.0f, 109.0f, 110.0f, 111.0f, - 112.0f, 113.0f, 114.0f, 115.0f, - 116.0f, 117.0f, 118.0f, 119.0f, - 120.0f, 121.0f, 122.0f, 123.0f, - 124.0f, 125.0f, 126.0f, 127.0f, - 128.0f, 129.0f, 130.0f, 131.0f, - 132.0f, 133.0f, 134.0f, 135.0f, - 136.0f, 137.0f, 138.0f, 139.0f, - 140.0f, 141.0f, 142.0f, 143.0f}), - ov::test::utils::create_tensor(ov::element::from(), ov::Shape{2, 12, 2, 6}, { - 0.5337073f, 0.86607957f, 0.55151343f, 0.21626699f, 0.4462629f, 0.03985678f, - 0.5157072f, 0.9932138f, 0.7565954f, 0.43803605f, 0.802818f, 0.14834064f, - 0.53932905f, 0.14314f, 0.3817048f, 0.95075196f, 0.05516243f, 0.2567484f, - 0.25508744f, 0.77438325f, 0.43561f, 0.2094628f, 0.8299043f, 0.44982538f, - 0.95615596f, 0.5651084f, 0.11801951f, 0.05352486f, 0.9774733f, 0.14439464f, - 0.62644225f, 0.14370479f, 0.54161614f, 0.557915f, 0.53102225f, 0.0840179f, - 0.7249888f, 0.9843559f, 0.5490522f, 0.53788143f, 0.822474f, 0.3278008f, - 0.39688024f, 0.3286012f, 0.5117038f, 0.04743988f, 0.9408995f, 0.29885054f, - 0.81039643f, 0.85277915f, 0.06807619f, 0.86430097f, 0.36225632f, 0.16606331f, - 0.5401001f, 0.7541649f, 0.11998601f, 0.5131829f, 0.40606487f, 0.327888f, - 0.27721855f, 0.6378373f, 0.22795396f, 0.4961256f, 0.3215895f, 0.15607187f, - 0.14782153f, 0.8908137f, 0.8835288f, 0.834191f, 0.29907143f, 0.7983525f, - 0.755875f, 0.30837986f, 0.0839176f, 0.26624718f, 0.04371626f, 0.09472824f, - 0.20689541f, 0.37622106f, 0.1083321f, 0.1342548f, 0.05815459f, 0.7676379f, - 0.8105144f, 0.92348766f, 0.26761323f, 0.7183306f, 0.8947588f, 0.19020908f, - 0.42731014f, 0.7473663f, 0.85775334f, 0.9340091f, 0.3278848f, 0.755993f, - 0.05307213f, 0.39705503f, 0.21003333f, 0.5625373f, 0.66188884f, 0.80521655f, - 0.6125863f, 0.44678232f, 0.97802377f, 0.0204936f, 0.02686367f, 0.7390654f, - 0.74631f, 0.58399844f, 0.5988792f, 0.37413648f, 0.5946692f, 0.6955776f, - 0.36377597f, 0.7891322f, 0.40900692f, 0.99139464f, 0.50169915f, 0.41435778f, - 0.17142445f, 0.26761186f, 0.31591868f, 0.14249913f, 0.12919712f, 0.5418711f, - 0.6523203f, 0.50259084f, 0.7379765f, 0.01171071f, 0.94423133f, 0.00841132f, - 0.97486794f, 0.2921785f, 0.7633071f, 0.88477814f, 0.03563205f, 0.50833166f, - 0.01354555f, 0.535081f, 0.41366324f, 0.0694767f, 0.9944055f, 0.9981207f, - 0.5337073f, 0.86607957f, 0.55151343f, 0.21626699f, 0.4462629f, 0.03985678f, - 0.5157072f, 0.9932138f, 0.7565954f, 0.43803605f, 0.802818f, 0.14834064f, - 0.53932905f, 0.14314f, 0.3817048f, 0.95075196f, 0.05516243f, 0.2567484f, - 0.25508744f, 0.77438325f, 0.43561f, 0.2094628f, 0.8299043f, 0.44982538f, - 0.95615596f, 0.5651084f, 0.11801951f, 0.05352486f, 0.9774733f, 0.14439464f, - 0.62644225f, 0.14370479f, 0.54161614f, 0.557915f, 0.53102225f, 0.0840179f, - 0.7249888f, 0.9843559f, 0.5490522f, 0.53788143f, 0.822474f, 0.3278008f, - 0.39688024f, 0.3286012f, 0.5117038f, 0.04743988f, 0.9408995f, 0.29885054f, - 0.81039643f, 0.85277915f, 0.06807619f, 0.86430097f, 0.36225632f, 0.16606331f, - 0.5401001f, 0.7541649f, 0.11998601f, 0.5131829f, 0.40606487f, 0.327888f, - 0.27721855f, 0.6378373f, 0.22795396f, 0.4961256f, 0.3215895f, 0.15607187f, - 0.14782153f, 0.8908137f, 0.8835288f, 0.834191f, 0.29907143f, 0.7983525f, - 0.755875f, 0.30837986f, 0.0839176f, 0.26624718f, 0.04371626f, 0.09472824f, - 0.20689541f, 0.37622106f, 0.1083321f, 0.1342548f, 0.05815459f, 0.7676379f, - 0.8105144f, 0.92348766f, 0.26761323f, 0.7183306f, 0.8947588f, 0.19020908f, - 0.42731014f, 0.7473663f, 0.85775334f, 0.9340091f, 0.3278848f, 0.755993f, - 0.05307213f, 0.39705503f, 0.21003333f, 0.5625373f, 0.66188884f, 0.80521655f, - 0.6125863f, 0.44678232f, 0.97802377f, 0.0204936f, 0.02686367f, 0.7390654f, - 0.74631f, 0.58399844f, 0.5988792f, 0.37413648f, 0.5946692f, 0.6955776f, - 0.36377597f, 0.7891322f, 0.40900692f, 0.99139464f, 0.50169915f, 0.41435778f, - 0.17142445f, 0.26761186f, 0.31591868f, 0.14249913f, 0.12919712f, 0.5418711f, - 0.6523203f, 0.50259084f, 0.7379765f, 0.01171071f, 0.94423133f, 0.00841132f, - 0.97486794f, 0.2921785f, 0.7633071f, 0.88477814f, 0.03563205f, 0.50833166f, - 0.01354555f, 0.535081f, 0.41366324f, 0.0694767f, 0.9944055f, 0.9981207f}), - ov::test::utils::create_tensor(ov::element::from(), ov::Shape{2, 3, 2, 6}, { - 0.56637216f, 0.90457034f, 0.69827306f, 0.4353543f, 0.47985056f, 0.42658508f, - 0.14516132f, 0.08081771f, 0.1799732f, 0.9229515f, 0.42420176f, 0.50857586f, - 0.82664067f, 0.4972319f, 0.3752427f, 0.56731623f, 0.18241242f, 0.33252355f, - 0.30608943f, 0.6572437f, 0.69185436f, 0.88646156f, 0.36985755f, 0.5590753f, - 0.5256446f, 0.03342898f, 0.1344396f, 0.68642473f, 0.37953874f, 0.32575172f, - 0.21108444f, 0.5661886f, 0.45378175f, 0.62126315f, 0.26799858f, 0.37272978f, - 0.56637216f, 0.90457034f, 0.69827306f, 0.4353543f, 0.47985056f, 0.42658508f, - 0.14516132f, 0.08081771f, 0.1799732f, 0.9229515f, 0.42420176f, 0.50857586f, - 0.82664067f, 0.4972319f, 0.3752427f, 0.56731623f, 0.18241242f, 0.33252355f, - 0.30608943f, 0.6572437f, 0.69185436f, 0.88646156f, 0.36985755f, 0.5590753f, - 0.5256446f, 0.03342898f, 0.1344396f, 0.68642473f, 0.37953874f, 0.32575172f, - 0.21108444f, 0.5661886f, 0.45378175f, 0.62126315f, 0.26799858f, 0.37272978f}), - } - } - }; - return input_tensors; -} - constexpr size_t num_batches = 2; constexpr size_t height = 2; constexpr size_t width = 6; @@ -154,14 +19,13 @@ constexpr size_t number_of_anchors = 3; const std::vector> input_shape = { // im_info / anchors / boxesdeltas / scores - static_shapes_to_test_representation({{num_batches, 3}, - {height, width, number_of_anchors, 4}, - {num_batches, number_of_anchors * 4, height, width}, - {num_batches, number_of_anchors, height, width}}), + ov::test::static_shapes_to_test_representation({{num_batches, 3}, + {height, width, number_of_anchors, 4}, + {num_batches, number_of_anchors * 4, height, width}, + {num_batches, number_of_anchors, height, width} + }), }; - - INSTANTIATE_TEST_SUITE_P( smoke_GenerateProposalsLayerTest_f16, GenerateProposalsLayerTest, @@ -172,9 +36,8 @@ INSTANTIATE_TEST_SUITE_P( ::testing::ValuesIn(post_nms_count), ::testing::ValuesIn(pre_nms_count), ::testing::ValuesIn({true}), - ::testing::ValuesIn(getInputTensors()), - ::testing::ValuesIn({ov::element::Type_t::f16}), - ::testing::ValuesIn({ov::element::Type_t::i32, ov::element::Type_t::i64}), + ::testing::ValuesIn({ov::element::f16}), + ::testing::ValuesIn({ov::element::i32, ov::element::i64}), ::testing::Values(ov::test::utils::DEVICE_GPU)), GenerateProposalsLayerTest::getTestCaseName); @@ -188,9 +51,8 @@ INSTANTIATE_TEST_SUITE_P( ::testing::ValuesIn(post_nms_count), ::testing::ValuesIn(pre_nms_count), ::testing::ValuesIn({false}), - ::testing::ValuesIn(getInputTensors()), - ::testing::ValuesIn({ov::element::Type_t::f32}), - ::testing::ValuesIn({ov::element::Type_t::i32, ov::element::Type_t::i64}), + ::testing::ValuesIn({ov::element::f32}), + ::testing::ValuesIn({ov::element::i32, ov::element::i64}), ::testing::Values(ov::test::utils::DEVICE_GPU)), GenerateProposalsLayerTest::getTestCaseName); diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/lstm_sequence.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/lstm_sequence.cpp index 95021cf61038f4..58418d07dc3a91 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/lstm_sequence.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/lstm_sequence.cpp @@ -2,20 +2,18 @@ // SPDX-License-Identifier: Apache-2.0 // -#include -#include -#include "single_layer_tests/lstm_sequence.hpp" +#include "single_op_tests/lstm_sequence.hpp" #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; - 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_CONST, - ngraph::helpers::SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_PARAM, - ngraph::helpers::SequenceTestsMode::PURE_SEQ}; +using ov::test::LSTMSequenceTest; + +std::vector mode{ov::test::utils::SequenceTestsMode::CONVERT_TO_TI_MAX_SEQ_LEN_CONST, + ov::test::utils::SequenceTestsMode::CONVERT_TO_TI_RAND_SEQ_LEN_CONST, + ov::test::utils::SequenceTestsMode::CONVERT_TO_TI_RAND_SEQ_LEN_PARAM, + ov::test::utils::SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_CONST, + ov::test::utils::SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_PARAM, + ov::test::utils::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_clip_non_zero{20}; @@ -30,11 +28,11 @@ std::vector> activations_smoke = {{"relu", "sigmoid", " std::vector clip{0.f}; std::vector clip_non_zeros{0.7f}; std::vector direction = {ov::op::RecurrentSequenceDirection::FORWARD, - ov::op::RecurrentSequenceDirection::REVERSE, - ov::op::RecurrentSequenceDirection::BIDIRECTIONAL + ov::op::RecurrentSequenceDirection::REVERSE, + ov::op::RecurrentSequenceDirection::BIDIRECTIONAL }; -std::vector netPrecisions = {InferenceEngine::Precision::FP32, - InferenceEngine::Precision::FP16}; +std::vector netPrecisions = {ov::element::f32, + ov::element::f16}; INSTANTIATE_TEST_SUITE_P(LSTMSequenceCommonZeroClip, LSTMSequenceTest, ::testing::Combine( @@ -46,14 +44,14 @@ INSTANTIATE_TEST_SUITE_P(LSTMSequenceCommonZeroClip, LSTMSequenceTest, ::testing::ValuesIn(activations), ::testing::ValuesIn(clip), ::testing::ValuesIn(direction), - ::testing::Values(ngraph::helpers::InputLayerType::CONSTANT), + ::testing::Values(ov::test::utils::InputLayerType::CONSTANT), ::testing::ValuesIn(netPrecisions), ::testing::Values(ov::test::utils::DEVICE_GPU)), LSTMSequenceTest::getTestCaseName); INSTANTIATE_TEST_SUITE_P(LSTMSequenceCommonZeroClipNonConstantWRB, LSTMSequenceTest, ::testing::Combine( - ::testing::Values(ngraph::helpers::SequenceTestsMode::PURE_SEQ), + ::testing::Values(ov::test::utils::SequenceTestsMode::PURE_SEQ), ::testing::ValuesIn(seq_lengths_zero_clip), ::testing::ValuesIn(batch), ::testing::ValuesIn(hidden_size), @@ -61,7 +59,7 @@ INSTANTIATE_TEST_SUITE_P(LSTMSequenceCommonZeroClipNonConstantWRB, LSTMSequenceT ::testing::ValuesIn(activations), ::testing::ValuesIn(clip), ::testing::ValuesIn(direction), - ::testing::Values(ngraph::helpers::InputLayerType::PARAMETER), + ::testing::Values(ov::test::utils::InputLayerType::PARAMETER), ::testing::ValuesIn(netPrecisions), ::testing::Values(ov::test::utils::DEVICE_GPU)), LSTMSequenceTest::getTestCaseName); @@ -76,7 +74,7 @@ INSTANTIATE_TEST_SUITE_P(LSTMSequenceCommonClip, LSTMSequenceTest, ::testing::ValuesIn(activations), ::testing::ValuesIn(clip_non_zeros), ::testing::ValuesIn(direction), - ::testing::Values(ngraph::helpers::InputLayerType::CONSTANT), + ::testing::Values(ov::test::utils::InputLayerType::CONSTANT), ::testing::ValuesIn(netPrecisions), ::testing::Values(ov::test::utils::DEVICE_GPU)), LSTMSequenceTest::getTestCaseName); @@ -91,7 +89,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_LSTMSequenceCommonClip, LSTMSequenceTest, ::testing::ValuesIn(activations_smoke), ::testing::ValuesIn(clip_non_zeros), ::testing::ValuesIn(direction), - ::testing::Values(ngraph::helpers::InputLayerType::CONSTANT), + ::testing::Values(ov::test::utils::InputLayerType::CONSTANT), ::testing::ValuesIn(netPrecisions), ::testing::Values(ov::test::utils::DEVICE_GPU)), LSTMSequenceTest::getTestCaseName); diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/rdft.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/rdft.cpp index 7045dc5d4d4c88..01d71d360dbca6 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/rdft.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/rdft.cpp @@ -3,22 +3,22 @@ // #include -#include -#include +#include namespace { +using ov::test::RDFTLayerTest; -const std::vector opTypes = { - ngraph::helpers::DFTOpType::FORWARD, - ngraph::helpers::DFTOpType::INVERSE, +const std::vector opTypes = { + ov::test::utils::DFTOpType::FORWARD, + ov::test::utils::DFTOpType::INVERSE, }; -const std::vector inputPrecisions = { - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::FP16, +const std::vector inputPrecisions = { + ov::element::f32, + ov::element::f16, }; -const auto combine = [](const std::vector& inputShapes, +const auto combine = [](const std::vector>& inputShapes, const std::vector>& axes, const std::vector>& signalSizes) { return testing::Combine(testing::ValuesIn(inputShapes), @@ -29,16 +29,14 @@ const auto combine = [](const std::vector& inputSha testing::Values(ov::test::utils::DEVICE_GPU)); }; -using namespace LayerTestsDefinitions; - // RDFT can support 1d INSTANTIATE_TEST_SUITE_P(smoke_RDFT_1d, RDFTLayerTest, - testing::Combine(testing::Values(InferenceEngine::SizeVector{10}), + testing::Combine(testing::Values(std::vector{10}), testing::ValuesIn(inputPrecisions), testing::Values(std::vector{0}), testing::Values(std::vector{}), - testing::Values(ngraph::helpers::DFTOpType::FORWARD), + testing::Values(ov::test::utils::DFTOpType::FORWARD), testing::Values(ov::test::utils::DEVICE_GPU)), RDFTLayerTest::getTestCaseName); @@ -84,7 +82,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_RDFT_5d_last_axis, testing::ValuesIn(inputPrecisions), testing::ValuesIn(std::vector>{{{0, 1, 2, 3, 4}}}), testing::ValuesIn(std::vector>{{}, {3, 10, 8, 6, 2}}), - testing::Values(ngraph::helpers::DFTOpType::FORWARD), + testing::Values(ov::test::utils::DFTOpType::FORWARD), testing::Values(ov::test::utils::DEVICE_GPU)), RDFTLayerTest::getTestCaseName); @@ -95,7 +93,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_RDFT_6d, testing::ValuesIn(inputPrecisions), testing::ValuesIn(std::vector>{{{0, 1, 2, 3, 4}}}), testing::ValuesIn(std::vector>{{}, {3, 10, 8, 6, 2}}), - testing::Values(ngraph::helpers::DFTOpType::INVERSE), + testing::Values(ov::test::utils::DFTOpType::INVERSE), testing::Values(ov::test::utils::DEVICE_GPU)), RDFTLayerTest::getTestCaseName); diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/skip_tests_config.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/skip_tests_config.cpp index d32efcd0f8337f..524c8fdee99e27 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/skip_tests_config.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/skip_tests_config.cpp @@ -14,7 +14,7 @@ std::vector disabledTestPatterns() { R"(.*(RNNSequenceTest).*)", R"(.*(GRUSequenceTest).*)", // These test cases might fail due to FP16 overflow - R"(.*(LSTM).*activations=\(relu.*netPRC=FP16.*)", + R"(.*(LSTM).*activations=\(relu.*modelType=f16.*)", // Need to update activation primitive to support any broadcastable constant to enable these cases. R"(.*ActivationParamLayerTest.*)", @@ -36,9 +36,9 @@ std::vector disabledTestPatterns() { // Not implemented yet: R"(.*Behavior.*ExecutableNetworkBaseTest.*canSetConfigToExecNet.*)", // TODO: Issue 67408 - R"(.*smoke_LSTMSequenceCommonClip.*LSTMSequenceTest.*CompareWithRefs.*)", + R"(.*smoke_LSTMSequenceCommonClip.*LSTMSequenceTest.*Inference.*)", // TODO: Issue 114262 - R"(LSTMSequenceCommonZeroClipNonConstantWRB/LSTMSequenceTest.CompareWithRefs/mode=PURE_SEQ_seq_lengths=2_batch=10_hidden_size=1_.*relu.*)", + R"(LSTMSequenceCommonZeroClipNonConstantWRB/LSTMSequenceTest.Inference/mode=PURE_SEQ_seq_lengths=2_batch=10_hidden_size=1_.*relu.*)", // Expected behavior. GPU plugin doesn't support i64 for eltwise power operation. R"(.*EltwiseLayerTest.*OpType=Pow.*NetType=i64.*)", // TODO: Issue: 68712 diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/ranges.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/ranges.hpp index bdcdd94fd27dd8..de5329759ad987 100644 --- a/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/ranges.hpp +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/ranges.hpp @@ -28,6 +28,8 @@ #include "openvino/op/reduce_min.hpp" #include "openvino/op/dft.hpp" #include "openvino/op/idft.hpp" +#include "openvino/op/rdft.hpp" +#include "openvino/op/irdft.hpp" #include "openvino/op/logical_and.hpp" #include "openvino/op/logical_or.hpp" #include "openvino/op/logical_xor.hpp" @@ -93,11 +95,13 @@ static std::map static std::string getTestCaseName(const testing::TestParamInfo &obj); protected: + //TO DO, to be removed after 125993 + void generate_inputs(const std::vector& targetInputStaticShapes) override; void SetUp() override; }; class ActivationParamLayerTest : public ActivationLayerTest { protected: + //TO DO, to be removed after 125993 + void generate_inputs(const std::vector& targetInputStaticShapes) override; void SetUp() override; }; } // namespace test diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/dft.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/dft.hpp index 4160a36c2e1f9e..5cd78bf3fb8198 100644 --- a/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/dft.hpp +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/dft.hpp @@ -27,6 +27,8 @@ class DFTLayerTest : public testing::WithParamInterface, static std::string getTestCaseName(const testing::TestParamInfo& obj); protected: + //TO DO, to be removed after 125993 + void generate_inputs(const std::vector& targetInputStaticShapes) override; void SetUp() override; }; } // namespace test diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/generate_proposals.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/generate_proposals.hpp index 170c1753efee2f..c58e573f9c9fce 100644 --- a/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/generate_proposals.hpp +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/generate_proposals.hpp @@ -26,6 +26,7 @@ class GenerateProposalsLayerTest : virtual public SubgraphBaseTest { protected: void SetUp() override; + void compare(const std::vector& expected, const std::vector& actual) override; public: static std::string getTestCaseName(const testing::TestParamInfo& obj); }; diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/rdft.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/rdft.hpp index 83675c0e0fb0a4..e68c1dad92d2b3 100644 --- a/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/rdft.hpp +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/rdft.hpp @@ -27,6 +27,8 @@ class RDFTLayerTest : public testing::WithParamInterface, static std::string getTestCaseName(const testing::TestParamInfo& obj); protected: + //TO DO, to be removed after 125993 + void generate_inputs(const std::vector& targetInputStaticShapes) override; void SetUp() override; }; } // namespace test diff --git a/src/tests/functional/shared_test_classes/src/base/utils/compare_results.cpp b/src/tests/functional/shared_test_classes/src/base/utils/compare_results.cpp index 3777e352945f41..0aed51b03a1b6f 100644 --- a/src/tests/functional/shared_test_classes/src/base/utils/compare_results.cpp +++ b/src/tests/functional/shared_test_classes/src/base/utils/compare_results.cpp @@ -10,6 +10,7 @@ #include "shared_test_classes/base/utils/compare_results.hpp" #include +#include "shared_test_classes/base/layer_test_utils.hpp" namespace ov { namespace test { diff --git a/src/tests/functional/shared_test_classes/src/single_op/activation.cpp b/src/tests/functional/shared_test_classes/src/single_op/activation.cpp index b0d27e82eab253..d4f52dfd61fe71 100644 --- a/src/tests/functional/shared_test_classes/src/single_op/activation.cpp +++ b/src/tests/functional/shared_test_classes/src/single_op/activation.cpp @@ -8,10 +8,160 @@ #include "openvino/op/parameter.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/result.hpp" +#include namespace ov { namespace test { using ov::test::utils::ActivationTypes; +void ActivationLayerTest::generate_inputs(const std::vector& targetInputStaticShapes) { + ov::element::Type model_type; + std::pair, ov::Shape> input_shapes; + std::pair> activationDecl; + std::tie(activationDecl, model_type, input_shapes, targetDevice) = GetParam(); + + bool inPrcSigned = function->get_parameters()[0]->get_element_type().is_signed(); + int32_t data_start_from; + uint32_t data_range; + int32_t resolution; + + switch (activationDecl.first) { + case ActivationTypes::Log: { + data_start_from = 1; + data_range = 20; + resolution = 32768; + break; + } + case ActivationTypes::Sqrt: { + data_start_from = 0; + data_range = 20; + resolution = 32768; + break; + } + case ActivationTypes::Asin: { + data_start_from = -1; + data_range = 2; + resolution = 32768; + break; + } + case ActivationTypes::Acos: { + data_start_from = -1; + data_range = 2; + resolution = 32768; + break; + } + case ActivationTypes::Acosh: { + data_start_from = 1; + data_range = 200; + resolution = 32768; + break; + } + case ActivationTypes::Atanh: { + data_start_from = -1; + data_range = 2; + resolution = 32768; + break; + } + case ActivationTypes::Ceiling: { + data_start_from = -1000; + data_range = 2000; + resolution = 32768; + break; + } + case ActivationTypes::RoundHalfToEven: { + data_start_from = -10; + data_range = 20; + resolution = 4; + break; + } + case ActivationTypes::RoundHalfAwayFromZero: { + data_start_from = -10; + data_range = 20; + resolution = 4; + break; + } + case ActivationTypes::Mish: { + data_start_from = -20; + data_range = 60; + resolution = 32768; + break; + } + case ActivationTypes::SoftPlus: { + data_start_from = -100; + data_range = 200; + resolution = 32768; + break; + } + case ActivationTypes::SoftSign: { + data_start_from = -100; + data_range = 200; + resolution = 32768; + break; + } + default: { + data_start_from = -10; + data_range = 20; + resolution = 32768; + break; + } + } + if (!inPrcSigned) { + data_range = 15; + data_start_from = 0; + } + const auto& funcInputs = function->inputs(); + auto funcInput = funcInputs.begin(); + inputs.clear(); + runtime::Tensor data_tensor = ov::test::utils::create_and_fill_tensor_act_dft(funcInput->get_element_type(), + targetInputStaticShapes[0], + data_range, + data_start_from, + resolution, 1); + inputs.insert({funcInput->get_node_shared_ptr(), data_tensor}); +} + +void ActivationParamLayerTest::generate_inputs(const std::vector& targetInputStaticShapes) { + ov::element::Type model_type; + std::pair, ov::Shape> input_shapes; + std::pair> activationDecl; + std::tie(activationDecl, model_type, input_shapes, targetDevice) = GetParam(); + + auto activationType = activationDecl.first; + auto constants_value = activationDecl.second; + + inputs.clear(); + const auto& funcInputs = function->inputs(); + for (size_t i = 0; i < funcInputs.size(); ++i) { + const auto& funcInput = funcInputs[i]; + runtime::Tensor data_tensor; + const std::string& name = funcInput.get_node()->get_friendly_name(); + if (0 == name.compare("negativeSlope")) { + ov::test::utils::InputGenerateData in_data; + in_data.start_from = -0.01; + in_data.range = 0; + data_tensor = ov::test::utils::create_and_fill_tensor_act_dft(funcInput.get_element_type(), + targetInputStaticShapes[i], + in_data.range, + in_data.start_from, + in_data.resolution, 1); + } else if (0 == name.compare("leakySlope")) { + ov::test::utils::InputGenerateData in_data; + in_data.start_from = 0.01; + in_data.range = 0; + data_tensor = ov::test::utils::create_and_fill_tensor_act_dft(funcInput.get_element_type(), + targetInputStaticShapes[i], + in_data.range, + in_data.start_from, + in_data.resolution, 1); + } else if (0 == name.compare("alpha")) { + data_tensor = ov::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i], &constants_value[0]); + } else if (0 == name.compare("beta") || 0 == name.compare("lambda")) { + data_tensor = ov::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i], &constants_value[1]); + } else { + data_tensor = ov::test::utils::create_and_fill_tensor_act_dft(funcInput.get_element_type(), targetInputStaticShapes[i], 20, -10, 1); + } + inputs.insert({funcInput.get_node_shared_ptr(), data_tensor}); + } +} std::string ActivationLayerTest::getTestCaseName(const testing::TestParamInfo &obj) { ov::element::Type model_type; diff --git a/src/tests/functional/shared_test_classes/src/single_op/dft.cpp b/src/tests/functional/shared_test_classes/src/single_op/dft.cpp index efa0570924ed1c..654a7185be1431 100644 --- a/src/tests/functional/shared_test_classes/src/single_op/dft.cpp +++ b/src/tests/functional/shared_test_classes/src/single_op/dft.cpp @@ -3,11 +3,61 @@ // #include "shared_test_classes/single_op/dft.hpp" - #include "common_test_utils/node_builders/dft.hpp" +#include "common_test_utils/ov_tensor_utils.hpp" +#include "shared_test_classes/base/utils/ranges.hpp" namespace ov { namespace test { +static inline void set_real_number_generation_data(utils::InputGenerateData& inGenData) { + inGenData.range = 8; + inGenData.resolution = 32; +} + +void DFTLayerTest::generate_inputs(const std::vector& targetInputStaticShapes) { + std::vector shapes; + ov::element::Type model_type; + std::vector axes; + std::vector signal_size; + ov::test::utils::DFTOpType op_type; + std::string target_device; + std::tie(shapes, model_type, axes, signal_size, op_type, target_device) = GetParam(); + + auto elemType = model_type; + bool inPrcSigned = elemType.is_signed(); + + ov::test::utils::InputGenerateData inGenData; + if (elemType.is_real()) { + set_real_number_generation_data(inGenData); + } + + const auto& funcInputs = function->inputs(); + auto funcInput = funcInputs.begin(); + + const auto node = funcInput->get_node_shared_ptr(); + const size_t inNodeCnt = node->get_input_size(); + + auto it = ov::test::utils::inputRanges.find(ov::op::v7::DFT::get_type_info_static()); + if (op_type == ov::test::utils::DFTOpType::INVERSE) { + it = ov::test::utils::inputRanges.find(ov::op::v7::IDFT::get_type_info_static()); + } + + if (it != ov::test::utils::inputRanges.end()) { + const auto& ranges = it->second; + if (ranges.size() != 2) { + throw std::runtime_error("Incorrect size of ranges. It should be 2 (real and int cases)"); + } + const auto& range = ranges.at(elemType.is_real()); + inGenData = range.size() < inNodeCnt ? range.front() : range.at(0); + } + + inputs.clear(); + runtime::Tensor data_tensor = ov::test::utils::create_and_fill_tensor_act_dft(funcInput->get_element_type(), + targetInputStaticShapes[0], + inGenData.range, inGenData.start_from, inGenData.resolution, inGenData.seed); + inputs.insert({funcInput->get_node_shared_ptr(), data_tensor}); +} + std::string DFTLayerTest::getTestCaseName(const testing::TestParamInfo& obj) { std::vector shapes; ov::element::Type model_type; diff --git a/src/tests/functional/shared_test_classes/src/single_op/generate_proposals.cpp b/src/tests/functional/shared_test_classes/src/single_op/generate_proposals.cpp index ee6bde40c0dc07..99e49061376d31 100644 --- a/src/tests/functional/shared_test_classes/src/single_op/generate_proposals.cpp +++ b/src/tests/functional/shared_test_classes/src/single_op/generate_proposals.cpp @@ -3,6 +3,8 @@ // #include "shared_test_classes/single_op/generate_proposals.hpp" +#include "shared_test_classes/base/layer_test_utils.hpp" +#include "common_test_utils/ov_tensor_utils.hpp" namespace ov { namespace test { @@ -91,5 +93,63 @@ void GenerateProposalsLayerTest::SetUp() { params, "GenerateProposals"); } + +void GenerateProposalsLayerTest::compare(const std::vector& expected, + const std::vector& actual) { + if (targetDevice != ov::test::utils::DEVICE_GPU) { + SubgraphBaseTest::compare(expected, actual); + return; + } + + const auto outputsNum = expected.size(); + ASSERT_EQ(outputsNum, 3); + ASSERT_EQ(outputsNum, actual.size()); + ASSERT_EQ(outputsNum, function->get_results().size()); + + // actual outputs 0 (rois) and 1 (roi_scores) may be padded with zeros + for (size_t i = 0; i < 2; ++i) { + const auto expectedNumRois = expected[i].get_shape()[0]; + const auto actualNumRois = actual[i].get_shape()[0]; + ASSERT_LE(expectedNumRois, actualNumRois); + + const auto actualBuffer = static_cast(actual[i].data()); + const auto expectedBuffer = static_cast(expected[i].data()); + const auto outputSize = i == 0 ? 4 : 1; + + if (outType == ov::element::f32) { + LayerTestsUtils::LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), + reinterpret_cast(actualBuffer), + expectedNumRois * outputSize, + rel_threshold, + abs_threshold); + } else { + LayerTestsUtils::LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), + reinterpret_cast(actualBuffer), + expectedNumRois * outputSize, + rel_threshold, + abs_threshold); + } + + if (expectedNumRois < actualNumRois) { + if (outType == ov::element::f32) { + const auto fBuffer = static_cast(actual[i].data()); + for (size_t j = expectedNumRois * outputSize; j < actualNumRois * outputSize; ++j) { + ASSERT_TRUE(fBuffer[j] == 0.0f) + << "Expected 0.0, actual: " << fBuffer[j] << " at index: " << j << ", output: " << i; + } + } else { + const float16 zero{0}; + const auto fBuffer = static_cast(actual[i].data()); + for (size_t j = expectedNumRois * outputSize; j < actualNumRois * outputSize; ++j) { + ASSERT_TRUE(fBuffer[j] == zero) + << "Expected 0.0, actual: " << fBuffer[j] << " at index: " << j << ", output: " << i; + } + } + } + } + + // output 2 - rois_num + ov::test::utils::compare(expected[2], actual[2], abs_threshold, rel_threshold); +} } // namespace test } // namespace ov diff --git a/src/tests/functional/shared_test_classes/src/single_op/rdft.cpp b/src/tests/functional/shared_test_classes/src/single_op/rdft.cpp index 247f78d2156f03..bbadca390fb492 100644 --- a/src/tests/functional/shared_test_classes/src/single_op/rdft.cpp +++ b/src/tests/functional/shared_test_classes/src/single_op/rdft.cpp @@ -4,9 +4,59 @@ #include "shared_test_classes/single_op/rdft.hpp" #include "common_test_utils/node_builders/rdft.hpp" +#include "common_test_utils/ov_tensor_utils.hpp" +#include "shared_test_classes/base/utils/ranges.hpp" namespace ov { namespace test { +static inline void set_real_number_generation_data(utils::InputGenerateData& inGenData) { + inGenData.range = 8; + inGenData.resolution = 32; +} + +void RDFTLayerTest::generate_inputs(const std::vector& targetInputStaticShapes) { + std::vector input_shape; + ov::element::Type model_type; + std::vector axes; + std::vector signal_size; + ov::test::utils::DFTOpType op_type; + std::string target_device; + std::tie(input_shape, model_type, axes, signal_size, op_type, targetDevice) = this->GetParam(); + + auto elemType = model_type; + + ov::test::utils::InputGenerateData inGenData; + if (elemType.is_real()) { + set_real_number_generation_data(inGenData); + } + + const auto& funcInputs = function->inputs(); + auto funcInput = funcInputs.begin(); + + const auto node = funcInput->get_node_shared_ptr(); + const size_t inNodeCnt = node->get_input_size(); + + auto it = ov::test::utils::inputRanges.find(ov::op::v9::RDFT::get_type_info_static()); + if (op_type == ov::test::utils::DFTOpType::INVERSE) { + it = ov::test::utils::inputRanges.find(ov::op::v9::IRDFT::get_type_info_static()); + } + + if (it != ov::test::utils::inputRanges.end()) { + const auto& ranges = it->second; + if (ranges.size() != 2) { + throw std::runtime_error("Incorrect size of ranges. It should be 2 (real and int cases)"); + } + const auto& range = ranges.at(elemType.is_real()); + inGenData = range.size() < inNodeCnt ? range.front() : range.at(0); + } + + inputs.clear(); + runtime::Tensor data_tensor = ov::test::utils::create_and_fill_tensor_act_dft(funcInput->get_element_type(), + targetInputStaticShapes[0], + inGenData.range, inGenData.start_from, inGenData.resolution, inGenData.seed); + inputs.insert({funcInput->get_node_shared_ptr(), data_tensor}); +} + std::string RDFTLayerTest::getTestCaseName(const testing::TestParamInfo& obj) { std::vector input_shape; ov::element::Type model_type; diff --git a/src/tests/test_utils/common_test_utils/include/common_test_utils/data_utils.hpp b/src/tests/test_utils/common_test_utils/include/common_test_utils/data_utils.hpp index f9afd2a0e0fbe0..4f318ef98b3f03 100644 --- a/src/tests/test_utils/common_test_utils/include/common_test_utils/data_utils.hpp +++ b/src/tests/test_utils/common_test_utils/include/common_test_utils/data_utils.hpp @@ -204,6 +204,32 @@ void inline fill_data_random(T* pointer, } } +template +void inline fill_data_random_act_dft(T* pointer, + std::size_t size, + const uint32_t range = 10, + double_t start_from = 0, + const int32_t k = 1, + const int seed = 1) { + if (range == 0) { + for (std::size_t i = 0; i < size; i++) { + pointer[i] = static_cast(start_from); + } + return; + } + + testing::internal::Random random(seed); + const uint32_t k_range = k * range; // range with respect to k + random.Generate(k_range); + + if (start_from < 0 && !std::numeric_limits::is_signed) { + start_from = 0; + } + for (std::size_t i = 0; i < size; i++) { + pointer[i] = static_cast(start_from + static_cast(random.Generate(k_range)) / k); + } +} + /** @brief Fill a memory area with a sorted sequence of unique elements randomly generated. * * This function generates and fills a blob of a certain precision, with a diff --git a/src/tests/test_utils/common_test_utils/include/common_test_utils/ov_tensor_utils.hpp b/src/tests/test_utils/common_test_utils/include/common_test_utils/ov_tensor_utils.hpp index 9b2897bb049b1d..57f8060e281f02 100644 --- a/src/tests/test_utils/common_test_utils/include/common_test_utils/ov_tensor_utils.hpp +++ b/src/tests/test_utils/common_test_utils/include/common_test_utils/ov_tensor_utils.hpp @@ -46,6 +46,13 @@ static ov::runtime::Tensor create_tensor(const ov::element::Type& element_type, return tensor; } +ov::runtime::Tensor create_and_fill_tensor_act_dft(const ov::element::Type element_type, + const ov::Shape& shape, + const uint32_t range = 10, + const double_t start_from = 0, + const int32_t resolution = 1, + const int seed = 1); + ov::runtime::Tensor create_and_fill_tensor_unique_sequence(const ov::element::Type element_type, const ov::Shape& shape, const int32_t start_from = 0, diff --git a/src/tests/test_utils/common_test_utils/src/node_builders/activation.cpp b/src/tests/test_utils/common_test_utils/src/node_builders/activation.cpp index a24458e7fede20..fe692238938994 100644 --- a/src/tests/test_utils/common_test_utils/src/node_builders/activation.cpp +++ b/src/tests/test_utils/common_test_utils/src/node_builders/activation.cpp @@ -59,7 +59,7 @@ std::shared_ptr make_activation(const ov::Output& in, case ov::test::utils::ActivationTypes::Relu: return std::make_shared(in); case ov::test::utils::ActivationTypes::LeakyRelu: { - auto leaky_slope = std::make_shared(ov::element::f32, in_shape, constants_value); + auto leaky_slope = std::make_shared(type, in_shape, constants_value); return std::make_shared(in, leaky_slope); } case ov::test::utils::ActivationTypes::Exp: @@ -119,7 +119,7 @@ std::shared_ptr make_activation(const ov::Output& in, case ov::test::utils::ActivationTypes::Ceiling: return std::make_shared(in); case ov::test::utils::ActivationTypes::PReLu: { - auto negative_slope = std::make_shared(ov::element::f32, in_shape, constants_value); + auto negative_slope = std::make_shared(type, in_shape, constants_value); return std::make_shared(in, negative_slope); } case ov::test::utils::ActivationTypes::Mish: diff --git a/src/tests/test_utils/common_test_utils/src/ov_tensor_utils.cpp b/src/tests/test_utils/common_test_utils/src/ov_tensor_utils.cpp index 8f8a503af9db21..2377ad37aaa2f4 100644 --- a/src/tests/test_utils/common_test_utils/src/ov_tensor_utils.cpp +++ b/src/tests/test_utils/common_test_utils/src/ov_tensor_utils.cpp @@ -78,6 +78,54 @@ ov::Tensor create_and_fill_tensor(const ov::element::Type element_type, ov::test::utils::InputGenerateData(start_from, range, resolution, seed)); } +ov::Tensor create_and_fill_tensor_act_dft(const ov::element::Type element_type, + const ov::Shape& shape, + const uint32_t range, + const double_t start_from, + const int32_t resolution, + const int seed) { + auto tensor = ov::Tensor{element_type, shape}; +#define CASE(X) \ + case X: \ + fill_data_random_act_dft(tensor.data::value_type>(), \ + shape_size(shape), \ + range, \ + start_from, \ + resolution, \ + seed); \ + break; + switch (element_type) { + CASE(ov::element::Type_t::boolean) + CASE(ov::element::Type_t::i8) + CASE(ov::element::Type_t::i16) + CASE(ov::element::Type_t::i32) + CASE(ov::element::Type_t::i64) + CASE(ov::element::Type_t::u8) + CASE(ov::element::Type_t::u16) + CASE(ov::element::Type_t::u32) + CASE(ov::element::Type_t::u64) + CASE(ov::element::Type_t::bf16) + CASE(ov::element::Type_t::f16) + CASE(ov::element::Type_t::f32) + CASE(ov::element::Type_t::f64) + case ov::element::Type_t::u1: + case ov::element::Type_t::i4: + case ov::element::Type_t::u4: + case ov::element::Type_t::nf4: + fill_data_random_act_dft(static_cast(tensor.data()), + tensor.get_byte_size(), + range, + start_from, + resolution, + seed); + break; + default: + OPENVINO_THROW("Unsupported element type: ", element_type); + } +#undef CASE + return tensor; +} + ov::Tensor create_and_fill_tensor_unique_sequence(const ov::element::Type element_type, const ov::Shape& shape, const int32_t start_from,