Refactor ComparisonLayerTest, ClampLayerTest (#19681)
* Refactor ClampLayerTest * Refactor ComparisonLayerTest
This commit is contained in:
1 parent
faa6b77247
commit
0675d9fd8b
8 files changed
+303
-34
No files matched your search
+18
-15
@@ -4,17 +4,19 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "single_layer_tests/clamp.hpp"
|
||||
#include "single_op_tests/clamp.hpp"
|
||||
#include "common_test_utils/test_constants.hpp"
|
||||
|
||||
using namespace LayerTestsDefinitions;
|
||||
namespace {
|
||||
using ov::test::ClampLayerTest;
|
||||
|
||||
const std::vector<std::vector<size_t>> inShapes = {
|
||||
{50},
|
||||
{10, 10},
|
||||
{1, 20, 20}
|
||||
const std::vector<std::vector<ov::Shape>> input_shapes_static = {
|
||||
{{ 50 }},
|
||||
{{ 10, 10 }},
|
||||
{{ 1, 20, 20 }}
|
||||
};
|
||||
|
||||
|
||||
const std::vector<std::pair<float, float>> intervals = {
|
||||
{-20.1, -10.5},
|
||||
{-10.0, 10.0},
|
||||
@@ -27,26 +29,27 @@ const std::vector<std::pair<float, float>> intervals_unsigned = {
|
||||
{10.6, 20.6}
|
||||
};
|
||||
|
||||
const std::vector<InferenceEngine::Precision> netPrc = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
InferenceEngine::Precision::FP16,
|
||||
InferenceEngine::Precision::I64,
|
||||
InferenceEngine::Precision::I32
|
||||
const std::vector<ov::element::Type> model_type = {
|
||||
ov::element::f32,
|
||||
ov::element::f16,
|
||||
ov::element::i64,
|
||||
ov::element::i32
|
||||
};
|
||||
|
||||
const auto test_Clamp_signed = ::testing::Combine(
|
||||
::testing::ValuesIn(inShapes),
|
||||
::testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shapes_static)),
|
||||
::testing::ValuesIn(intervals),
|
||||
::testing::ValuesIn(netPrc),
|
||||
::testing::ValuesIn(model_type),
|
||||
::testing::Values(ov::test::utils::DEVICE_CPU)
|
||||
);
|
||||
|
||||
const auto test_Clamp_unsigned = ::testing::Combine(
|
||||
::testing::ValuesIn(inShapes),
|
||||
::testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shapes_static)),
|
||||
::testing::ValuesIn(intervals_unsigned),
|
||||
::testing::Values(InferenceEngine::Precision::U64),
|
||||
::testing::Values(ov::element::u64),
|
||||
::testing::Values(ov::test::utils::DEVICE_CPU)
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_TestsClamp_signed, ClampLayerTest, test_Clamp_signed, ClampLayerTest::getTestCaseName);
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_TestsClamp_unsigned, ClampLayerTest, test_Clamp_unsigned, ClampLayerTest::getTestCaseName);
|
||||
} // namespace
|
||||
+25
-19
@@ -3,15 +3,13 @@
|
||||
//
|
||||
|
||||
#include <vector>
|
||||
#include "single_layer_tests/comparison.hpp"
|
||||
#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;
|
||||
|
||||
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}}},
|
||||
@@ -20,11 +18,23 @@ std::map<std::vector<size_t>, std::vector<std::vector<size_t>>> inputShapes = {
|
||||
{{2, 1, 1, 3, 1}, {{1}, {1, 3, 4}, {2, 1, 3, 4}, {1, 1, 1, 1, 1}}},
|
||||
};
|
||||
|
||||
std::vector<InferenceEngine::Precision> inputsPrecisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
InferenceEngine::Precision::FP16,
|
||||
InferenceEngine::Precision::I32,
|
||||
InferenceEngine::Precision::BOOL,
|
||||
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,
|
||||
};
|
||||
|
||||
std::vector<ngraph::helpers::ComparisonTypes> comparisonOpTypes = {
|
||||
@@ -44,19 +54,17 @@ std::vector<ngraph::helpers::InputLayerType> secondInputTypes = {
|
||||
std::map<std::string, std::string> additional_config = {};
|
||||
|
||||
const auto ComparisonTestParams = ::testing::Combine(
|
||||
::testing::ValuesIn(ov::test::utils::combineParams(inputShapes)),
|
||||
::testing::ValuesIn(inputsPrecisions),
|
||||
::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_CPU),
|
||||
::testing::Values(additional_config));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs, ComparisonLayerTest, ComparisonTestParams, ComparisonLayerTest::getTestCaseName);
|
||||
|
||||
|
||||
std::vector<InputShapesTuple> inputShapesIsOps = {
|
||||
std::vector<std::vector<ov::Shape>> input_shapes_is_ops_static = {
|
||||
{{1}, {1}},
|
||||
{{1, 2}, {1}},
|
||||
{{3, 1}, {1}},
|
||||
@@ -79,12 +87,10 @@ std::vector<ngraph::helpers::ComparisonTypes> comparisonOpTypesIs = {
|
||||
};
|
||||
|
||||
const auto ComparisonTestParamsIs = ::testing::Combine(
|
||||
::testing::ValuesIn(inputShapesIsOps),
|
||||
::testing::Values(InferenceEngine::Precision::FP32),
|
||||
::testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shapes_is_ops_static)),
|
||||
::testing::ValuesIn(comparisonOpTypesIs),
|
||||
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(ov::element::f32),
|
||||
::testing::Values(ov::test::utils::DEVICE_CPU),
|
||||
::testing::Values(additional_config));
|
||||
|
||||
|
||||
Reference in new issue
Block a user