Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GPU] Refactor Comparison, Conversion, ConvertColorI420 #20374

Merged
merged 34 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ae241ec
Comparison
andrei-cv Oct 10, 2023
6fda3c6
Conversion
andrei-cv Oct 10, 2023
60f9f14
ConvertColorI420
andrei-cv Oct 10, 2023
45b5752
fix
andrei-cv Oct 14, 2023
69c8287
Comparison
andrei-cv Oct 10, 2023
4c6a959
Conversion
andrei-cv Oct 10, 2023
ee27f3b
ConvertColorI420
andrei-cv Oct 10, 2023
388098a
fix
andrei-cv Oct 14, 2023
98f6f5c
Merge branch 'api20_2' of https://github.com/andrei-cv/openvino into …
andrei-cv Oct 17, 2023
6e20e7f
fix after review
andrei-cv Oct 17, 2023
1f833c7
Merge branch 'master' into api20_2
andrei-cv Oct 17, 2023
38eb19c
Merge branch 'master' into api20_2
andrei-cv Oct 17, 2023
645e2dc
Merge branch 'master' into api20_2
andrei-cv Oct 17, 2023
6c78768
Merge branch 'master' into api20_2
andrei-cv Oct 17, 2023
f66625b
Merge branch 'master' into api20_2
andrei-cv Oct 18, 2023
b5a662c
Merge branch 'master' into api20_2
andrei-cv Oct 18, 2023
824ffec
Merge branch 'master' into api20_2
andrei-cv Oct 18, 2023
908dab0
Merge branch 'master' into api20_2
andrei-cv Oct 18, 2023
130ea0d
fix after review
andrei-cv Oct 18, 2023
c13a66b
Merge branch 'master' into api20_2
andrei-cv Oct 18, 2023
3282b96
fix after review
andrei-cv Oct 19, 2023
118f69a
Merge branch 'master' into api20_2
p-durandin Oct 23, 2023
7b52579
Merge branch 'master' into api20_2
p-durandin Oct 23, 2023
b4db1ae
Merge branch 'master' into api20_2
andrei-cv Oct 24, 2023
fe6f633
Merge branch 'master' into api20_2
andrei-cv Oct 24, 2023
1613ddf
Merge branch 'master' into api20_2
andrei-cv Oct 24, 2023
fe24f2e
Merge branch 'master' into api20_2
andrei-cv Oct 25, 2023
c896590
Merge branch 'master' into api20_2
andrei-cv Oct 25, 2023
9f8b8c6
Merge branch 'master' into api20_2
andrei-cv Oct 26, 2023
ae355f5
Merge branch 'master' into api20_2
andrei-cv Oct 26, 2023
acdf4f5
Merge branch 'master' into api20_2
p-durandin Oct 27, 2023
ed7a0f2
fixed comparison
andrei-cv Oct 30, 2023
b4ff465
Merge branch 'master' into api20_2
andrei-cv Oct 30, 2023
cccf6dc
Merge branch 'master' into api20_2
andrei-cv Oct 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@
// SPDX-License-Identifier: Apache-2.0
//

#include "single_layer_tests/comparison.hpp"

#include <vector>

#include "single_op_tests/comparison.hpp"
#include "common_test_utils/test_constants.hpp"

using namespace LayerTestsDefinitions;
using namespace LayerTestsDefinitions::ComparisonParams;

namespace {
using ov::test::ComparisonLayerTest;

const std::map<std::vector<size_t>, std::vector<std::vector<size_t>>> inputShapes = {
Lyamin-Roman marked this conversation as resolved.
Show resolved Hide resolved
std::map<ov::Shape, std::vector<ov::Shape>> input_shapes_combinations = {
{{1}, {{1}, {17}, {1, 1}, {2, 18}, {1, 1, 2}, {2, 2, 3}, {1, 1, 2, 3}}},
{{5}, {{1}, {1, 1}, {2, 5}, {1, 1, 1}, {2, 2, 5}}},
{{2, 200}, {{1}, {200}, {1, 200}, {2, 200}, {2, 2, 200}}},
Expand All @@ -22,39 +17,52 @@ const std::map<std::vector<size_t>, std::vector<std::vector<size_t>>> inputShape
{{2, 1, 1, 3, 1}, {{1}, {1, 3, 4}, {2, 1, 3, 4}, {1, 1, 1, 1, 1}}},
};

const std::vector<InferenceEngine::Precision> inputsPrecisions = {
InferenceEngine::Precision::FP32,
auto input_shapes_pair_vector = ov::test::utils::combineParams(input_shapes_combinations);

auto converter = [] (const std::vector<std::pair<ov::Shape, ov::Shape>>& shapes) {
std::vector<std::vector<ov::Shape>> result;
for (const auto& shape : shapes) {
result.push_back({shape.first, shape.second});
}
return result;
};

auto input_shapes_static = converter(input_shapes_pair_vector);

std::vector<ov::element::Type> model_type = {
ov::element::f32,
ov::element::f16,
ov::element::i32,
ov::element::boolean,
};

const std::vector<ngraph::helpers::ComparisonTypes> comparisonOpTypes = {
ngraph::helpers::ComparisonTypes::EQUAL,
ngraph::helpers::ComparisonTypes::NOT_EQUAL,
ngraph::helpers::ComparisonTypes::GREATER,
ngraph::helpers::ComparisonTypes::GREATER_EQUAL,
ngraph::helpers::ComparisonTypes::LESS,
ngraph::helpers::ComparisonTypes::LESS_EQUAL,
const std::vector<ov::test::utils::ComparisonTypes> comparisonOpTypes = {
ov::test::utils::ComparisonTypes::EQUAL,
ov::test::utils::ComparisonTypes::NOT_EQUAL,
ov::test::utils::ComparisonTypes::GREATER,
ov::test::utils::ComparisonTypes::GREATER_EQUAL,
ov::test::utils::ComparisonTypes::LESS,
ov::test::utils::ComparisonTypes::LESS_EQUAL,
};

const std::vector<ngraph::helpers::InputLayerType> secondInputTypes = {
ngraph::helpers::InputLayerType::CONSTANT,
ngraph::helpers::InputLayerType::PARAMETER,
const std::vector<ov::test::utils::InputLayerType> secondInputTypes = {
ov::test::utils::InputLayerType::CONSTANT,
ov::test::utils::InputLayerType::PARAMETER,
};

const std::map<std::string, std::string> additional_config = {};

INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs,
ComparisonLayerTest,
::testing::Combine(::testing::ValuesIn(ov::test::utils::combineParams(inputShapes)),
::testing::ValuesIn(inputsPrecisions),
::testing::Combine(::testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shapes_static)),
::testing::ValuesIn(comparisonOpTypes),
::testing::ValuesIn(secondInputTypes),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::ValuesIn(model_type),
::testing::Values(ov::test::utils::DEVICE_GPU),
::testing::Values(additional_config)),
ComparisonLayerTest::getTestCaseName);

const std::vector<InputShapesTuple> inputShapesIsOps = {
const std::vector<std::vector<ov::Shape>> inputShapesIsOps = {
{{5}, {1}},
{{2, 2}, {1}},
{{2, 2, 2}, {1}},
Expand All @@ -63,20 +71,17 @@ const std::vector<InputShapesTuple> inputShapesIsOps = {
{{2, 17, 3, 4, 8, 2}, {1}},
};

const std::vector<InferenceEngine::Precision> inputsPrecisionsIsOps = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16,
std::vector<ov::test::utils::ComparisonTypes> comparisonOpTypesIs = {
ov::test::utils::ComparisonTypes::IS_FINITE,
ov::test::utils::ComparisonTypes::IS_NAN
};

INSTANTIATE_TEST_SUITE_P(smoke_IsOp,
ComparisonLayerTest,
::testing::Combine(::testing::ValuesIn(inputShapesIsOps),
::testing::ValuesIn(inputsPrecisionsIsOps),
::testing::Values(ngraph::helpers::ComparisonTypes::IS_FINITE,
ngraph::helpers::ComparisonTypes::IS_NAN),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::Values(InferenceEngine::Precision::BOOL),
::testing::Combine(::testing::ValuesIn(ov::test::static_shapes_to_test_representation(inputShapesIsOps)),
::testing::ValuesIn(comparisonOpTypesIs),
::testing::Values(ov::test::utils::InputLayerType::CONSTANT),
::testing::Values(ov::element::f32),
andrei-cv marked this conversation as resolved.
Show resolved Hide resolved
::testing::Values(ov::test::utils::DEVICE_GPU),
::testing::Values(additional_config)),
ComparisonLayerTest::getTestCaseName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,31 @@

#include <vector>

#include "single_layer_tests/conversion.hpp"
#include "single_op_tests/conversion.hpp"
#include "common_test_utils/test_constants.hpp"

using namespace LayerTestsDefinitions;

namespace {
const std::vector<ngraph::helpers::ConversionTypes> conversionOpTypes = {
ngraph::helpers::ConversionTypes::CONVERT,
ngraph::helpers::ConversionTypes::CONVERT_LIKE,
using ov::test::ConversionLayerTest;
const std::vector<ov::test::utils::ConversionTypes> conversionOpTypes = {
ov::test::utils::ConversionTypes::CONVERT,
ov::test::utils::ConversionTypes::CONVERT_LIKE,
};

const std::vector<std::vector<size_t>> inShape = {{1, 2, 3, 4}};
const std::vector<std::vector<ov::Shape>> inShape = {{{1, 2, 3, 4}}};

const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16,
InferenceEngine::Precision::U8,
InferenceEngine::Precision::I8,
const std::vector<ov::element::Type> netPrecisions = {
ov::element::f32,
ov::element::f16,
ov::element::u8,
ov::element::i8,
};

INSTANTIATE_TEST_SUITE_P(smoke_NoReshape, ConversionLayerTest,
::testing::Combine(
::testing::ValuesIn(conversionOpTypes),
::testing::Values(inShape),
::testing::ValuesIn(ov::test::static_shapes_to_test_representation(inShape)),
::testing::ValuesIn(netPrecisions),
::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::Layout::ANY),
::testing::Values(InferenceEngine::Layout::ANY),
::testing::Values(ov::test::utils::DEVICE_GPU)),
ConversionLayerTest::getTestCaseName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,86 @@

#include <vector>

#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<ov::Shape> inShapes_nhwc = {
{1, 10, 10, 1}
};

const std::vector<ov::element::Type> inTypes = {
ov::element::u8, ov::element::f32
ov::element::u8,
ov::element::f32
};

auto generate_input_static_shapes = [] (const std::vector<ov::Shape>& original_shapes, bool single_plane) {
std::vector<std::vector<ov::Shape>> result_shapes;
for (const auto& original_shape : original_shapes) {
std::vector<ov::Shape> 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;
};

INSTANTIATE_TEST_SUITE_P(smoke_TestsConvertColorI420,
auto in_shapes_single_plane_static = generate_input_static_shapes(inShapes_nhwc, true);
auto in_shapes_three_planes_static = generate_input_static_shapes(inShapes_nhwc, false);

INSTANTIATE_TEST_SUITE_P(smoke_TestsConvertColorI420SinglePlane,
ConvertColorI420LayerTest,
::testing::Combine(::testing::ValuesIn(inShapes_nhwc),
::testing::Combine(::testing::ValuesIn(ov::test::static_shapes_to_test_representation(in_shapes_single_plane_static)),
::testing::ValuesIn(inTypes),
::testing::Bool(),
::testing::Values(true),
::testing::Values(ov::test::utils::DEVICE_GPU)),
ConvertColorI420LayerTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(smoke_TestsConvertColorI420ThreePlanes,
ConvertColorI420LayerTest,
::testing::Combine(::testing::ValuesIn(ov::test::static_shapes_to_test_representation(in_shapes_three_planes_static)),
::testing::ValuesIn(inTypes),
::testing::Bool(),
::testing::Values(false),
::testing::Values(ov::test::utils::DEVICE_GPU)),
ConvertColorI420LayerTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(smoke_TestsConvertColorI420_acc,
ConvertColorI420AccuracyTest,
::testing::Combine(::testing::Values(ov::Shape{1, 16 * 6, 16, 1}),
INSTANTIATE_TEST_SUITE_P(smoke_TestsConvertColorI420SinglePlane_acc,
ConvertColorI420LayerTest,
::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::Bool(),
::testing::Values(true),
::testing::Values(ov::test::utils::DEVICE_GPU)),
ConvertColorI420LayerTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(smoke_TestsConvertColorI420ThreePlanes_acc,
ConvertColorI420LayerTest,
::testing::Combine(::testing::ValuesIn(ov::test::static_shapes_to_test_representation(
generate_input_static_shapes({{1, 16 * 6, 16, 1}}, false))),
::testing::Values(ov::element::u8),
::testing::Bool(),
::testing::Values(false),
::testing::Values(ov::test::utils::DEVICE_GPU)),
ConvertColorI420LayerTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(nightly_TestsConvertColorI420_acc,
ConvertColorI420AccuracyTest,
::testing::Combine(::testing::Values(ov::Shape{1, 256 * 256, 256, 1}),
ConvertColorI420LayerTest,
::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),
Expand Down
Loading