[IE TESTS] Small refactoring of test infrastructure (#1332)
This commit is contained in:
parent
0887a7c0d6
commit
afee06ec3d
@ -11,7 +11,7 @@ using namespace LayerTestsDefinitions::ComparisonParams;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
std::map<std::vector<size_t>, std::vector<std::vector<size_t >>> inputShapes = {
|
std::map<std::vector<size_t>, std::vector<std::vector<size_t>>> inputShapes = {
|
||||||
{{1}, {{1}, {17}, {1, 1}, {2, 18}, {1, 1, 2}, {2, 2, 3}, {1, 1, 2, 3}}},
|
{{1}, {{1}, {17}, {1, 1}, {2, 18}, {1, 1, 2}, {2, 2, 3}, {1, 1, 2, 3}}},
|
||||||
{{5}, {{1}, {1, 1}, {2, 5}, {1, 1, 1}, {2, 2, 5}}},
|
{{5}, {{1}, {1, 1}, {2, 5}, {1, 1, 1}, {2, 2, 5}}},
|
||||||
{{2, 200}, {{1}, {200}, {1, 200}, {2, 200}, {2, 2, 200}}},
|
{{2, 200}, {{1}, {200}, {1, 200}, {2, 200}, {2, 2, 200}}},
|
||||||
@ -45,7 +45,7 @@ std::vector<InferenceEngine::Precision> netPrecisions = {
|
|||||||
std::map<std::string, std::string> additional_config = {};
|
std::map<std::string, std::string> additional_config = {};
|
||||||
|
|
||||||
const auto ComparisonTestParams = ::testing::Combine(
|
const auto ComparisonTestParams = ::testing::Combine(
|
||||||
::testing::ValuesIn(ComparisonLayerTest::combineShapes(inputShapes)),
|
::testing::ValuesIn(CommonTestUtils::combineShapes<size_t>(inputShapes)),
|
||||||
::testing::ValuesIn(inputsPrecisions),
|
::testing::ValuesIn(inputsPrecisions),
|
||||||
::testing::ValuesIn(comparisonOpTypes),
|
::testing::ValuesIn(comparisonOpTypes),
|
||||||
::testing::ValuesIn(secondInputTypes),
|
::testing::ValuesIn(secondInputTypes),
|
||||||
|
@ -31,7 +31,7 @@ const std::vector<ngraph::helpers::SqueezeOpType> opTypes = {
|
|||||||
|
|
||||||
INSTANTIATE_TEST_CASE_P(Basic, SqueezeUnsqueezeLayerTest,
|
INSTANTIATE_TEST_CASE_P(Basic, SqueezeUnsqueezeLayerTest,
|
||||||
::testing::Combine(
|
::testing::Combine(
|
||||||
::testing::ValuesIn(SqueezeUnsqueezeLayerTest::combineShapes(axesVectors)),
|
::testing::ValuesIn(CommonTestUtils::combineShapes<int>(axesVectors)),
|
||||||
::testing::ValuesIn(opTypes),
|
::testing::ValuesIn(opTypes),
|
||||||
::testing::ValuesIn(netPrecisions),
|
::testing::ValuesIn(netPrecisions),
|
||||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||||
|
@ -45,7 +45,7 @@ std::vector<InferenceEngine::Precision> netPrecisions = {
|
|||||||
std::map<std::string, std::string> additional_config = {};
|
std::map<std::string, std::string> additional_config = {};
|
||||||
|
|
||||||
const auto ComparisonTestParams = ::testing::Combine(
|
const auto ComparisonTestParams = ::testing::Combine(
|
||||||
::testing::ValuesIn(ComparisonLayerTest::combineShapes(inputShapes)),
|
::testing::ValuesIn(CommonTestUtils::combineShapes<size_t>(inputShapes)),
|
||||||
::testing::ValuesIn(inputsPrecisions),
|
::testing::ValuesIn(inputsPrecisions),
|
||||||
::testing::ValuesIn(comparisonOpTypes),
|
::testing::ValuesIn(comparisonOpTypes),
|
||||||
::testing::ValuesIn(secondInputTypes),
|
::testing::ValuesIn(secondInputTypes),
|
||||||
|
@ -35,6 +35,5 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static std::string getTestCaseName(testing::TestParamInfo<ComparisonTestParams> obj);
|
static std::string getTestCaseName(testing::TestParamInfo<ComparisonTestParams> obj);
|
||||||
static std::vector<ComparisonParams::InputShapesTuple> combineShapes(const std::map<std::vector<size_t>, std::vector<std::vector<size_t >>>& inputShapes);
|
|
||||||
};
|
};
|
||||||
} // namespace LayerTestsDefinitions
|
} // namespace LayerTestsDefinitions
|
||||||
|
@ -26,8 +26,6 @@ class SqueezeUnsqueezeLayerTest : public testing::WithParamInterface<squeezePara
|
|||||||
public LayerTestsUtils::LayerTestsCommon {
|
public LayerTestsUtils::LayerTestsCommon {
|
||||||
public:
|
public:
|
||||||
static std::string getTestCaseName(testing::TestParamInfo<squeezeParams> obj);
|
static std::string getTestCaseName(testing::TestParamInfo<squeezeParams> obj);
|
||||||
static std::vector<ShapeAxesTuple> combineShapes(const std::map<std::vector<size_t>, std::vector<std::vector<int>>>& inputShapes);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetUp() override;
|
void SetUp() override;
|
||||||
};
|
};
|
||||||
|
@ -37,17 +37,6 @@ std::string ComparisonLayerTest::getTestCaseName(testing::TestParamInfo<Comparis
|
|||||||
return results.str();
|
return results.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<InputShapesTuple> ComparisonLayerTest::combineShapes(const std::map<std::vector<size_t>, std::vector<std::vector<size_t >>>& inputShapes) {
|
|
||||||
std::vector<InputShapesTuple> resVec;
|
|
||||||
for (auto& inputShape : inputShapes) {
|
|
||||||
for (auto& item : inputShape.second) {
|
|
||||||
resVec.push_back({inputShape.first, item});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return resVec;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ComparisonLayerTest::SetUp() {
|
void ComparisonLayerTest::SetUp() {
|
||||||
InputShapesTuple inputShapes;
|
InputShapesTuple inputShapes;
|
||||||
InferenceEngine::Precision inputsPrecision;
|
InferenceEngine::Precision inputsPrecision;
|
||||||
|
@ -54,10 +54,6 @@ void RangeLayerTest::SetUp() {
|
|||||||
std::tie(start, stop, step, netPrecision, targetDevice) = GetParam();
|
std::tie(start, stop, step, netPrecision, targetDevice) = GetParam();
|
||||||
auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision);
|
auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision);
|
||||||
|
|
||||||
auto start_constant = std::make_shared<ngraph::opset1::Constant>(ngPrc, ngraph::Shape{}, start);
|
|
||||||
auto stop_constant = std::make_shared<ngraph::opset1::Constant>(ngPrc, ngraph::Shape{}, stop);
|
|
||||||
auto step_constant = std::make_shared<ngraph::opset1::Constant>(ngPrc, ngraph::Shape{}, step);
|
|
||||||
|
|
||||||
auto params = ngraph::builder::makeParams(ngPrc, {std::vector<size_t>(), std::vector<size_t>(), std::vector<size_t>()});
|
auto params = ngraph::builder::makeParams(ngPrc, {std::vector<size_t>(), std::vector<size_t>(), std::vector<size_t>()});
|
||||||
params[0]->set_friendly_name("start");
|
params[0]->set_friendly_name("start");
|
||||||
params[1]->set_friendly_name("stop");
|
params[1]->set_friendly_name("stop");
|
||||||
|
@ -34,16 +34,6 @@ std::string SqueezeUnsqueezeLayerTest::getTestCaseName(testing::TestParamInfo<sq
|
|||||||
return result.str();
|
return result.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ShapeAxesTuple> SqueezeUnsqueezeLayerTest::combineShapes(const std::map<std::vector<size_t>, std::vector<std::vector<int>>>& inputShapes) {
|
|
||||||
std::vector<ShapeAxesTuple> resVec;
|
|
||||||
for (auto& inputShape : inputShapes) {
|
|
||||||
for (auto& item : inputShape.second) {
|
|
||||||
resVec.push_back({inputShape.first, item});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return resVec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SqueezeUnsqueezeLayerTest::SetUp() {
|
void SqueezeUnsqueezeLayerTest::SetUp() {
|
||||||
InferenceEngine::Precision netPrecision;
|
InferenceEngine::Precision netPrecision;
|
||||||
std::vector<size_t> inputShapes;
|
std::vector<size_t> inputShapes;
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#include <details/ie_cnn_network_iterator.hpp>
|
#include <details/ie_cnn_network_iterator.hpp>
|
||||||
|
|
||||||
namespace CommonTestUtils {
|
namespace CommonTestUtils {
|
||||||
|
|
||||||
template<typename vecElementType>
|
template<typename vecElementType>
|
||||||
inline std::string vec2str(const std::vector<vecElementType> &vec) {
|
inline std::string vec2str(const std::vector<vecElementType> &vec) {
|
||||||
if (!vec.empty()) {
|
if (!vec.empty()) {
|
||||||
@ -58,4 +57,16 @@ inline InferenceEngine::CNNLayerPtr getLayerByName(const InferenceEngine::CNNNet
|
|||||||
return getLayerByName(&icnnnetwork, layerName);
|
return getLayerByName(&icnnnetwork, layerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename elementTypeVector>
|
||||||
|
std::vector<std::pair<std::vector<size_t>, std::vector<elementTypeVector>>>
|
||||||
|
combineShapes(const std::map<std::vector<size_t>, std::vector<std::vector<elementTypeVector>>>& inputShapes) {
|
||||||
|
std::vector<std::pair<std::vector<size_t>, std::vector<elementTypeVector>>> resVec;
|
||||||
|
for (auto& inputShape : inputShapes) {
|
||||||
|
for (auto& item : inputShape.second) {
|
||||||
|
resVec.push_back({inputShape.first, item});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return resVec;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace CommonTestUtils
|
} // namespace CommonTestUtils
|
||||||
|
Loading…
Reference in New Issue
Block a user