Skip to content

Commit

Permalink
add a few tests (openvinotoolkit#20824)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-cv authored Nov 2, 2023
1 parent 8e4c4c3 commit ff7b49c
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 128 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@
// SPDX-License-Identifier: Apache-2.0
//

#include <vector>

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

using namespace LayerTestsDefinitions;

namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::I32,
InferenceEngine::Precision::U8,
InferenceEngine::Precision::I8,
using ov::test::ReduceOpsLayerTest;
using ov::test::ReduceOpsLayerWithSpecificInputTest;

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

const std::vector<bool> keepDims = {
Expand Down Expand Up @@ -58,19 +57,19 @@ std::vector<ov::test::utils::OpType> opTypes = {
ov::test::utils::OpType::VECTOR,
};

const std::vector<ngraph::helpers::ReductionType> reductionTypes = {
ngraph::helpers::ReductionType::Mean,
ngraph::helpers::ReductionType::Min,
ngraph::helpers::ReductionType::Max,
ngraph::helpers::ReductionType::Sum,
ngraph::helpers::ReductionType::Prod,
ngraph::helpers::ReductionType::L1,
ngraph::helpers::ReductionType::L2,
const std::vector<ov::test::utils::ReductionType> reductionTypes = {
ov::test::utils::ReductionType::Mean,
ov::test::utils::ReductionType::Min,
ov::test::utils::ReductionType::Max,
ov::test::utils::ReductionType::Sum,
ov::test::utils::ReductionType::Prod,
ov::test::utils::ReductionType::L1,
ov::test::utils::ReductionType::L2,
};

const std::vector<ngraph::helpers::ReductionType> reductionLogicalTypes = {
ngraph::helpers::ReductionType::LogicalOr,
ngraph::helpers::ReductionType::LogicalAnd
const std::vector<ov::test::utils::ReductionType> reductionLogicalTypes = {
ov::test::utils::ReductionType::LogicalOr,
ov::test::utils::ReductionType::LogicalAnd
};

INSTANTIATE_TEST_SUITE_P(smoke_ReduceOneAxis,
Expand All @@ -79,10 +78,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_ReduceOneAxis,
testing::ValuesIn(opTypes),
testing::Values(true, false),
testing::ValuesIn(reductionTypes),
testing::Values(InferenceEngine::Precision::FP32),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Layout::ANY),
testing::Values(ov::element::f32),
testing::ValuesIn(inputShapesOneAxis),
testing::Values(ov::test::utils::DEVICE_GPU)),
ReduceOpsLayerTest::getTestCaseName);
Expand All @@ -93,10 +89,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_ReduceLogicalOneAxis,
testing::ValuesIn(opTypes),
testing::Values(true, false),
testing::ValuesIn(reductionLogicalTypes),
testing::Values(InferenceEngine::Precision::BOOL),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Layout::ANY),
testing::Values(ov::element::boolean),
testing::ValuesIn(inputShapes),
testing::Values(ov::test::utils::DEVICE_GPU)),
ReduceOpsLayerTest::getTestCaseName);
Expand All @@ -106,12 +99,9 @@ INSTANTIATE_TEST_SUITE_P(smoke_Reduce_Precisions,
testing::Combine(testing::Values(std::vector<int>{1, 3}),
testing::Values(opTypes[1]),
testing::ValuesIn(keepDims),
testing::Values(ngraph::helpers::ReductionType::Sum),
testing::Values(InferenceEngine::Precision::FP32,
InferenceEngine::Precision::I32),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Layout::ANY),
testing::Values(ov::test::utils::ReductionType::Sum),
testing::Values(ov::element::f32,
ov::element::i32),
testing::Values(std::vector<size_t>{2, 2, 2, 2}),
testing::Values(ov::test::utils::DEVICE_GPU)),
ReduceOpsLayerTest::getTestCaseName);
Expand All @@ -122,12 +112,9 @@ INSTANTIATE_TEST_SUITE_P(smoke_Reduce_Ranks,
std::vector<int>{-1, -2}),
testing::Values(opTypes[1]),
testing::ValuesIn(keepDims),
testing::Values(ngraph::helpers::ReductionType::Sum),
testing::Values(InferenceEngine::Precision::FP32,
InferenceEngine::Precision::I32),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Layout::ANY),
testing::Values(ov::test::utils::ReductionType::Sum),
testing::Values(ov::element::f32,
ov::element::i32),
testing::Values(std::vector<size_t>{2, 3, 4, 5, 4, 3, 2, 3},
std::vector<size_t>{2, 3, 4, 5, 4, 3, 2}),
testing::Values(ov::test::utils::DEVICE_GPU)),
Expand All @@ -138,11 +125,8 @@ INSTANTIATE_TEST_SUITE_P(smoke_Reduce_InputShapes,
testing::Combine(testing::Values(std::vector<int>{0}),
testing::Values(opTypes[1]),
testing::ValuesIn(keepDims),
testing::Values(ngraph::helpers::ReductionType::Mean),
testing::Values(InferenceEngine::Precision::FP32),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Layout::ANY),
testing::Values(ov::test::utils::ReductionType::Mean),
testing::Values(ov::element::f32),
testing::Values(std::vector<size_t>{3},
std::vector<size_t>{3, 5},
std::vector<size_t>{2, 4, 6},
Expand All @@ -157,11 +141,8 @@ INSTANTIATE_TEST_SUITE_P(smoke_Reduce_Axes,
testing::Combine(testing::ValuesIn(axes),
testing::Values(opTypes[1]),
testing::ValuesIn(keepDims),
testing::Values(ngraph::helpers::ReductionType::Mean),
testing::Values(InferenceEngine::Precision::FP32),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Layout::ANY),
testing::Values(ov::test::utils::ReductionType::Mean),
testing::Values(ov::element::f32),
testing::ValuesIn(inputShapes),
testing::Values(ov::test::utils::DEVICE_GPU)),
ReduceOpsLayerTest::getTestCaseName);
Expand All @@ -172,10 +153,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_Reduce_ReductionTypes,
testing::Values(opTypes[1]),
testing::ValuesIn(keepDims),
testing::ValuesIn(reductionTypes),
testing::Values(InferenceEngine::Precision::FP32),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Layout::ANY),
testing::Values(ov::element::f32),
testing::Values(std::vector<size_t>{2, 9, 2, 9}),
testing::Values(ov::test::utils::DEVICE_GPU)),
ReduceOpsLayerTest::getTestCaseName);
Expand All @@ -186,10 +164,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_ReduceLogical_ReductionTypes,
testing::Values(opTypes[1]),
testing::ValuesIn(keepDims),
testing::ValuesIn(reductionLogicalTypes),
testing::Values(InferenceEngine::Precision::BOOL),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Layout::ANY),
testing::Values(ov::element::boolean),
testing::Values(std::vector<size_t>{2, 9, 2, 9}),
testing::Values(ov::test::utils::DEVICE_GPU)),
ReduceOpsLayerTest::getTestCaseName);
Expand All @@ -199,12 +174,9 @@ INSTANTIATE_TEST_SUITE_P(smoke_Reduce,
testing::Combine(testing::ValuesIn(decltype(axes){{0}, {1}}),
testing::Values(opTypes[1]),
testing::Values(true),
testing::Values(ngraph::helpers::ReductionType::Sum),
testing::Values(InferenceEngine::Precision::FP32,
InferenceEngine::Precision::I32),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Layout::ANY),
testing::Values(ov::test::utils::ReductionType::Sum),
testing::Values(ov::element::f32,
ov::element::i32),
testing::Values(std::vector<size_t>{2, 10}),
testing::Values(ov::test::utils::DEVICE_GPU)),
ReduceOpsLayerWithSpecificInputTest::getTestCaseName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@
// SPDX-License-Identifier: Apache-2.0
//

#include <vector>

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

using namespace LayerTestsDefinitions;
using ov::test::RegionYoloLayerTest;

const std::vector<ngraph::Shape> inShapes_caffe = {
const std::vector<std::vector<size_t>> inShapes_caffe = {
{1, 125, 13, 13}
};

const std::vector<ngraph::Shape> inShapes_mxnet = {
const std::vector<std::vector<size_t>> inShapes_mxnet = {
{1, 75, 52, 52},
{1, 75, 32, 32},
{1, 75, 26, 26},
Expand All @@ -22,7 +20,7 @@ const std::vector<ngraph::Shape> inShapes_mxnet = {
{1, 75, 8, 8}
};

const std::vector<ngraph::Shape> inShapes_v3 = {
const std::vector<std::vector<size_t>> inShapes_v3 = {
{1, 255, 52, 52},
{1, 255, 26, 26},
{1, 255, 13, 13}
Expand Down Expand Up @@ -51,7 +49,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_TestsRegionYolov3,
::testing::Values(masks[2]),
::testing::Values(start_axis),
::testing::Values(end_axis),
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(ov::element::f32),
::testing::Values(ov::test::utils::DEVICE_GPU)),
RegionYoloLayerTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_TestsRegionYoloMxnet,
Expand All @@ -64,7 +62,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_TestsRegionYoloMxnet,
::testing::Values(masks[1]),
::testing::Values(start_axis),
::testing::Values(end_axis),
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(ov::element::f32),
::testing::Values(ov::test::utils::DEVICE_GPU)),
RegionYoloLayerTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_TestsRegionYoloCaffe,
Expand All @@ -77,6 +75,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_TestsRegionYoloCaffe,
::testing::Values(masks[0]),
::testing::Values(start_axis),
::testing::Values(end_axis),
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(ov::element::f32),
::testing::Values(ov::test::utils::DEVICE_GPU)),
RegionYoloLayerTest::getTestCaseName);
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@
// SPDX-License-Identifier: Apache-2.0
//

#include <vector>

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

using namespace LayerTestsDefinitions;
using ov::test::ReorgYoloLayerTest;

const std::vector<ngraph::Shape> inShapes_caffe_yolov2 = {
const std::vector<std::vector<size_t>> inShapes_caffe_yolov2 = {
{1, 64, 26, 26},
};

const std::vector<ngraph::Shape> inShapes = {
const std::vector<std::vector<size_t>> inShapes = {
{1, 4, 4, 4},
{1, 8, 4, 4},
{1, 9, 3, 3},
Expand All @@ -29,41 +27,41 @@ INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_caffe_YoloV2,
ReorgYoloLayerTest,
::testing::Combine(::testing::ValuesIn(inShapes_caffe_yolov2),
::testing::Values(strides[0]),
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(ov::element::f32),
::testing::Values(ov::test::utils::DEVICE_GPU)),
ReorgYoloLayerTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_stride_2_smallest,
ReorgYoloLayerTest,
::testing::Combine(::testing::Values(inShapes[0]),
::testing::Values(strides[0]),
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(ov::element::f32),
::testing::Values(ov::test::utils::DEVICE_GPU)),
ReorgYoloLayerTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_stride_2,
ReorgYoloLayerTest,
::testing::Combine(::testing::Values(inShapes[1]),
::testing::Values(strides[0]),
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(ov::element::f32),
::testing::Values(ov::test::utils::DEVICE_GPU)),
ReorgYoloLayerTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_stride_3,
ReorgYoloLayerTest,
::testing::Combine(::testing::Values(inShapes[2]),
::testing::Values(strides[1]),
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(ov::element::f32),
::testing::Values(ov::test::utils::DEVICE_GPU)),
ReorgYoloLayerTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_smaller_h,
ReorgYoloLayerTest,
::testing::Combine(::testing::Values(inShapes[4]),
::testing::Values(strides[0]),
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(ov::element::f32),
::testing::Values(ov::test::utils::DEVICE_GPU)),
ReorgYoloLayerTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_batch_2,
ReorgYoloLayerTest,
::testing::Combine(::testing::Values(inShapes[3]),
::testing::Values(strides[0]),
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(ov::element::f32),
::testing::Values(ov::test::utils::DEVICE_GPU)),
ReorgYoloLayerTest::getTestCaseName);
Loading

0 comments on commit ff7b49c

Please sign in to comment.