Skip to content

Commit

Permalink
[GPU] Refactor (openvinotoolkit#22053)
Browse files Browse the repository at this point in the history
* add experimental_detectron_detection_output

* experimental_detectron_generate_proposals_single_image

* experimental_detectron_generate_proposals_single_image

* add experimental_detectron_roifeatureextractor

* add experimental_detectron_topk_rois

* add gru_sequence

* add interpolate

* add memory

* edit gru_sequence
  • Loading branch information
andrei-cv authored Jan 10, 2024
1 parent 3722df7 commit 130b60d
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 413 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@
// SPDX-License-Identifier: Apache-2.0
//

#include "single_layer_tests/experimental_detectron_detection_output.hpp"

#include <vector>

#include "common_test_utils/ov_tensor_utils.hpp"

using namespace ov::test;
using namespace ov::test::subgraph;
#include "single_op_tests/experimental_detectron_detection_output.hpp"

namespace {
using ov::test::ExperimentalDetectronDetectionOutputLayerTest;

const std::vector<ov::test::ElementType> netPrecisions = {
ov::element::Type_t::f16,
ov::element::Type_t::f32,
const std::vector<ov::element::Type> netPrecisions = {
ov::element::f16,
ov::element::f32,
};

const std::vector<float> score_threshold = {0.01f, 0.8f};
Expand Down Expand Up @@ -46,15 +40,15 @@ const bool class_agnostic_box_regression_false = false;
// specifies deltas of weights
const std::vector<std::vector<float>> deltas_weights = {{10.0f, 10.0f, 5.0f, 5.0f}};

const std::vector<std::vector<InputShape>> inputShapes = {
const std::vector<ov::test::InputShape> inputShapes = {
// inputRois / inputDeltas / inputScores / inputImInfos
static_shapes_to_test_representation({{16, 4}, {16, 8}, {16, 2}, {1, 3}}),
ov::test::static_shapes_to_test_representation({{16, 4}, {16, 8}, {16, 2}, {1, 3}}),
};


INSTANTIATE_TEST_SUITE_P(smoke_ExperimentalDetectronDetectionOutput,
ExperimentalDetectronDetectionOutputLayerTest,
::testing::Combine(::testing::ValuesIn(inputShapes),
::testing::Combine(::testing::Values(inputShapes),
::testing::ValuesIn(score_threshold),
::testing::ValuesIn(nms_threshold),
::testing::ValuesIn(max_delta_log_wh),
Expand All @@ -69,7 +63,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_ExperimentalDetectronDetectionOutput,

INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_ExperimentalDetectronDetectionOutputMaxDetectionsPerImage,
ExperimentalDetectronDetectionOutputLayerTest,
::testing::Combine(::testing::ValuesIn(inputShapes),
::testing::Combine(::testing::Values(inputShapes),
::testing::ValuesIn(score_threshold),
::testing::ValuesIn(nms_threshold),
::testing::ValuesIn(max_delta_log_wh),
Expand All @@ -84,7 +78,7 @@ INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_ExperimentalDetectronDetectionOutputMaxD

INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_ExperimentalDetectronDetectionOutput,
ExperimentalDetectronDetectionOutputLayerTest,
::testing::Combine(::testing::ValuesIn(inputShapes),
::testing::Combine(::testing::Values(inputShapes),
::testing::ValuesIn(score_threshold),
::testing::ValuesIn(nms_threshold),
::testing::ValuesIn(max_delta_log_wh),
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
// SPDX-License-Identifier: Apache-2.0
//

#include <vector>
#include "single_layer_tests/experimental_detectron_roifeatureextractor.hpp"

using namespace ov::test;
using namespace ov::test::subgraph;
#include "single_op_tests/experimental_detectron_roifeatureextractor.hpp"

namespace {
using ov::test::ExperimentalDetectronROIFeatureExtractorLayerTest;

const std::vector<int64_t> outputSize = {7, 14};
const std::vector<int64_t> samplingRatio = {1, 2, 3};

Expand All @@ -18,10 +16,10 @@ const std::vector<std::vector<int64_t>> pyramidScales = {
{2, 4, 8, 16}
};

const std::vector<std::vector<InputShape>> staticInputShape = {
static_shapes_to_test_representation({{1000, 4}, {1, 8, 200, 336}, {1, 8, 100, 168}, {1, 8, 50, 84}, {1, 8, 25, 42}}),
static_shapes_to_test_representation({{1000, 4}, {1, 16, 200, 336}, {1, 16, 100, 168}, {1, 16, 50, 84}, {1, 16, 25, 42}}),
static_shapes_to_test_representation({{1200, 4}, {1, 8, 200, 42}, {1, 8, 100, 336}, {1, 8, 50, 168}, {1, 8, 25, 84}})
const std::vector<std::vector<ov::test::InputShape>> staticInputShape = {
ov::test::static_shapes_to_test_representation({{1000, 4}, {1, 8, 200, 336}, {1, 8, 100, 168}, {1, 8, 50, 84}, {1, 8, 25, 42}}),
ov::test::static_shapes_to_test_representation({{1000, 4}, {1, 16, 200, 336}, {1, 16, 100, 168}, {1, 16, 50, 84}, {1, 16, 25, 42}}),
ov::test::static_shapes_to_test_representation({{1200, 4}, {1, 8, 200, 42}, {1, 8, 100, 336}, {1, 8, 50, 168}, {1, 8, 25, 84}})
};

INSTANTIATE_TEST_SUITE_P(smoke_ExperimentalROI_static, ExperimentalDetectronROIFeatureExtractorLayerTest,
Expand All @@ -31,7 +29,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_ExperimentalROI_static, ExperimentalDetectronROIF
::testing::ValuesIn(samplingRatio),
::testing::ValuesIn(pyramidScales),
::testing::Values(false),
::testing::Values(ov::element::Type_t::f32),
::testing::Values(ov::element::f32),
::testing::Values(ov::test::utils::DEVICE_GPU)),
ExperimentalDetectronROIFeatureExtractorLayerTest::getTestCaseName);
} // namespace
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,26 @@
// SPDX-License-Identifier: Apache-2.0
//

#include <vector>
#include "single_layer_tests/experimental_detectron_topkrois.hpp"

using namespace ov::test;
using namespace ov::test::subgraph;
#include "single_op_tests/experimental_detectron_topkrois.hpp"

namespace {
using ov::test::ExperimentalDetectronTopKROIsLayerTest;

std::vector<int64_t> maxRois {
1000,
1500,
2000
};

std::vector<ElementType> elementTypes {
ElementType::f16,
ElementType::f32
std::vector<ov::element::Type_t> elementTypes {
ov::element::f16,
ov::element::f32
};

const std::vector<std::vector<InputShape>> staticInputShape = {
static_shapes_to_test_representation({{3000, 4}, {3000}}),
static_shapes_to_test_representation({{4200, 4}, {4200}}),
static_shapes_to_test_representation({{4500, 4}, {4500}})
const std::vector<std::vector<ov::test::InputShape>> staticInputShape = {
ov::test::static_shapes_to_test_representation({{3000, 4}, {3000}}),
ov::test::static_shapes_to_test_representation({{4200, 4}, {4200}}),
ov::test::static_shapes_to_test_representation({{4500, 4}, {4500}})
};

INSTANTIATE_TEST_SUITE_P(smoke_ExperimentalDetectronTopKROIs_static, ExperimentalDetectronTopKROIsLayerTest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,82 +2,71 @@
// SPDX-License-Identifier: Apache-2.0
//

#include <vector>
#include <ngraph/op/util/attr_types.hpp>
#include "single_layer_tests/gru_sequence.hpp"
#include "common_test_utils/test_constants.hpp"

using namespace LayerTestsDefinitions;
#include "single_op_tests/gru_sequence.hpp"

namespace {
std::vector<ngraph::helpers::SequenceTestsMode> mode{ngraph::helpers::SequenceTestsMode::CONVERT_TO_TI_MAX_SEQ_LEN_CONST,
ngraph::helpers::SequenceTestsMode::CONVERT_TO_TI_RAND_SEQ_LEN_CONST,
ngraph::helpers::SequenceTestsMode::CONVERT_TO_TI_RAND_SEQ_LEN_PARAM,
ngraph::helpers::SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_CONST,
ngraph::helpers::SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_PARAM,
ngraph::helpers::SequenceTestsMode::PURE_SEQ};
using ov::test::GRUSequenceTest;

std::vector<ov::test::utils::SequenceTestsMode> mode{ov::test::utils::SequenceTestsMode::CONVERT_TO_TI_MAX_SEQ_LEN_CONST,
ov::test::utils::SequenceTestsMode::CONVERT_TO_TI_RAND_SEQ_LEN_CONST,
ov::test::utils::SequenceTestsMode::CONVERT_TO_TI_RAND_SEQ_LEN_PARAM,
ov::test::utils::SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_CONST,
ov::test::utils::SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_PARAM,
ov::test::utils::SequenceTestsMode::PURE_SEQ};
// output values increase rapidly without clip, so use only seq_lengths = 2
std::vector<size_t> seq_lengths_zero_clip{2};
std::vector<size_t> seq_lengths_clip_non_zero{20};
std::vector<size_t> batch{10};
std::vector<size_t> hidden_size{1, 10};
std::vector<ov::test::InputShape> seq_lengths_zero_clip{2};
std::vector<ov::test::InputShape> seq_lengths_clip_non_zero{20};
// std::vector<size_t> input_size{10};
std::vector<std::vector<std::string>> activations = {{"relu", "tanh"}, {"tanh", "sigmoid"}, {"sigmoid", "tanh"},
{"tanh", "relu"}};
std::vector<bool> linear_before_reset = {true, false};
std::vector<float> clip{0.f};
std::vector<float> clip_non_zeros{0.7f};
std::vector<ov::op::RecurrentSequenceDirection> direction = {ov::op::RecurrentSequenceDirection::FORWARD,
ov::op::RecurrentSequenceDirection::REVERSE,
ov::op::RecurrentSequenceDirection::BIDIRECTIONAL
ov::op::RecurrentSequenceDirection::REVERSE,
ov::op::RecurrentSequenceDirection::BIDIRECTIONAL
};
std::vector<InferenceEngine::Precision> netPrecisions = {InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16};
std::vector<ov::element::Type> netPrecisions = {ov::element::f32,
ov::element::f16};

INSTANTIATE_TEST_SUITE_P(GRUSequenceCommonZeroClip, GRUSequenceTest,
::testing::Combine(
::testing::ValuesIn(mode),
::testing::ValuesIn(seq_lengths_zero_clip),
::testing::ValuesIn(batch),
::testing::ValuesIn(hidden_size),
::testing::Values(seq_lengths_zero_clip),
// ::testing::ValuesIn(input_size), // hardcoded to 10 due to Combine supports up to 10 args
::testing::ValuesIn(activations),
::testing::ValuesIn(clip),
::testing::ValuesIn(linear_before_reset),
::testing::ValuesIn(direction),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::Values(ov::test::utils::InputLayerType::CONSTANT),
::testing::ValuesIn(netPrecisions),
::testing::Values(ov::test::utils::DEVICE_GPU)),
GRUSequenceTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(GRUSequenceCommonZeroClipNonConstantWRB, GRUSequenceTest,
::testing::Combine(
::testing::Values(ngraph::helpers::SequenceTestsMode::PURE_SEQ),
::testing::ValuesIn(seq_lengths_zero_clip),
::testing::ValuesIn(batch),
::testing::ValuesIn(hidden_size),
::testing::Values(ov::test::utils::SequenceTestsMode::PURE_SEQ),
::testing::Values(seq_lengths_zero_clip),
// ::testing::ValuesIn(input_size), // hardcoded to 10 due to Combine supports up to 10 args
::testing::ValuesIn(activations),
::testing::ValuesIn(clip),
::testing::ValuesIn(linear_before_reset),
::testing::ValuesIn(direction),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::Values(ov::test::utils::InputLayerType::PARAMETER),
::testing::ValuesIn(netPrecisions),
::testing::Values(ov::test::utils::DEVICE_GPU)),
GRUSequenceTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(GRUSequenceCommonClip, GRUSequenceTest,
::testing::Combine(
::testing::ValuesIn(mode),
::testing::ValuesIn(seq_lengths_clip_non_zero),
::testing::ValuesIn(batch),
::testing::ValuesIn(hidden_size),
::testing::Values(seq_lengths_clip_non_zero),
// ::testing::ValuesIn(input_size), // hardcoded to 10 due to Combine supports up to 10 args
::testing::ValuesIn(activations),
::testing::ValuesIn(clip_non_zeros),
::testing::ValuesIn(linear_before_reset),
::testing::ValuesIn(direction),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::Values(ov::test::utils::InputLayerType::CONSTANT),
::testing::ValuesIn(netPrecisions),
::testing::Values(ov::test::utils::DEVICE_GPU)),
GRUSequenceTest::getTestCaseName);
Expand Down
Loading

0 comments on commit 130b60d

Please sign in to comment.