[IE Tests] Added NormalizeL2 tests (#2327)

* Added NormalizeL2 tests

* Added NormalizeL2 reference

* Add nGraph tests

* Fix tests

* Added NormalizeL2 builder
This commit is contained in:
Liubov Batanina
2020-10-08 07:23:25 +03:00
committed by GitHub
parent 8062f20c15
commit 7f78dd797e
12 changed files with 477 additions and 4 deletions

View File

@@ -0,0 +1,35 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <string>
#include <tuple>
#include <vector>
#include "functional_test_utils/layer_test_utils.hpp"
#include "ngraph_functions/builders.hpp"
namespace LayerTestsDefinitions {
using NormalizeL2LayerTestParams = std::tuple<
std::vector<int64_t>, // axes
float, // eps
ngraph::op::EpsMode, // eps_mode
InferenceEngine::SizeVector, // inputShape
InferenceEngine::Precision, // netPrecision
std::string // targetDevice
>;
class NormalizeL2LayerTest : public testing::WithParamInterface<NormalizeL2LayerTestParams>,
virtual public LayerTestsUtils::LayerTestsCommon {
public:
static std::string getTestCaseName(testing::TestParamInfo<NormalizeL2LayerTestParams> obj);
protected:
void SetUp() override;
};
} // namespace LayerTestsDefinitions

View File

@@ -0,0 +1,47 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "single_layer_tests/normalize_l2.hpp"
namespace LayerTestsDefinitions {
std::string NormalizeL2LayerTest::getTestCaseName(testing::TestParamInfo<NormalizeL2LayerTestParams> obj) {
std::vector<int64_t> axes;
float eps;
ngraph::op::EpsMode epsMode;
InferenceEngine::SizeVector inputShape;
InferenceEngine::Precision netPrecision;
std::string targetDevice;
std::tie(axes, eps, epsMode, inputShape, netPrecision, targetDevice) = obj.param;
std::ostringstream result;
result << "IS=" << CommonTestUtils::vec2str(inputShape) << "_";
result << "axes=" << CommonTestUtils::vec2str(axes) << "_";
result << "eps=" << eps << "_";
result << "epsMode=" << epsMode << "_";
result << "netPRC=" << netPrecision.name() << "_";
result << "targetDevice=" << targetDevice;
return result.str();
}
void NormalizeL2LayerTest::SetUp() {
InferenceEngine::SizeVector inputShape;
std::vector<int64_t> axes;
float eps;
ngraph::op::EpsMode epsMode;
InferenceEngine::Precision netPrecision;
std::tie(axes, eps, epsMode, inputShape, netPrecision, targetDevice) = this->GetParam();
auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision);
auto params = ngraph::builder::makeParams(ngPrc, {inputShape});
auto norm = ngraph::builder::makeNormalizeL2(params[0], axes, eps, epsMode);
ngraph::ResultVector results{std::make_shared<ngraph::opset4::Result>(norm)};
function = std::make_shared<ngraph::Function>(results, params, "NormalizeL2");
}
TEST_P(NormalizeL2LayerTest, CompareWithRefs) {
Run();
}
} // namespace LayerTestsDefinitions