From 31670dacb47392ab9c9a21c930fe6c2f365fa92c Mon Sep 17 00:00:00 2001 From: Andrei Gorbachev Date: Fri, 13 Oct 2023 10:36:47 +0100 Subject: [PATCH] [GPU] Refactor CTCGreedyDecoderSeqLen, CTCGreedyDecoder, CTCLoss (#20432) * CTCGreedyDecoderSeqLen, CTCGreedyDecoder * CTCLoss --------- Co-authored-by: Pavel Durandin --- .../single_layer_tests/ctc_greedy_decoder.cpp | 36 +++++++++---------- .../ctc_greedy_decoder_seq_len.cpp | 26 +++++++------- .../single_layer_tests/ctc_loss.cpp | 35 +++++++++--------- 3 files changed, 46 insertions(+), 51 deletions(-) diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/ctc_greedy_decoder.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/ctc_greedy_decoder.cpp index 2206490567e..b7c2807ce37 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/ctc_greedy_decoder.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/ctc_greedy_decoder.cpp @@ -3,35 +3,33 @@ // #include -#include "single_layer_tests/ctc_greedy_decoder.hpp" +#include "single_op_tests/ctc_greedy_decoder.hpp" #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; -using namespace ngraph::helpers; - namespace { +using ov::test::CTCGreedyDecoderLayerTest; + // Common params -const std::vector netPrecisions = { - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::FP16 +const std::vector netPrecisions = { + ov::element::f32, + ov::element::f16 }; std::vector mergeRepeated{true, false}; +std::vector> input_shapes_static = { + {{ 50, 3, 3 }}, + {{ 50, 3, 7 }}, + {{ 50, 3, 8 }}, + {{ 50, 3, 16 }}, + {{ 50, 3, 128 }}, + {{ 50, 3, 49 }}, + {{ 50, 3, 55 }}, + {{ 1, 1, 16 }}}; + INSTANTIATE_TEST_SUITE_P(smoke_CtcGreedyDecoderBasic, CTCGreedyDecoderLayerTest, ::testing::Combine(::testing::ValuesIn(netPrecisions), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(std::vector({50, 3, 3}), - std::vector({50, 3, 7}), - std::vector({50, 3, 8}), - std::vector({50, 3, 16}), - std::vector({50, 3, 128}), - std::vector({50, 3, 49}), - std::vector({50, 3, 55}), - std::vector({1, 1, 16})), + ::testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shapes_static)), ::testing::ValuesIn(mergeRepeated), ::testing::Values(ov::test::utils::DEVICE_GPU)), CTCGreedyDecoderLayerTest::getTestCaseName); diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/ctc_greedy_decoder_seq_len.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/ctc_greedy_decoder_seq_len.cpp index c015258d41e..12d318d107d 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/ctc_greedy_decoder_seq_len.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/ctc_greedy_decoder_seq_len.cpp @@ -3,30 +3,28 @@ // #include -#include "single_layer_tests/ctc_greedy_decoder_seq_len.hpp" +#include "single_op_tests/ctc_greedy_decoder_seq_len.hpp" #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; -using namespace ngraph::helpers; - namespace { +using ov::test::CTCGreedyDecoderSeqLenLayerTest; -std::vector> inputShape{{1, 1, 1}, {1, 6, 10}, {3, 3, 16}, {5, 3, 55}}; +std::vector> inputShape{{{1, 1, 1}}, {{1, 6, 10}}, {{3, 3, 16}}, {{5, 3, 55}}}; -const std::vector probPrecisions = { - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::FP16 +const std::vector probPrecisions = { + ov::element::f32, + ov::element::f16 }; -const std::vector idxPrecisions = { - InferenceEngine::Precision::I32, - InferenceEngine::Precision::I64 +const std::vector idxPrecisions = { + ov::element::i32, + ov::element::i64 }; std::vector mergeRepeated{true, false}; INSTANTIATE_TEST_SUITE_P(smoke_set1, CTCGreedyDecoderSeqLenLayerTest, - ::testing::Combine(::testing::ValuesIn(inputShape), + ::testing::Combine(::testing::ValuesIn(ov::test::static_shapes_to_test_representation(inputShape)), ::testing::Values(10), ::testing::ValuesIn(probPrecisions), ::testing::ValuesIn(idxPrecisions), @@ -37,8 +35,8 @@ INSTANTIATE_TEST_SUITE_P(smoke_set1, INSTANTIATE_TEST_SUITE_P(smoke_set2, CTCGreedyDecoderSeqLenLayerTest, - ::testing::Combine(::testing::ValuesIn(std::vector>{{2, 8, 11}, - {4, 10, 55}}), + ::testing::Combine(::testing::ValuesIn(ov::test::static_shapes_to_test_representation(std::vector>{{{2, 8, 11}}, + {{4, 10, 55}}})), ::testing::ValuesIn(std::vector{5, 100}), ::testing::ValuesIn(probPrecisions), ::testing::ValuesIn(idxPrecisions), diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/ctc_loss.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/ctc_loss.cpp index 9e71f45de30..742b4974e6f 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/ctc_loss.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/ctc_loss.cpp @@ -2,22 +2,21 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "single_layer_tests/ctc_loss.hpp" +#include "single_op_tests/ctc_loss.hpp" #include -using namespace LayerTestsDefinitions; - namespace { +using ov::test::CTCLossLayerTest; -const std::vector fPrecisions = { - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::FP16, +const std::vector fPrecisions = { + ov::element::f32, + ov::element::f16, }; -const std::vector iPrecisions = { - InferenceEngine::Precision::I32, - InferenceEngine::Precision::I64, +const std::vector iPrecisions = { + ov::element::i32, + ov::element::i64, }; const std::vector preprocessCollapseRepeated = {true, false}; @@ -25,7 +24,6 @@ const std::vector ctcMergeRepeated = {true, false}; const std::vector unique = {true, false}; const auto ctcLossArgsSubset1 = testing::Combine( - testing::Values(std::vector({2, 3, 3})), // logits shape testing::ValuesIn(std::vector>({{2, 3}, {3, 3}})), // logits length testing::ValuesIn( std::vector>>({{{0, 1, 0}, {1, 0, 1}}, {{0, 1, 2}, {1, 1, 1}}})), // labels @@ -38,14 +36,14 @@ const auto ctcLossArgsSubset1 = testing::Combine( INSTANTIATE_TEST_SUITE_P(smoke_CTCLoss_Set1, CTCLossLayerTest, testing::Combine(ctcLossArgsSubset1, - testing::ValuesIn(fPrecisions), - testing::ValuesIn(iPrecisions), - testing::Values(ov::test::utils::DEVICE_GPU)), + testing::Values(ov::test::static_shapes_to_test_representation({{2, 3, 3}})), // logits shape + testing::ValuesIn(fPrecisions), + testing::ValuesIn(iPrecisions), + testing::Values(ov::test::utils::DEVICE_GPU)), CTCLossLayerTest::getTestCaseName); const auto ctcLossArgsSubset2 = - testing::Combine(testing::Values(std::vector({3, 6, 8})), // logits shape - testing::ValuesIn(std::vector>({{6, 5, 6}, {5, 5, 5}})), // logits length + testing::Combine(testing::ValuesIn(std::vector>({{6, 5, 6}, {5, 5, 5}})), // logits length testing::ValuesIn(std::vector>>( {{{4, 1, 2, 3, 4, 5}, {5, 4, 3, 0, 1, 0}, {2, 1, 3, 1, 3, 0}}, {{2, 1, 5, 3, 2, 6}, {3, 3, 3, 3, 3, 3}, {6, 5, 6, 5, 6, 5}}})), // labels @@ -58,8 +56,9 @@ const auto ctcLossArgsSubset2 = INSTANTIATE_TEST_SUITE_P(smoke_CTCLoss_Set2, CTCLossLayerTest, testing::Combine(ctcLossArgsSubset2, - testing::ValuesIn(fPrecisions), - testing::ValuesIn(iPrecisions), - testing::Values(ov::test::utils::DEVICE_GPU)), + testing::Values(ov::test::static_shapes_to_test_representation({{3, 6, 8}})), // logits shape + testing::ValuesIn(fPrecisions), + testing::ValuesIn(iPrecisions), + testing::Values(ov::test::utils::DEVICE_GPU)), CTCLossLayerTest::getTestCaseName); } // namespace