Skip to content

Commit cff39c3

Browse files
author
Liubov Batanina
authored
[IE TEST] LRN tests fixed params (#743)
* LRN tests fixed params * Fix comment * Swiched to opset3
1 parent c9749ce commit cff39c3

File tree

4 files changed

+22
-14
lines changed
  • inference-engine/tests/functional/plugin
    • cpu/shared_tests_instances/single_layer_tests
    • gpu/shared_tests_instances/single_layer_tests
    • shared

4 files changed

+22
-14
lines changed

inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/lrn.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@ const std::vector<InferenceEngine::Precision> netPrecisions = {InferenceEngine::
1818
InferenceEngine::Precision::FP16};
1919

2020
const double alpha = 9.9e-05;
21-
const size_t beta = 2;
22-
const size_t bias = 1.0f;
21+
const double beta = 2;
22+
const double bias = 1.0;
2323
const size_t size = 5;
2424

2525
INSTANTIATE_TEST_CASE_P(LrnCheck, LrnLayerTest,
2626
::testing::Combine(::testing::Values(alpha),
2727
::testing::Values(beta),
2828
::testing::Values(bias),
2929
::testing::Values(size),
30+
::testing::Values(std::vector<size_t>({1})),
3031
::testing::ValuesIn(netPrecisions),
3132
::testing::Values(std::vector<size_t>({10, 10, 3, 2})),
3233
::testing::Values(CommonTestUtils::DEVICE_CPU)),

inference-engine/tests/functional/plugin/gpu/shared_tests_instances/single_layer_tests/lrn.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@ const std::vector<InferenceEngine::Precision> netPrecisions = {InferenceEngine::
1616
InferenceEngine::Precision::FP16};
1717

1818
const double alpha = 9.9e-05;
19-
const size_t beta = 2;
20-
const size_t bias = 1.0f;
19+
const double beta = 2;
20+
const double bias = 1.0;
2121
const size_t size = 5;
2222

2323
INSTANTIATE_TEST_CASE_P(LrnCheck, LrnLayerTest,
2424
::testing::Combine(::testing::Values(alpha),
2525
::testing::Values(beta),
2626
::testing::Values(bias),
2727
::testing::Values(size),
28+
::testing::Values(std::vector<size_t>({1})),
2829
::testing::ValuesIn(netPrecisions),
2930
::testing::Values(std::vector<size_t>({10, 10, 3, 2})),
3031
::testing::Values(CommonTestUtils::DEVICE_GPU)),

inference-engine/tests/functional/plugin/shared/include/single_layer_tests/lrn.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ namespace LayerTestsDefinitions {
1919

2020
typedef std::tuple<
2121
double, // Alpha
22-
size_t, // Beta
23-
size_t, // Bias
24-
size_t, // Size,
22+
double, // Beta
23+
double, // Bias
24+
size_t, // Size
25+
std::vector<size_t>, // Reduction axes
2526
InferenceEngine::Precision, // Network precision
2627
InferenceEngine::SizeVector, // Input shapes
2728
std::string // Device name

inference-engine/tests/functional/plugin/shared/src/single_layer_tests/lrn.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
namespace LayerTestsDefinitions {
1414

1515
std::string LrnLayerTest::getTestCaseName(testing::TestParamInfo<lrnLayerTestParamsSet> obj) {
16-
double alpha;
17-
size_t beta, bias, size;
16+
double alpha, beta, bias;
17+
size_t size;
18+
std::vector<size_t> axes;
1819
InferenceEngine::Precision netPrecision;
1920
std::vector<size_t> inputShapes;
2021
std::string targetDevice;
21-
std::tie(alpha, beta, bias, size, netPrecision, inputShapes, targetDevice) = obj.param;
22+
std::tie(alpha, beta, bias, size, axes, netPrecision, inputShapes, targetDevice) = obj.param;
2223

2324
std::ostringstream result;
2425
const char separator = '_';
@@ -27,6 +28,7 @@ std::string LrnLayerTest::getTestCaseName(testing::TestParamInfo<lrnLayerTestPar
2728
result << "Beta=" << beta << separator;
2829
result << "Bias=" << bias << separator;
2930
result << "Size=" << size << separator;
31+
result << "Axes=" << CommonTestUtils::vec2str(axes) << separator;
3032
result << "netPRC=" << netPrecision.name() << separator;
3133
result << "targetDevice=" << targetDevice;
3234

@@ -36,16 +38,19 @@ std::string LrnLayerTest::getTestCaseName(testing::TestParamInfo<lrnLayerTestPar
3638
void LrnLayerTest::SetUp() {
3739
std::vector<size_t> inputShapes;
3840
auto netPrecision = InferenceEngine::Precision::UNSPECIFIED;
39-
size_t alpha, beta, bias, size;
40-
std::tie(alpha, beta, bias, size, netPrecision, inputShapes, targetDevice) = GetParam();
41+
double alpha, beta, bias;
42+
size_t size;
43+
std::vector<size_t> axes;
44+
std::tie(alpha, beta, bias, size, axes, netPrecision, inputShapes, targetDevice) = GetParam();
4145

4246
auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision);
4347
auto params = ngraph::builder::makeParams(ngPrc, {inputShapes});
4448
auto paramIn =
4549
ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes<ngraph::op::Parameter>(params));
4650

47-
auto lrn = std::make_shared<ngraph::opset1::LRN>(paramIn[0], alpha, beta, bias, size);
48-
ngraph::ResultVector results {std::make_shared<ngraph::opset1::Result>(lrn)};
51+
auto axes_node = std::make_shared<ngraph::op::Constant>(ngraph::element::i64, ngraph::Shape{axes.size()}, axes.data());
52+
auto lrn = std::make_shared<ngraph::opset3::LRN>(paramIn[0], axes_node, alpha, beta, bias, size);
53+
ngraph::ResultVector results {std::make_shared<ngraph::opset3::Result>(lrn)};
4954
function = std::make_shared<ngraph::Function>(results, params, "lrn");
5055
}
5156

0 commit comments

Comments
 (0)