Skip to content

Commit

Permalink
[gpu]: STFT: REfactored func tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
pkowalc1 committed Dec 16, 2024
1 parent dafc623 commit 2d02564
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 138 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,75 +10,10 @@

namespace ov {
namespace test {
using ov::test::STFTLayerTest;

const std::vector<ov::element::Type> data_type = {ov::element::f32, ov::element::bf16};
const std::vector<ov::element::Type> step_size_type = {ov::element::i32, ov::element::i64};

const std::vector<std::vector<InputShape>> input_shapes = {
{ // Static shapes
{{}, {{128}}}, // 1st input
{{}, {{8}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
},
{ // Static shapes
{{}, {{1, 128}}}, // 1st input
{{}, {{8}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
},
{ // Static shapes
{{}, {{2, 226}}}, // 1st input
{{}, {{16}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
},
{ // Dynamic dims in the first input shape
{{-1, -1}, {{1, 128}, {2, 226}}}, // 1st input
{{}, {{8}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
},
{ // Dynamic dims in the first and second input shape
{{-1}, {{128}}}, // 1st input
{{-1}, {{8}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
},
{ // Dynamic dims in the first and second input shape
{{-1, -1}, {{1, 128}, {2, 226}}}, // 1st input
{{-1}, {{8}, {16}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
},
{ // Dynamic dims with range in the first and second input shape
{{{2, 4}, {1, 300}}, {{2, 226}, {3, 128}}}, // 1st input
{{{3, 16}}, {{4}, {16}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
}
};

const std::vector<int64_t> frame_size = {16, 24};
const std::vector<int64_t> step_size = {2, 3, 4};

const std::vector<bool> transpose_frames = {
false,
true,
};

std::vector<utils::InputLayerType> in_types = {utils::InputLayerType::CONSTANT, utils::InputLayerType::PARAMETER};

const auto testCaseStatic = ::testing::Combine(::testing::ValuesIn(input_shapes),
::testing::ValuesIn(frame_size),
::testing::ValuesIn(step_size),
::testing::ValuesIn(transpose_frames),
::testing::ValuesIn(data_type),
::testing::ValuesIn(step_size_type),
::testing::ValuesIn(in_types),
::testing::Values(ov::test::utils::DEVICE_CPU));

INSTANTIATE_TEST_SUITE_P(smoke_STFT_static, STFTLayerTest, testCaseStatic, STFTLayerTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_STFT_static,
STFTLayerTest,
STFTLayerTest::GetTestDataForDevice(ov::test::utils::DEVICE_CPU),
STFTLayerTest::getTestCaseName);
} // namespace test
} // namespace ov
Original file line number Diff line number Diff line change
Expand Up @@ -4,79 +4,14 @@

#include "single_op_tests/stft.hpp"

#include <vector>

#include "common_test_utils/test_constants.hpp"

namespace ov {
namespace test {
const std::vector<ov::element::Type> data_type = {ov::element::bf16, ov::element::f16};
const std::vector<ov::element::Type> step_size_type = {ov::element::i32, ov::element::i64};

const std::vector<std::vector<InputShape>> input_shapes = {
{ // Static shapes
{{}, {{128}}}, // 1st input
{{}, {{8}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
},
{ // Static shapes
{{}, {{1, 128}}}, // 1st input
{{}, {{8}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
},
{ // Static shapes
{{}, {{2, 226}}}, // 1st input
{{}, {{16}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
},
{ // Dynamic dims in the first input shape
{{-1, -1}, {{1, 128}, {2, 226}}}, // 1st input
{{}, {{8}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
},
{ // Dynamic dims in the first and second input shape
{{-1}, {{128}}}, // 1st input
{{-1}, {{8}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
},
{ // Dynamic dims in the first and second input shape
{{-1, -1}, {{1, 128}, {2, 226}}}, // 1st input
{{-1}, {{8}, {16}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
},
{ // Dynamic dims with range in the first and second input shape
{{{2, 4}, {1, 300}}, {{2, 226}, {3, 128}}}, // 1st input
{{{3, 16}}, {{4}, {16}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
}
};

const std::vector<int64_t> frame_size = {16, 24};
const std::vector<int64_t> step_size = {2, 3, 4};

const std::vector<bool> transpose_frames = {
false,
true,
};

std::vector<utils::InputLayerType> in_types = {utils::InputLayerType::CONSTANT, utils::InputLayerType::PARAMETER};

const auto testCaseStatic = ::testing::Combine(::testing::ValuesIn(input_shapes),
::testing::ValuesIn(frame_size),
::testing::ValuesIn(step_size),
::testing::ValuesIn(transpose_frames),
::testing::ValuesIn(data_type),
::testing::ValuesIn(step_size_type),
::testing::ValuesIn(in_types),
::testing::Values(ov::test::utils::DEVICE_GPU));

INSTANTIATE_TEST_SUITE_P(smoke_STFT_static, STFTLayerTest, testCaseStatic, STFTLayerTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_STFT_static,
STFTLayerTest,
STFTLayerTest::GetTestDataForDevice(ov::test::utils::DEVICE_GPU),
STFTLayerTest::getTestCaseName);
} // namespace test
} // namespace ov
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ typedef std::tuple<std::vector<InputShape>,
class STFTLayerTest : public testing::WithParamInterface<STFTParams>, virtual public ov::test::SubgraphBaseTest {
public:
static std::string getTestCaseName(const testing::TestParamInfo<STFTParams>& obj);
using TGenData =
testing::internal::CartesianProductHolder<testing::internal::ParamGenerator<std::vector<ov::test::InputShape>>,
testing::internal::ParamGenerator<int64_t>,
testing::internal::ParamGenerator<int64_t>,
testing::internal::ParamGenerator<bool>,
testing::internal::ParamGenerator<ov::element::Type>,
testing::internal::ParamGenerator<ov::element::Type>,
testing::internal::ParamGenerator<ov::test::utils::InputLayerType>,
testing::internal::ValueArray<const char*>>;

static const TGenData GetTestDataForDevice(const char* deviceName);

protected:
void SetUp() override;
Expand Down
77 changes: 77 additions & 0 deletions src/tests/functional/shared_test_classes/src/single_op/stft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,82 @@ void STFTLayerTest::SetUp() {
function = std::make_shared<ov::Model>(STFT->outputs(), ov::ParameterVector{in_signal, in_window});
}
}

const STFTLayerTest::TGenData STFTLayerTest::GetTestDataForDevice(const char* deviceName) {
const std::vector<ov::element::Type> data_type = {ov::element::bf16, ov::element::f16};
const std::vector<ov::element::Type> step_size_type = {ov::element::i32, ov::element::i64};

const std::vector<std::vector<InputShape>> input_shapes = {
{
// Static shapes
{{}, {{128}}}, // 1st input
{{}, {{8}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
},
{
// Static shapes
{{}, {{1, 128}}}, // 1st input
{{}, {{8}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
},
{
// Static shapes
{{}, {{2, 226}}}, // 1st input
{{}, {{16}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
},
{
// Dynamic dims in the first input shape
{{-1, -1}, {{1, 128}, {2, 226}}}, // 1st input
{{}, {{8}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
},
{
// Dynamic dims in the first and second input shape
{{-1}, {{128}}}, // 1st input
{{-1}, {{8}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
},
{
// Dynamic dims in the first and second input shape
{{-1, -1}, {{1, 128}, {2, 226}}}, // 1st input
{{-1}, {{8}, {16}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
},
{
// Dynamic dims with range in the first and second input shape
{{{2, 4}, {1, 300}}, {{2, 226}, {3, 128}}}, // 1st input
{{{3, 16}}, {{4}, {16}}}, // 2nd input
{{}, {{}}}, // 3rd input
{{}, {{}}} // 4th input
}};

const std::vector<int64_t> frame_size = {16, 24};
const std::vector<int64_t> step_size = {2, 3, 4};

const std::vector<bool> transpose_frames = {
false,
true,
};

std::vector<utils::InputLayerType> in_types = {utils::InputLayerType::CONSTANT, utils::InputLayerType::PARAMETER};

auto data = ::testing::Combine(::testing::ValuesIn(input_shapes),
::testing::ValuesIn(frame_size),
::testing::ValuesIn(step_size),
::testing::ValuesIn(transpose_frames),
::testing::ValuesIn(data_type),
::testing::ValuesIn(step_size_type),
::testing::ValuesIn(in_types),
::testing::Values(deviceName));

return data;
}
} // namespace test
} // namespace ov

0 comments on commit 2d02564

Please sign in to comment.