[GPU] Refactor CTCGreedyDecoderSeqLen, CTCGreedyDecoder, CTCLoss (#20432)

* CTCGreedyDecoderSeqLen, CTCGreedyDecoder

* CTCLoss

---------

Co-authored-by: Pavel Durandin <pavel.durandin@intel.com>
This commit is contained in:
Andrei Gorbachev 2023-10-13 10:36:47 +01:00 committed by GitHub
parent e866bfef42
commit 31670dacb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 51 deletions

View File

@ -3,35 +3,33 @@
//
#include <vector>
#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<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
const std::vector<ov::element::Type> netPrecisions = {
ov::element::f32,
ov::element::f16
};
std::vector<bool> mergeRepeated{true, false};
std::vector<std::vector<ov::Shape>> 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<size_t>({50, 3, 3}),
std::vector<size_t>({50, 3, 7}),
std::vector<size_t>({50, 3, 8}),
std::vector<size_t>({50, 3, 16}),
std::vector<size_t>({50, 3, 128}),
std::vector<size_t>({50, 3, 49}),
std::vector<size_t>({50, 3, 55}),
std::vector<size_t>({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);

View File

@ -3,30 +3,28 @@
//
#include <vector>
#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<std::vector<size_t>> inputShape{{1, 1, 1}, {1, 6, 10}, {3, 3, 16}, {5, 3, 55}};
std::vector<std::vector<ov::Shape>> inputShape{{{1, 1, 1}}, {{1, 6, 10}}, {{3, 3, 16}}, {{5, 3, 55}}};
const std::vector<InferenceEngine::Precision> probPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
const std::vector<ov::element::Type> probPrecisions = {
ov::element::f32,
ov::element::f16
};
const std::vector<InferenceEngine::Precision> idxPrecisions = {
InferenceEngine::Precision::I32,
InferenceEngine::Precision::I64
const std::vector<ov::element::Type> idxPrecisions = {
ov::element::i32,
ov::element::i64
};
std::vector<bool> 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<std::vector<size_t>>{{2, 8, 11},
{4, 10, 55}}),
::testing::Combine(::testing::ValuesIn(ov::test::static_shapes_to_test_representation(std::vector<std::vector<ov::Shape>>{{{2, 8, 11}},
{{4, 10, 55}}})),
::testing::ValuesIn(std::vector<int>{5, 100}),
::testing::ValuesIn(probPrecisions),
::testing::ValuesIn(idxPrecisions),

View File

@ -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 <vector>
using namespace LayerTestsDefinitions;
namespace {
using ov::test::CTCLossLayerTest;
const std::vector<InferenceEngine::Precision> fPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16,
const std::vector<ov::element::Type> fPrecisions = {
ov::element::f32,
ov::element::f16,
};
const std::vector<InferenceEngine::Precision> iPrecisions = {
InferenceEngine::Precision::I32,
InferenceEngine::Precision::I64,
const std::vector<ov::element::Type> iPrecisions = {
ov::element::i32,
ov::element::i64,
};
const std::vector<bool> preprocessCollapseRepeated = {true, false};
@ -25,7 +24,6 @@ const std::vector<bool> ctcMergeRepeated = {true, false};
const std::vector<bool> unique = {true, false};
const auto ctcLossArgsSubset1 = testing::Combine(
testing::Values(std::vector<size_t>({2, 3, 3})), // logits shape
testing::ValuesIn(std::vector<std::vector<int>>({{2, 3}, {3, 3}})), // logits length
testing::ValuesIn(
std::vector<std::vector<std::vector<int>>>({{{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<size_t>({3, 6, 8})), // logits shape
testing::ValuesIn(std::vector<std::vector<int>>({{6, 5, 6}, {5, 5, 5}})), // logits length
testing::Combine(testing::ValuesIn(std::vector<std::vector<int>>({{6, 5, 6}, {5, 5, 5}})), // logits length
testing::ValuesIn(std::vector<std::vector<std::vector<int>>>(
{{{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