[GPU] Refactor Comparison, Conversion, ConvertColorI420 (#20374)
* Comparison * Conversion * ConvertColorI420 * fix * Comparison * Conversion * ConvertColorI420 * fix * fix after review * fix after review * fix after review * fixed comparison --------- Co-authored-by: Pavel Durandin <pavel.durandin@intel.com>
This commit is contained in:
parent
d90e23fc30
commit
44925b580f
@ -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 = {
|
||||
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}}},
|
||||
@ -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;
|
||||
};
|
||||
|
||||
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,
|
||||
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::InputLayerType> secondInputTypes = {
|
||||
ngraph::helpers::InputLayerType::CONSTANT,
|
||||
ngraph::helpers::InputLayerType::PARAMETER,
|
||||
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<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}},
|
||||
@ -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),
|
||||
::testing::Values(ov::test::utils::DEVICE_GPU),
|
||||
::testing::Values(additional_config)),
|
||||
ComparisonLayerTest::getTestCaseName);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_TestsConvertColorI420,
|
||||
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;
|
||||
};
|
||||
|
||||
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::Bool(),
|
||||
::testing::Values(true),
|
||||
::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_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_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),
|
||||
|
Loading…
Reference in New Issue
Block a user