diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/concat.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/concat.cpp index 68227e25fdd..a3e7d144ee9 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/concat.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/concat.cpp @@ -4,15 +4,15 @@ #include -#include "single_layer_tests/concat.hpp" +#include "single_op_tests/concat.hpp" #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; namespace { +using ov::test::ConcatLayerTest; std::vector axes = {-3, -2, -1, 0, 1, 2, 3}; -std::vector>> inShapes = { +std::vector> shapes_static = { {{10, 10, 10, 10}}, {{10, 10, 10, 10}, {10, 10, 10, 10}}, {{10, 10, 10, 10}, {10, 10, 10, 10}, {10, 10, 10, 10}}, @@ -21,19 +21,14 @@ std::vector>> inShapes = { }; -std::vector netPrecisions = {InferenceEngine::Precision::FP32, - InferenceEngine::Precision::FP16}; +std::vector netPrecisions = {ov::element::f32, + ov::element::f16}; INSTANTIATE_TEST_SUITE_P(smoke_NoReshape, ConcatLayerTest, ::testing::Combine( ::testing::ValuesIn(axes), - ::testing::ValuesIn(inShapes), + ::testing::ValuesIn(ov::test::static_shapes_to_test_representation(shapes_static)), ::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(ov::test::utils::DEVICE_CPU)), ConcatLayerTest::getTestCaseName); - } // namespace diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/constant.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/constant.cpp index 3e536688891..d680bb97469 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/constant.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/constant.cpp @@ -2,38 +2,34 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "single_layer_tests/constant.hpp" - -#include - +#include "single_op_tests/constant.hpp" #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; - namespace { +using ov::test::ConstantLayerTest; -std::vector> shapes{ +std::vector shapes{ {2, 2, 3}, {3, 4, 1}, {1, 1, 12}, }; -std::vector precisions{ - InferenceEngine::Precision::BF16, InferenceEngine::Precision::FP16, - InferenceEngine::Precision::FP32, InferenceEngine::Precision::FP64, - InferenceEngine::Precision::U4, InferenceEngine::Precision::U8, - InferenceEngine::Precision::U16, InferenceEngine::Precision::U32, - InferenceEngine::Precision::I4, InferenceEngine::Precision::I8, - InferenceEngine::Precision::I16, InferenceEngine::Precision::I32, +std::vector model_types{ + ov::element::bf16, ov::element::f16, + ov::element::f32, ov::element::f64, + ov::element::u4, ov::element::u8, + ov::element::u16, ov::element::u32, + ov::element::i4, ov::element::i8, + ov::element::i16, ov::element::i32, }; std::vector data{"0", "1", "2", "3", "4", "5", "6", "7", "0", "1", "2", "3"}; -std::vector precisionsWithNegativeValues{ - InferenceEngine::Precision::BF16, InferenceEngine::Precision::FP16, - InferenceEngine::Precision::FP32, InferenceEngine::Precision::FP64, - InferenceEngine::Precision::I4, InferenceEngine::Precision::I8, - InferenceEngine::Precision::I16, InferenceEngine::Precision::I32, +std::vector model_types_with_negative_values{ + ov::element::bf16, ov::element::f16, + ov::element::f32, ov::element::f64, + ov::element::i4, ov::element::i8, + ov::element::i16, ov::element::i32, }; std::vector dataWithNegativeValues{"1", "-2", "3", "-4", "5", "-6", @@ -41,13 +37,13 @@ std::vector dataWithNegativeValues{"1", "-2", "3", "-4", "5", "-6", INSTANTIATE_TEST_SUITE_P(smoke_Constant, ConstantLayerTest, ::testing::Combine(::testing::ValuesIn(shapes), - ::testing::ValuesIn(precisions), ::testing::Values(data), + ::testing::ValuesIn(model_types), ::testing::Values(data), ::testing::Values(ov::test::utils::DEVICE_CPU)), ConstantLayerTest::getTestCaseName); INSTANTIATE_TEST_SUITE_P(smoke_Constant_with_negative_values, ConstantLayerTest, ::testing::Combine(::testing::ValuesIn(shapes), - ::testing::ValuesIn(precisionsWithNegativeValues), + ::testing::ValuesIn(model_types_with_negative_values), ::testing::Values(dataWithNegativeValues), ::testing::Values(ov::test::utils::DEVICE_CPU)), ConstantLayerTest::getTestCaseName); diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/conversion.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/conversion.cpp index 7f1dac6f27f..b03d55f3208 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/conversion.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/conversion.cpp @@ -5,48 +5,39 @@ #include #include "common_test_utils/test_constants.hpp" -#include "single_layer_tests/conversion.hpp" - -using namespace LayerTestsDefinitions; +#include "single_op_tests/conversion.hpp" namespace { -const std::vector conversionOpTypes = { - ngraph::helpers::ConversionTypes::CONVERT, - ngraph::helpers::ConversionTypes::CONVERT_LIKE, +using ov::test::ConversionLayerTest; + +const std::vector conversionOpTypes = { + ov::test::utils::ConversionTypes::CONVERT, + ov::test::utils::ConversionTypes::CONVERT_LIKE, }; -const std::vector> inShape = {{1, 2, 3, 4}}; +const std::vector> shapes = {{{1, 2, 3, 4}}}; -const std::vector netPrecisions = { - InferenceEngine::Precision::U8, - InferenceEngine::Precision::I8, - InferenceEngine::Precision::U16, - InferenceEngine::Precision::I16, - InferenceEngine::Precision::U32, - InferenceEngine::Precision::I32, - InferenceEngine::Precision::U64, - InferenceEngine::Precision::I64, - InferenceEngine::Precision::BF16, - InferenceEngine::Precision::FP16, - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::FP64, - InferenceEngine::Precision::BOOL, - InferenceEngine::Precision::MIXED, - InferenceEngine::Precision::Q78, - InferenceEngine::Precision::U4, - InferenceEngine::Precision::I4, - InferenceEngine::Precision::BIN, - InferenceEngine::Precision::CUSTOM, +const std::vector types = { + ov::element::u8, + ov::element::i8, + ov::element::u16, + ov::element::i16, + ov::element::u32, + ov::element::i32, + ov::element::u64, + ov::element::i64, + ov::element::bf16, + ov::element::f16, + ov::element::f32, + ov::element::f64, }; INSTANTIATE_TEST_SUITE_P(smoke_ConversionLayerTest, ConversionLayerTest, ::testing::Combine(::testing::ValuesIn(conversionOpTypes), - ::testing::Values(inShape), - ::testing::ValuesIn(netPrecisions), - ::testing::ValuesIn(netPrecisions), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), + ::testing::ValuesIn(ov::test::static_shapes_to_test_representation(shapes)), + ::testing::ValuesIn(types), + ::testing::ValuesIn(types), ::testing::Values(ov::test::utils::DEVICE_CPU)), ConversionLayerTest::getTestCaseName); } // namespace diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/convert_color_i420.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/convert_color_i420.cpp index 725853a93af..5be4e9ba6dc 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/convert_color_i420.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/convert_color_i420.cpp @@ -4,34 +4,71 @@ #include -#include "single_layer_tests/convert_color_i420.hpp" +#include "single_op_tests/convert_color_i420.hpp" #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; - namespace { +using ov::test::ConvertColorI420LayerTest; -const std::vector inShapes_nhwc = { +const std::vector in_shapes = { {1, 10, 10, 1} }; +auto generate_input_static_shapes = [] (const std::vector& original_shapes, bool single_plane) { + std::vector> result_shapes; + for (const auto& original_shape : original_shapes) { + std::vector one_result_shapes; + if (single_plane) { + auto shape = original_shape; + shape[1] = shape[1] * 3 / 2; + one_result_shapes.push_back(shape); + } else { + auto shape = original_shape; + one_result_shapes.push_back(shape); + auto uvShape = ov::Shape{shape[0], shape[1] / 2, shape[2] / 2, 1}; + one_result_shapes.push_back(uvShape); + one_result_shapes.push_back(uvShape); + } + result_shapes.push_back(one_result_shapes); + } + return result_shapes; +}; + +auto in_shapes_single_plain_static = generate_input_static_shapes(in_shapes, true); +auto in_shapes_not_single_plain_static = generate_input_static_shapes(in_shapes, false); + const std::vector inTypes = { ov::element::u8, ov::element::f32 }; -const auto testCase_values = ::testing::Combine( - ::testing::ValuesIn(inShapes_nhwc), +const auto test_case_values_single_plain = ::testing::Combine( + ::testing::ValuesIn(ov::test::static_shapes_to_test_representation(in_shapes_single_plain_static)), ::testing::ValuesIn(inTypes), ::testing::Bool(), - ::testing::Bool(), + ::testing::Values(true), ::testing::Values(ov::test::utils::DEVICE_CPU) ); +const auto test_case_values_not_single_plain = ::testing::Combine( + ::testing::ValuesIn(ov::test::static_shapes_to_test_representation(in_shapes_not_single_plain_static)), + ::testing::ValuesIn(inTypes), + ::testing::Bool(), + ::testing::Values(false), + ::testing::Values(ov::test::utils::DEVICE_CPU) +); -INSTANTIATE_TEST_SUITE_P(smoke_TestsConvertColorI420, ConvertColorI420LayerTest, testCase_values, ConvertColorI420LayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_TestsConvertColorI420SinglePlain, + ConvertColorI420LayerTest, + test_case_values_single_plain, + ConvertColorI420LayerTest::getTestCaseName); -const auto testCase_accuracy_values = ::testing::Combine( - ::testing::Values(ov::Shape{1, 16*6, 16, 1}), +INSTANTIATE_TEST_SUITE_P(smoke_TestsConvertColorI420NotSinglePlain, + ConvertColorI420LayerTest, + test_case_values_not_single_plain, + ConvertColorI420LayerTest::getTestCaseName); + +const auto test_case_accuracy_values = ::testing::Combine( + ::testing::ValuesIn(ov::test::static_shapes_to_test_representation(generate_input_static_shapes({{1, 16*6, 16, 1}}, true))), ::testing::Values(ov::element::u8), ::testing::Values(false), ::testing::Values(true), @@ -39,12 +76,12 @@ const auto testCase_accuracy_values = ::testing::Combine( ); INSTANTIATE_TEST_SUITE_P(smoke_TestsConvertColorI420_acc, - ConvertColorI420AccuracyTest, - testCase_accuracy_values, + ConvertColorI420LayerTest, + test_case_accuracy_values, ConvertColorI420LayerTest::getTestCaseName); -const auto testCase_accuracy_values_nightly = ::testing::Combine( - ::testing::Values(ov::Shape{1, 256*256, 256, 1}), +const auto test_case_accuracy_values_nightly = ::testing::Combine( + ::testing::ValuesIn(ov::test::static_shapes_to_test_representation(generate_input_static_shapes({{1, 256*256, 256, 1}}, true))), ::testing::Values(ov::element::u8), ::testing::Values(false), ::testing::Values(true), @@ -52,8 +89,8 @@ const auto testCase_accuracy_values_nightly = ::testing::Combine( ); INSTANTIATE_TEST_SUITE_P(nightly_TestsConvertColorI420_acc, - ConvertColorI420AccuracyTest, - testCase_accuracy_values_nightly, + ConvertColorI420LayerTest, + test_case_accuracy_values_nightly, ConvertColorI420LayerTest::getTestCaseName); } // namespace diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/convert_color_nv12.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/convert_color_nv12.cpp index f821d378197..af84b09833c 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/convert_color_nv12.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/convert_color_nv12.cpp @@ -4,34 +4,70 @@ #include -#include "single_layer_tests/convert_color_nv12.hpp" +#include "single_op_tests/convert_color_nv12.hpp" #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; - namespace { +using ov::test::ConvertColorNV12LayerTest; -const std::vector inShapes_nhwc = { +const std::vector in_shapes = { {1, 10, 10, 1} }; +auto generate_input_static_shapes = [] (const std::vector& original_shapes, bool single_plane) { + std::vector> result_shapes; + for (const auto& original_shape : original_shapes) { + std::vector one_result_shapes; + if (single_plane) { + auto shape = original_shape; + shape[1] = shape[1] * 3 / 2; + one_result_shapes.push_back(shape); + } else { + auto shape = original_shape; + one_result_shapes.push_back(shape); + auto uvShape = ov::Shape{shape[0], shape[1] / 2, shape[2] / 2, 2}; + one_result_shapes.push_back(uvShape); + } + result_shapes.push_back(one_result_shapes); + } + return result_shapes; +}; + +auto in_shapes_single_plain_static = generate_input_static_shapes(in_shapes, true); +auto in_shapes_not_single_plain_static = generate_input_static_shapes(in_shapes, false); + const std::vector inTypes = { ov::element::u8, ov::element::f32 }; -const auto testCase_values = ::testing::Combine( - ::testing::ValuesIn(inShapes_nhwc), +const auto test_case_values_single_plain = ::testing::Combine( + ::testing::ValuesIn(ov::test::static_shapes_to_test_representation(in_shapes_single_plain_static)), ::testing::ValuesIn(inTypes), ::testing::Bool(), - ::testing::Bool(), + ::testing::Values(true), ::testing::Values(ov::test::utils::DEVICE_CPU) ); +const auto test_case_values_not_single_plain = ::testing::Combine( + ::testing::ValuesIn(ov::test::static_shapes_to_test_representation(in_shapes_not_single_plain_static)), + ::testing::ValuesIn(inTypes), + ::testing::Bool(), + ::testing::Values(false), + ::testing::Values(ov::test::utils::DEVICE_CPU) +); -INSTANTIATE_TEST_SUITE_P(smoke_TestsConvertColorNV12, ConvertColorNV12LayerTest, testCase_values, ConvertColorNV12LayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_TestsConvertColorNV12_1Plain, + ConvertColorNV12LayerTest, + test_case_values_single_plain, + ConvertColorNV12LayerTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_TestsConvertColorNV12_3Plains, + ConvertColorNV12LayerTest, + test_case_values_not_single_plain, + ConvertColorNV12LayerTest::getTestCaseName); const auto testCase_accuracy_values = ::testing::Combine( - ::testing::Values(ov::Shape{1, 16*6, 16, 1}), + ::testing::ValuesIn(ov::test::static_shapes_to_test_representation(generate_input_static_shapes({{1, 16*6, 16, 1}}, true))), ::testing::Values(ov::element::u8), ::testing::Values(false), ::testing::Values(true), @@ -39,12 +75,12 @@ const auto testCase_accuracy_values = ::testing::Combine( ); INSTANTIATE_TEST_SUITE_P(smoke_TestsConvertColorNV12_acc, - ConvertColorNV12AccuracyTest, + ConvertColorNV12LayerTest, testCase_accuracy_values, ConvertColorNV12LayerTest::getTestCaseName); const auto testCase_accuracy_values_nightly = ::testing::Combine( - ::testing::Values(ov::Shape{1, 256*256, 256, 1}), + ::testing::ValuesIn(ov::test::static_shapes_to_test_representation(generate_input_static_shapes({{1, 256*256, 256, 1}}, true))), ::testing::Values(ov::element::u8), ::testing::Values(false), ::testing::Values(true), @@ -52,7 +88,7 @@ const auto testCase_accuracy_values_nightly = ::testing::Combine( ); INSTANTIATE_TEST_SUITE_P(nightly_TestsConvertColorNV12_acc, - ConvertColorNV12AccuracyTest, + ConvertColorNV12LayerTest, testCase_accuracy_values_nightly, ConvertColorNV12LayerTest::getTestCaseName); diff --git a/src/tests/functional/plugin/shared/include/single_op_tests/concat.hpp b/src/tests/functional/plugin/shared/include/single_op_tests/concat.hpp new file mode 100644 index 00000000000..3a368e69526 --- /dev/null +++ b/src/tests/functional/plugin/shared/include/single_op_tests/concat.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/concat.hpp" + +namespace ov { +namespace test { +TEST_P(ConcatLayerTest, Inference) { + run(); +}; +} // namespace test +} // namespace ov diff --git a/src/tests/functional/plugin/shared/include/single_op_tests/constant.hpp b/src/tests/functional/plugin/shared/include/single_op_tests/constant.hpp new file mode 100644 index 00000000000..767cc69b997 --- /dev/null +++ b/src/tests/functional/plugin/shared/include/single_op_tests/constant.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/constant.hpp" + +namespace ov { +namespace test { +TEST_P(ConstantLayerTest, Inference) { + run(); +}; +} // namespace test +} // namespace ov diff --git a/src/tests/functional/plugin/shared/include/single_op_tests/conversion.hpp b/src/tests/functional/plugin/shared/include/single_op_tests/conversion.hpp new file mode 100644 index 00000000000..0d498cb95e1 --- /dev/null +++ b/src/tests/functional/plugin/shared/include/single_op_tests/conversion.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/conversion.hpp" + +namespace ov { +namespace test { +TEST_P(ConversionLayerTest, Inference) { + run(); +}; +} // namespace test +} // namespace ov diff --git a/src/tests/functional/plugin/shared/include/single_op_tests/convert_color_i420.hpp b/src/tests/functional/plugin/shared/include/single_op_tests/convert_color_i420.hpp new file mode 100644 index 00000000000..5d777981efa --- /dev/null +++ b/src/tests/functional/plugin/shared/include/single_op_tests/convert_color_i420.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/convert_color_i420.hpp" + +namespace ov { +namespace test { +TEST_P(ConvertColorI420LayerTest, Inference) { + run(); +} +} // namespace test +} // namespace ov diff --git a/src/tests/functional/plugin/shared/include/single_op_tests/convert_color_nv12.hpp b/src/tests/functional/plugin/shared/include/single_op_tests/convert_color_nv12.hpp new file mode 100644 index 00000000000..1497c5d0fc2 --- /dev/null +++ b/src/tests/functional/plugin/shared/include/single_op_tests/convert_color_nv12.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/convert_color_nv12.hpp" + +namespace ov { +namespace test { +TEST_P(ConvertColorNV12LayerTest, Inference) { + run(); +} +} // namespace test +} // namespace ov diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/concat.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/concat.hpp new file mode 100644 index 00000000000..e52016207d0 --- /dev/null +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/concat.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 concatParamsTuple = typename std::tuple< + int, // Concat axis + std::vector, // Input shapes + ov::element::Type, // Model type + std::string>; // Device name + +// Multichannel +class ConcatLayerTest : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseTest { +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/constant.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/constant.hpp new file mode 100644 index 00000000000..8fb64cc9b0c --- /dev/null +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/constant.hpp @@ -0,0 +1,30 @@ +// 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 constantParamsTuple = typename std::tuple< + ov::Shape, // Constant data shape + ov::element::Type, // Constant data precision + std::vector, // Constant elements + std::string>; // Device name + +class ConstantLayerTest : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseTest { +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/conversion.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/conversion.hpp new file mode 100644 index 00000000000..af182b65b3c --- /dev/null +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/conversion.hpp @@ -0,0 +1,30 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "gtest/gtest.h" +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "common_test_utils/test_enums.hpp" + +namespace ov { +namespace test { +using ConversionParamsTuple = typename std::tuple, // Input shapes + ov::element::Type, // Input type + ov::element::Type, // Convert type + std::string>; // Device name + +class ConversionLayerTest : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseTest { +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/convert_color_i420.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/convert_color_i420.hpp new file mode 100644 index 00000000000..231af9f1390 --- /dev/null +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/convert_color_i420.hpp @@ -0,0 +1,30 @@ +// 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 ConvertColorI420ParamsTuple = std::tuple< + std::vector, // Input Shape + ov::element::Type, // Element type + bool, // Conversion type + bool, // 1 or 3 planes + std::string>; // Device name + +class ConvertColorI420LayerTest : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseTest { +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/convert_color_nv12.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/convert_color_nv12.hpp new file mode 100644 index 00000000000..ad922c686c9 --- /dev/null +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/convert_color_nv12.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 ConvertColorNV12ParamsTuple = std::tuple< + std::vector, // Input Shape + ov::element::Type, // Element type + bool, // Conversion type + bool, // 1 or 2 planes + std::string>; // Device name + +class ConvertColorNV12LayerTest : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseTest { +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/base/utils/compare_results.cpp b/src/tests/functional/shared_test_classes/src/base/utils/compare_results.cpp index 43ab82af73a..5d9f13d9ba0 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 @@ -54,6 +54,104 @@ void compare(const std::shared_ptr &node, ov::test::utils::compare(expected, actual, 1e-2f, relThreshold); } +namespace color_conversion { +template +inline void validate_colors(const T* expected, const T* actual, size_t size, float dev_threshold, float abs_threshold = 0.01f) { + size_t mismatches = 0; + for (size_t i = 0; i < size; i++) { + if (std::abs(static_cast(expected[i] - actual[i])) > abs_threshold) { + mismatches++; + } + } + ASSERT_LT(mismatches / size, dev_threshold) << mismatches << + " out of " << size << " color mismatches found which exceeds allowed threshold " << dev_threshold; +} + +inline void validate_colors(const ov::Tensor& expected, const ov::Tensor& actual, float dev_threshold, float abs_threshold = 0.01f) { + OPENVINO_ASSERT(expected.get_size() == actual.get_size()); + OPENVINO_ASSERT(expected.get_element_type() == actual.get_element_type()); + +#define CASE(X) \ + case X: \ + validate_colors( \ + static_cast*>(expected.data()), \ + static_cast*>(actual.data()), \ + expected.get_size(), \ + dev_threshold, \ + abs_threshold); \ + break; + switch (expected.get_element_type()) { + 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) + default: + OPENVINO_THROW("Unsupported element type: ", expected.get_element_type()); + } +#undef CASE +} +} // namespace color_conversion + +void compare(const std::shared_ptr &node, + size_t port, + const ov::runtime::Tensor &expected, + const ov::runtime::Tensor &actual, + double absThreshold, + double relThreshold) { + ov::test::utils::compare(expected, actual, absThreshold, relThreshold); + + // Allow less than 2% of deviations with 1 color step. 2% is experimental value + // For different calculation methods - 1.4% deviation is observed + color_conversion::validate_colors(expected, actual, 0.02); +} + +void compare(const std::shared_ptr &node, + size_t port, + const ov::runtime::Tensor &expected, + const ov::runtime::Tensor &actual, + double absThreshold, + double relThreshold) { + ov::test::utils::compare(expected, actual, absThreshold, relThreshold); + + // Allow less than 2% of deviations with 1 color step. 2% is experimental value + // For different calculation methods - 1.4% deviation is observed + color_conversion::validate_colors(expected, actual, 0.02); +} + +void compare(const std::shared_ptr &node, + size_t port, + const ov::runtime::Tensor &expected, + const ov::runtime::Tensor &actual, + double absThreshold, + double relThreshold) { + ov::test::utils::compare(expected, actual, absThreshold, relThreshold); + + // Allow less than 2% of deviations with 1 color step. 2% is experimental value + // For different calculation methods - 1.4% deviation is observed + color_conversion::validate_colors(expected, actual, 0.02); +} + +void compare(const std::shared_ptr &node, + size_t port, + const ov::runtime::Tensor &expected, + const ov::runtime::Tensor &actual, + double absThreshold, + double relThreshold) { + ov::test::utils::compare(expected, actual, absThreshold, relThreshold); + + // Allow less than 2% of deviations with 1 color step. 2% is experimental value + // For different calculation methods - 1.4% deviation is observed + color_conversion::validate_colors(expected, actual, 0.02); +} + template void compareResults(const std::shared_ptr &node, size_t port, diff --git a/src/tests/functional/shared_test_classes/src/base/utils/generate_inputs.cpp b/src/tests/functional/shared_test_classes/src/base/utils/generate_inputs.cpp index be877939273..c97617aec0d 100644 --- a/src/tests/functional/shared_test_classes/src/base/utils/generate_inputs.cpp +++ b/src/tests/functional/shared_test_classes/src/base/utils/generate_inputs.cpp @@ -1020,7 +1020,6 @@ ov::runtime::Tensor generate(const comparison::fill_tensor(tensor); return tensor; } - ov::runtime::Tensor generate(const std::shared_ptr& node, size_t port, @@ -1031,6 +1030,115 @@ ov::runtime::Tensor generate(const return tensor; } +namespace color_conversion { +enum class ColorFormat { + i420, + nv12 +}; + +inline std::vector color_test_image(size_t height, size_t width, int b_step, ColorFormat format) { + // Test all possible r/g/b values within dimensions + int b_dim = 255 / b_step + 1; + auto input_yuv = std::vector(height * b_dim * width * 3 / 2); + for (int b = 0; b <= 255; b += b_step) { + for (size_t y = 0; y < height / 2; y++) { + for (size_t x = 0; x < width / 2; x++) { + int r = static_cast(y) * 512 / static_cast(height); + int g = static_cast(x) * 512 / static_cast(width); + // Can't use random y/u/v for testing as this can lead to invalid R/G/B values + int y_val = ((66 * r + 129 * g + 25 * b + 128) / 256) + 16; + int u_val = ((-38 * r - 74 * g + 112 * b + 128) / 256) + 128; + int v_val = ((112 * r - 94 * g + 18 * b + 128) / 256) + 128; + + size_t b_offset = height * width * b / b_step * 3 / 2; + if (ColorFormat::i420 == format) { + size_t u_index = b_offset + height * width + y * width / 2 + x; + size_t v_index = u_index + height * width / 4; + input_yuv[u_index] = u_val; + input_yuv[v_index] = v_val; + } else { + size_t uv_index = b_offset + height * width + y * width + x * 2; + input_yuv[uv_index] = u_val; + input_yuv[uv_index + 1] = v_val; + } + size_t y_index = b_offset + y * 2 * width + x * 2; + input_yuv[y_index] = y_val; + input_yuv[y_index + 1] = y_val; + input_yuv[y_index + width] = y_val; + input_yuv[y_index + width + 1] = y_val; + } + } + } + return input_yuv; +} + +void fill_tensor(ov::Tensor& tensor, ColorFormat format) { + size_t full_height = tensor.get_shape()[1]; + size_t full_width = tensor.get_shape()[2]; + int b_dim = static_cast(full_height * 2 / (3 * full_width)); + ASSERT_GT(b_dim, 1) << "Image height is invalid"; + ASSERT_EQ(255 % (b_dim - 1), 0) << "Image height is invalid"; + int b_step = 255 / (b_dim - 1); + auto input_image = color_test_image(full_width, full_width, b_step, format); + auto data_ptr = static_cast(tensor.data()); + for (size_t j = 0; j < input_image.size(); ++j) { + data_ptr[j] = input_image[j]; + } +} +} // namespace color_conversion + +ov::runtime::Tensor generate(const std::shared_ptr& node, + size_t port, + const ov::element::Type& elemType, + const ov::Shape& targetShape) { + auto b_dim = static_cast(targetShape[1] * 2 / (3 * targetShape[2])); + if (node->inputs().size() > 1 || b_dim < 2) + return generate(std::static_pointer_cast(node), port, elemType, targetShape); + ov::Tensor tensor(elemType, targetShape); + color_conversion::fill_tensor(tensor, color_conversion::ColorFormat::i420); + return tensor; +} + +ov::runtime::Tensor generate(const + std::shared_ptr& node, + size_t port, + const ov::element::Type& elemType, + const ov::Shape& targetShape) { + auto b_dim = static_cast(targetShape[1] * 2 / (3 * targetShape[2])); + if (node->inputs().size() > 1 || b_dim < 2) + return generate(std::static_pointer_cast(node), port, elemType, targetShape); + ov::Tensor tensor(elemType, targetShape); + color_conversion::fill_tensor(tensor, color_conversion::ColorFormat::i420); + return tensor; +} + + +ov::runtime::Tensor generate(const + std::shared_ptr& node, + size_t port, + const ov::element::Type& elemType, + const ov::Shape& targetShape) { + auto b_dim = static_cast(targetShape[1] * 2 / (3 * targetShape[2])); + if (node->inputs().size() > 1 || b_dim < 2) + return generate(std::static_pointer_cast(node), port, elemType, targetShape); + ov::Tensor tensor(elemType, targetShape); + color_conversion::fill_tensor(tensor, color_conversion::ColorFormat::nv12); + return tensor; +} + +ov::runtime::Tensor generate(const + std::shared_ptr& node, + size_t port, + const ov::element::Type& elemType, + const ov::Shape& targetShape) { + auto b_dim = static_cast(targetShape[1] * 2 / (3 * targetShape[2])); + if (node->inputs().size() > 1 || b_dim < 2) + return generate(std::static_pointer_cast(node), port, elemType, targetShape); + ov::Tensor tensor(elemType, targetShape); + color_conversion::fill_tensor(tensor, color_conversion::ColorFormat::nv12); + return tensor; +} + template ov::runtime::Tensor generateInput(const std::shared_ptr& node, size_t port, diff --git a/src/tests/functional/shared_test_classes/src/single_op/concat.cpp b/src/tests/functional/shared_test_classes/src/single_op/concat.cpp new file mode 100644 index 00000000000..fc45423a8f0 --- /dev/null +++ b/src/tests/functional/shared_test_classes/src/single_op/concat.cpp @@ -0,0 +1,55 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "shared_test_classes/single_op/concat.hpp" + +namespace ov { +namespace test { + +std::string ConcatLayerTest::getTestCaseName(const testing::TestParamInfo &obj) { + int axis; + std::vector shapes; + ov::element::Type model_type; + std::string targetName; + std::tie(axis, shapes, model_type, targetName) = obj.param; + std::ostringstream result; + result << "IS=("; + for (size_t i = 0lu; i < shapes.size(); i++) { + result << ov::test::utils::partialShape2str({shapes[i].first}) << (i < shapes.size() - 1lu ? "_" : ""); + } + result << ")_TS="; + for (size_t i = 0lu; i < shapes.front().second.size(); i++) { + result << "{"; + for (size_t j = 0lu; j < shapes.size(); j++) { + result << ov::test::utils::vec2str(shapes[j].second[i]) << (j < shapes.size() - 1lu ? "_" : ""); + } + result << "}_"; + } + result << "axis=" << axis << "_"; + result << "netPRC=" << model_type.get_type_name() << "_"; + result << "trgDev=" << targetName; + return result.str(); +} + +void ConcatLayerTest::SetUp() { + int axis; + std::vector shapes; + ov::element::Type model_type; + std::tie(axis, shapes, model_type, targetDevice) = this->GetParam(); + init_input_shapes(shapes); + + ov::ParameterVector params; + ov::NodeVector params_nodes; + for (const auto& shape : inputDynamicShapes) { + auto param = std::make_shared(model_type, shape); + params.push_back(param); + params_nodes.push_back(param); + } + + auto concat = std::make_shared(params_nodes, axis); + auto result = std::make_shared(concat); + function = std::make_shared(result, params, "concat"); +} +} // namespace test +} // namespace ov diff --git a/src/tests/functional/shared_test_classes/src/single_op/constant.cpp b/src/tests/functional/shared_test_classes/src/single_op/constant.cpp new file mode 100644 index 00000000000..2b67e830e56 --- /dev/null +++ b/src/tests/functional/shared_test_classes/src/single_op/constant.cpp @@ -0,0 +1,47 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "shared_test_classes/single_op/constant.hpp" + +namespace ov { +namespace test { +namespace { +template +std::vector getElements(const std::vector& v) { + const auto new_size = std::min(N, v.size()); + return {begin(v), std::next(begin(v), new_size)}; +} +} // namespace + +std::string ConstantLayerTest::getTestCaseName( + const testing::TestParamInfo& obj) { + ov::Shape shape; + ov::element::Type model_type; + std::vector data_elements; + std::string target_device; + + std::tie(shape, model_type, data_elements, target_device) = obj.param; + + std::ostringstream result; + result << "TS={" << ov::test::utils::vec2str(shape) << "}_"; + result << "dataPRC=" << model_type.get_type_name() << "_"; + result << "dataValue=" << ov::test::utils::vec2str(getElements<5>(data_elements)) << "_"; + result << "targetDevice=" << target_device << "_"; + return result.str(); +} + +void ConstantLayerTest::SetUp() { + ov::Shape shape; + ov::element::Type model_type; + std::vector data_elements; + + std::tie(shape, model_type, data_elements, targetDevice) = this->GetParam(); + + auto constant = ov::op::v0::Constant::create(model_type, shape, data_elements); + auto result = std::make_shared(constant); + + function = std::make_shared(result, ov::ParameterVector{}, "constant"); +} +} // namespace test +} // namespace ov diff --git a/src/tests/functional/shared_test_classes/src/single_op/conversion.cpp b/src/tests/functional/shared_test_classes/src/single_op/conversion.cpp new file mode 100644 index 00000000000..dabc1e2531f --- /dev/null +++ b/src/tests/functional/shared_test_classes/src/single_op/conversion.cpp @@ -0,0 +1,66 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "shared_test_classes/single_op/conversion.hpp" + +namespace ov { +namespace test { +namespace { +std::map conversionNames = { + {ov::test::utils::ConversionTypes::CONVERT, "Convert"}, + {ov::test::utils::ConversionTypes::CONVERT_LIKE, "ConvertLike"}}; +} + +std::string ConversionLayerTest::getTestCaseName(const testing::TestParamInfo& obj) { + ov::test::utils::ConversionTypes conversion_type; + ov::element::Type input_type, convert_type; + std::string device_name; + std::vector shapes; + std::tie(conversion_type, shapes, input_type, convert_type, device_name) = + obj.param; + std::ostringstream result; + result << "conversionOpType=" << conversionNames[conversion_type] << "_"; + result << "IS=("; + for (size_t i = 0lu; i < shapes.size(); i++) { + result << ov::test::utils::partialShape2str({shapes[i].first}) << (i < shapes.size() - 1lu ? "_" : ""); + } + result << ")_TS="; + for (size_t i = 0lu; i < shapes.front().second.size(); i++) { + result << "{"; + for (size_t j = 0lu; j < shapes.size(); j++) { + result << ov::test::utils::vec2str(shapes[j].second[i]) << (j < shapes.size() - 1lu ? "_" : ""); + } + result << "}_"; + } + result << "inputPRC=" << input_type.get_type_name() << "_"; + result << "targetPRC=" << convert_type.get_type_name() << "_"; + result << "trgDev=" << device_name; + return result.str(); +} + +void ConversionLayerTest::SetUp() { + ov::test::utils::ConversionTypes conversion_type; + ov::element::Type input_type, convert_type; + std::vector shapes; + std::tie(conversion_type, shapes, input_type, convert_type, targetDevice) = GetParam(); + init_input_shapes(shapes); + + ov::ParameterVector params; + for (const auto& shape : inputDynamicShapes) { + params.push_back(std::make_shared(input_type, shape)); + } + + std::shared_ptr conversion; + if (conversion_type == ov::test::utils::ConversionTypes::CONVERT) { + conversion = std::make_shared(params.front(), convert_type); + } else /*CONVERT_LIKE*/ { + auto like = std::make_shared(convert_type, ov::Shape{1}); + conversion = std::make_shared(params.front(), like); + } + + auto result = std::make_shared(conversion); + function = std::make_shared(result, params, "Conversion"); +} +} // namespace test +} // namespace ov diff --git a/src/tests/functional/shared_test_classes/src/single_op/convert_color_i420.cpp b/src/tests/functional/shared_test_classes/src/single_op/convert_color_i420.cpp new file mode 100644 index 00000000000..b8d00620e21 --- /dev/null +++ b/src/tests/functional/shared_test_classes/src/single_op/convert_color_i420.cpp @@ -0,0 +1,75 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "shared_test_classes/single_op/convert_color_i420.hpp" +#include "openvino/op/i420_to_rgb.hpp" +#include "openvino/op/i420_to_bgr.hpp" +#include "openvino/op/parameter.hpp" +#include "openvino/op/result.hpp" + +namespace ov { +namespace test { +std::string ConvertColorI420LayerTest::getTestCaseName(const testing::TestParamInfo &obj) { + std::vector shapes; + ov::element::Type type; + bool conversion, single_plane; + std::string device_name; + std::tie(shapes, type, conversion, single_plane, device_name) = obj.param; + std::ostringstream result; + result << "IS=("; + for (size_t i = 0lu; i < shapes.size(); i++) { + result << ov::test::utils::partialShape2str({shapes[i].first}) << (i < shapes.size() - 1lu ? "_" : ""); + } + result << ")_TS="; + for (size_t i = 0lu; i < shapes.front().second.size(); i++) { + result << "{"; + for (size_t j = 0lu; j < shapes.size(); j++) { + result << ov::test::utils::vec2str(shapes[j].second[i]) << (j < shapes.size() - 1lu ? "_" : ""); + } + result << "}_"; + } + result << "netPRC=" << type.c_type_string() << "_"; + result << "convRGB=" << conversion << "_"; + result << "singlePlane=" << single_plane << "_"; + result << "targetDevice=" << device_name; + return result.str(); +} + +void ConvertColorI420LayerTest::SetUp() { + std::vector shapes; + ov::element::Type net_type; + bool conversion_to_rgb; + bool single_plane; + abs_threshold = 1.1f; // I420 conversion can use various algorithms, thus some absolute deviation is allowed + rel_threshold = 1.1f; // Ignore relative comparison for I420 convert (allow 100% relative deviation) + std::tie(shapes, net_type, conversion_to_rgb, single_plane, targetDevice) = GetParam(); + init_input_shapes(shapes); + + if (single_plane) { + auto param = std::make_shared(net_type, inputDynamicShapes.front()); + std::shared_ptr convert_color; + if (conversion_to_rgb) { + convert_color = std::make_shared(param); + } else { + convert_color = std::make_shared(param); + } + function = std::make_shared(std::make_shared(convert_color), + ov::ParameterVector{param}, "ConvertColorI420"); + } else { + auto param_y = std::make_shared(net_type, inputDynamicShapes[0]); + auto param_u = std::make_shared(net_type, inputDynamicShapes[1]); + auto param_v = std::make_shared(net_type, inputDynamicShapes[2]); + std::shared_ptr convert_color; + if (conversion_to_rgb) { + convert_color = std::make_shared(param_y, param_u, param_v); + } else { + convert_color = std::make_shared(param_y, param_u, param_v); + } + function = std::make_shared(std::make_shared(convert_color), + ov::ParameterVector{param_y, param_u, param_v}, + "ConvertColorI420"); + } +} +} // namespace test +} // namespace ov diff --git a/src/tests/functional/shared_test_classes/src/single_op/convert_color_nv12.cpp b/src/tests/functional/shared_test_classes/src/single_op/convert_color_nv12.cpp new file mode 100644 index 00000000000..f5eb7b6b9ce --- /dev/null +++ b/src/tests/functional/shared_test_classes/src/single_op/convert_color_nv12.cpp @@ -0,0 +1,75 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "shared_test_classes/single_op/convert_color_nv12.hpp" + +#include "openvino/op/nv12_to_rgb.hpp" +#include "openvino/op/nv12_to_bgr.hpp" +#include "openvino/op/parameter.hpp" +#include "openvino/op/result.hpp" + +namespace ov { +namespace test { +std::string ConvertColorNV12LayerTest::getTestCaseName(const testing::TestParamInfo &obj) { + std::vector shapes; + ov::element::Type type; + bool conversion, single_plane; + std::string device_name; + std::tie(shapes, type, conversion, single_plane, device_name) = obj.param; + std::ostringstream result; + result << "IS=("; + for (size_t i = 0lu; i < shapes.size(); i++) { + result << ov::test::utils::partialShape2str({shapes[i].first}) << (i < shapes.size() - 1lu ? "_" : ""); + } + result << ")_TS="; + for (size_t i = 0lu; i < shapes.front().second.size(); i++) { + result << "{"; + for (size_t j = 0lu; j < shapes.size(); j++) { + result << ov::test::utils::vec2str(shapes[j].second[i]) << (j < shapes.size() - 1lu ? "_" : ""); + } + result << "}_"; + } + result << "modelType=" << type.c_type_string() << "_"; + result << "convRGB=" << conversion << "_"; + result << "single_plane=" << single_plane << "_"; + result << "targetDevice=" << device_name; + return result.str(); +} + +void ConvertColorNV12LayerTest::SetUp() { + std::vector shapes; + ov::element::Type net_type; + bool conversionToRGB, single_plane; + abs_threshold = 1.1f; // NV12 conversion can use various algorithms, thus some absolute deviation is allowed + rel_threshold = 1.1f; // Ignore relative comparison for NV12 convert (allow 100% relative deviation) + std::tie(shapes, net_type, conversionToRGB, single_plane, targetDevice) = GetParam(); + init_input_shapes(shapes); + + if (single_plane) { + auto param = std::make_shared(net_type, inputDynamicShapes.front()); + + std::shared_ptr convert_color; + if (conversionToRGB) { + convert_color = std::make_shared(param); + } else { + convert_color = std::make_shared(param); + } + function = std::make_shared(std::make_shared(convert_color), + ov::ParameterVector{param}, "ConvertColorNV12"); + } else { + auto param_y = std::make_shared(net_type, inputDynamicShapes[0]); + auto param_uv = std::make_shared(net_type, inputDynamicShapes[1]); + + std::shared_ptr convert_color; + if (conversionToRGB) { + convert_color = std::make_shared(param_y, param_uv); + } else { + convert_color = std::make_shared(param_y, param_uv); + } + function = std::make_shared(std::make_shared(convert_color), + ov::ParameterVector{param_y, param_uv}, "ConvertColorNV12"); + } +} +} // namespace test +} // namespace ov