[IE TESTS] Add ShapeOf SingleLayerTest (#1285)

* [IE TESTS] add single layer test ShapeOf

* [IE TESTS] update for master

* [IE TESTS] add subgraph test

* [IE TESTS] update todo in skip_tests_config

* [IE TESTS] update skip_tests_config

* [IE TESTS] update skip_tests_config

* [IE TESTS] update opset3
This commit is contained in:
Anton Zaytsev 2020-07-14 23:55:32 +03:00 committed by GitHub
parent d7cb5ba4ba
commit 24961638cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 198 additions and 3 deletions

View File

@ -0,0 +1,23 @@
// Copyright (C) 2019 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "single_layer_tests/shape_of.hpp"
#include "common_test_utils/test_constants.hpp"
using namespace LayerTestsDefinitions;
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::I32
};
INSTANTIATE_TEST_CASE_P(Check, ShapeOfLayerTest,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(std::vector<size_t>({10, 10, 10})),
::testing::Values(CommonTestUtils::DEVICE_CPU)),
ShapeOfLayerTest::getTestCaseName);
} // namespace

View File

@ -42,9 +42,12 @@ std::vector<std::string> disabledTestPatterns() {
R"(.*IEClassGetAvailableDevices.*)",
// TODO: Issue: 25533
R"(.*ConvertLikeLayerTest.*)",
//TODO: Issue: 34516
// TODO: Issue: 34516
R"(.*ConvertLayerTest.*)",
//TODO: Issue: 34805
// TODO: Issue: 34055
R"(.*ShapeOfLayerTest.*)",
R"(.*ReluShapeOfSubgraphTest.*)",
// TODO: Issue: 34805
R"(.*ActivationLayerTest.*Ceiling.*)"
};
}
}

View File

@ -0,0 +1,23 @@
// Copyright (C) 2019 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "subgraph_tests/relu_shape_of.hpp"
#include "common_test_utils/test_constants.hpp"
using namespace LayerTestsDefinitions;
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::I32
};
INSTANTIATE_TEST_CASE_P(Check, ReluShapeOfSubgraphTest,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(std::vector<size_t>({20, 10, 10, 10})),
::testing::Values(CommonTestUtils::DEVICE_CPU)),
ReluShapeOfSubgraphTest::getTestCaseName);
} // namespace

View File

@ -0,0 +1,32 @@
// Copyright (C) 2019 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <tuple>
#include <string>
#include <vector>
#include <memory>
#include "ngraph_functions/builders.hpp"
#include "ngraph_functions/utils/ngraph_helpers.hpp"
#include "functional_test_utils/layer_test_utils.hpp"
namespace LayerTestsDefinitions {
typedef std::tuple<
InferenceEngine::Precision, // Network precision
std::vector<size_t>, // Input shapes
std::string // Device name
> shapeOfParams;
class ShapeOfLayerTest : public testing::WithParamInterface<shapeOfParams>,
public LayerTestsUtils::LayerTestsCommon {
public:
static std::string getTestCaseName(testing::TestParamInfo<shapeOfParams> obj);
protected:
void SetUp() override;
};
} // namespace LayerTestsDefinitions

View File

@ -0,0 +1,26 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <tuple>
#include <string>
#include <vector>
#include <memory>
#include "functional_test_utils/layer_test_utils.hpp"
#include "ngraph_functions/builders.hpp"
#include "single_layer_tests/shape_of.hpp"
namespace LayerTestsDefinitions {
class ReluShapeOfSubgraphTest : public testing::WithParamInterface<shapeOfParams>,
public LayerTestsUtils::LayerTestsCommon {
public:
static std::string getTestCaseName(testing::TestParamInfo<shapeOfParams> obj);
protected:
void SetUp() override;
};
} // namespace LayerTestsDefinitions

View File

@ -0,0 +1,52 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <tuple>
#include <string>
#include <vector>
#include <memory>
#include <functional>
#include <functional_test_utils/skip_tests_config.hpp>
#include "ie_core.hpp"
#include "ngraph_functions/utils/ngraph_helpers.hpp"
#include "common_test_utils/common_utils.hpp"
#include "functional_test_utils/blob_utils.hpp"
#include "functional_test_utils/plugin_cache.hpp"
#include "functional_test_utils/layer_test_utils.hpp"
#include "single_layer_tests/shape_of.hpp"
namespace LayerTestsDefinitions {
std::string ShapeOfLayerTest::getTestCaseName(testing::TestParamInfo<shapeOfParams> obj) {
InferenceEngine::SizeVector inputShapes;
InferenceEngine::Precision inputPrecision;
std::string targetDevice;
std::tie(inputPrecision, inputShapes, targetDevice) = obj.param;
std::ostringstream result;
result << "IS=" << CommonTestUtils::vec2str(inputShapes) << "_";
result << "Precision=" << inputPrecision.name() << "_";
result << "TargetDevice=" << targetDevice;
return result.str();
}
void ShapeOfLayerTest::SetUp() {
InferenceEngine::SizeVector inputShapes;
InferenceEngine::Precision inputPrecision;
std::tie(inputPrecision, inputShapes, targetDevice) = this->GetParam();
auto inType = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(inputPrecision);
auto param = ngraph::builder::makeParams(inType, {inputShapes});
auto paramOuts = ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes<ngraph::opset3::Parameter>(param));
auto shapeOf = std::make_shared<ngraph::opset3::ShapeOf>(paramOuts[0], inType);
ngraph::ResultVector results{std::make_shared<ngraph::opset3::Result>(shapeOf)};
function = std::make_shared<ngraph::Function>(results, param, "shapeOf");
}
TEST_P(ShapeOfLayerTest, CompareWithRefs) {
Run();
}
} // namespace LayerTestsDefinitions

View File

@ -0,0 +1,36 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "subgraph_tests/relu_shape_of.hpp"
namespace LayerTestsDefinitions {
std::string ReluShapeOfSubgraphTest::getTestCaseName(testing::TestParamInfo<shapeOfParams> obj) {
InferenceEngine::SizeVector inputShapes;
InferenceEngine::Precision inputPrecision;
std::string targetDevice;
std::tie(inputPrecision, inputShapes, targetDevice) = obj.param;
std::ostringstream result;
result << "IS=" << CommonTestUtils::vec2str(inputShapes) << "_";
result << "Precision=" << inputPrecision.name() << "_";
result << "TargetDevice=" << targetDevice;
return result.str();
}
void ReluShapeOfSubgraphTest::SetUp() {
InferenceEngine::SizeVector inputShapes;
InferenceEngine::Precision inputPrecision;
std::tie(inputPrecision, inputShapes, targetDevice) = this->GetParam();
auto inType = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(inputPrecision);
auto param = ngraph::builder::makeParams(inType, {inputShapes});
auto relu = std::make_shared<ngraph::opset3::Relu>(param[0]);
auto shapeOf = std::make_shared<ngraph::opset3::ShapeOf>(relu, inType);
const ngraph::ResultVector results{std::make_shared<ngraph::opset3::Result>(shapeOf)};
function = std::make_shared<ngraph::Function>(results, param, "ReluShapeOf");
}
TEST_P(ReluShapeOfSubgraphTest, CompareWithRefs) {
Run();
}
} // namespace LayerTestsDefinitions