[CPU] fix: supported Tile with more than 5 dims (#2062)

This commit is contained in:
Anton Voronov
2020-09-07 15:39:19 +03:00
committed by GitHub
parent cba0892832
commit 7c95e8f8ff
6 changed files with 146 additions and 15 deletions

View File

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

View File

@@ -0,0 +1,49 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <tuple>
#include <vector>
#include <string>
#include <memory>
#include <functional>
#include "single_layer_tests/tile.hpp"
namespace LayerTestsDefinitions {
std::string TileLayerTest::getTestCaseName(testing::TestParamInfo<TileLayerTestParamsSet> obj) {
TileSpecificParams tileParams;
InferenceEngine::Precision netPrecision;
InferenceEngine::SizeVector inputShapes;
std::string targetDevice;
std::tie(tileParams, netPrecision, inputShapes, targetDevice) = obj.param;
std::ostringstream result;
result << "IS=" << CommonTestUtils::vec2str(inputShapes) << "_";
result << "Repeats=" << CommonTestUtils::vec2str(tileParams) << "_";
result << "netPRC=" << netPrecision.name() << "_";
result << "targetDevice=" << targetDevice;
return result.str();
}
void TileLayerTest::SetUp() {
TileSpecificParams tileParams;
std::vector<size_t> inputShape;
auto netPrecision = InferenceEngine::Precision::UNSPECIFIED;
std::tie(tileParams, netPrecision, inputShape, targetDevice) = this->GetParam();
auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision);
auto params = ngraph::builder::makeParams(ngPrc, {inputShape});
auto paramOuts = ngraph::helpers::convert2OutputVector(
ngraph::helpers::castOps2Nodes<ngraph::op::Parameter>(params));
auto tile = ngraph::builder::makeTile(paramOuts[0], tileParams);
ngraph::ResultVector results{std::make_shared<ngraph::opset1::Result>(tile)};
function = std::make_shared<ngraph::Function>(results, params, "tile");
}
TEST_P(TileLayerTest, CompareWithRefs) {
Run();
}
} // namespace LayerTestsDefinitions