Skip to content

Commit

Permalink
[GPU] Refactor AdaptivePooling, BatchNorm, BatchToSpace (openvinotool…
Browse files Browse the repository at this point in the history
…kit#20357)

* adaptive_pooling

* batch_norm

* batch_to_space
  • Loading branch information
andrei-cv authored Oct 12, 2023
1 parent d41e7fc commit 5727993
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 141 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,21 @@
#include <string>
#include <vector>

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

using namespace ngraph::helpers;
using namespace LayerTestsDefinitions;
using namespace ngraph::element;

namespace {
using ov::test::AdaPoolLayerTest;
const std::vector<std::string> poolingModes = {"max", "avg"};

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

const std::vector<std::vector<size_t>> inputShapes1D = {
{1, 3, 5},
{1, 1, 17},
const std::vector<std::vector<ov::Shape>> inputShapes1D = {
{{1, 3, 5}},
{{1, 1, 17}},
};
const std::vector<std::vector<int>> outputShapes1D = {
{2},
Expand All @@ -31,16 +28,16 @@ const std::vector<std::vector<int>> outputShapes1D = {

INSTANTIATE_TEST_SUITE_P(smoke_AdaptivePooling1D, AdaPoolLayerTest,
::testing::Combine(
::testing::ValuesIn(inputShapes1D),
::testing::ValuesIn(ov::test::static_shapes_to_test_representation(inputShapes1D)),
::testing::ValuesIn(outputShapes1D),
::testing::ValuesIn(poolingModes),
::testing::ValuesIn(netPrecisions),
::testing::ValuesIn(types),
::testing::Values(ov::test::utils::DEVICE_GPU)),
AdaPoolLayerTest::getTestCaseName);

const std::vector<std::vector<size_t>> inputShapes2D = {
{1, 3, 4, 6},
{1, 1, 17, 5},
const std::vector<std::vector<ov::Shape>> inputShapes2D = {
{{1, 3, 4, 6}},
{{1, 1, 17, 5}},
};
const std::vector<std::vector<int>> outputShapes2D = {
{2, 4},
Expand All @@ -49,16 +46,16 @@ const std::vector<std::vector<int>> outputShapes2D = {

INSTANTIATE_TEST_SUITE_P(smoke_AdaptivePooling2D, AdaPoolLayerTest,
::testing::Combine(
::testing::ValuesIn(inputShapes2D),
::testing::ValuesIn(ov::test::static_shapes_to_test_representation(inputShapes2D)),
::testing::ValuesIn(outputShapes2D),
::testing::ValuesIn(poolingModes),
::testing::ValuesIn(netPrecisions),
::testing::ValuesIn(types),
::testing::Values(ov::test::utils::DEVICE_GPU)),
AdaPoolLayerTest::getTestCaseName);

const std::vector<std::vector<size_t>> inputShapes3D = {
{1, 1, 3, 3, 3},
{1, 3, 5, 7, 11},
const std::vector<std::vector<ov::Shape>> inputShapes3D = {
{{1, 1, 3, 3, 3}},
{{1, 3, 5, 7, 11}},
};
const std::vector<std::vector<int>> outputShapes3D = {
{2, 2, 2},
Expand All @@ -67,10 +64,10 @@ const std::vector<std::vector<int>> outputShapes3D = {

INSTANTIATE_TEST_SUITE_P(smoke_AdaptivePooling3D, AdaPoolLayerTest,
::testing::Combine(
::testing::ValuesIn(inputShapes3D),
::testing::ValuesIn(ov::test::static_shapes_to_test_representation(inputShapes3D)),
::testing::ValuesIn(outputShapes3D),
::testing::ValuesIn(poolingModes),
::testing::ValuesIn(netPrecisions),
::testing::ValuesIn(types),
::testing::Values(ov::test::utils::DEVICE_GPU)),
AdaPoolLayerTest::getTestCaseName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,33 @@

#include <vector>

#include "single_layer_tests/batch_norm.hpp"

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

namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
using ov::test::BatchNormLayerTest;
const std::vector<ov::element::Type> types = {
ov::element::f16,
ov::element::f32
};

const std::vector<double> epsilon = {
1e-6,
1e-5,
1e-4
};
const std::vector<std::vector<size_t>> inputShapes = {
{1, 3},
{2, 5},
{1, 3, 10},
{1, 3, 1, 1},
{2, 5, 4, 4},
};

const std::vector<std::vector<ov::Shape>> inputShapes = {
{{1, 3}},
{{2, 5}},
{{1, 3, 10}},
{{1, 3, 1, 1}},
{{2, 5, 4, 4}},
};

const auto batchNormParams = testing::Combine(
testing::ValuesIn(epsilon),
testing::ValuesIn(netPrecisions),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
testing::Values(InferenceEngine::Layout::ANY),
testing::Values(InferenceEngine::Layout::ANY),
testing::ValuesIn(inputShapes),
testing::ValuesIn(types),
testing::ValuesIn(ov::test::static_shapes_to_test_representation(inputShapes)),
testing::Values(ov::test::utils::DEVICE_GPU)
);

Expand Down
Loading

0 comments on commit 5727993

Please sign in to comment.