[IE TESTS] Split Layer Test refactoring (#2915)
Co-authored-by: kora6 <kora6@github.com>
This commit is contained in:
parent
8425cd492c
commit
5ffa2cd5e3
@ -21,6 +21,8 @@ INSTANTIATE_TEST_CASE_P(NumSplitsCheck, SplitLayerTest,
|
|||||||
::testing::Values(InferenceEngine::Layout::ANY),
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
::testing::Values(InferenceEngine::Layout::ANY),
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
::testing::Values(std::vector<size_t>({30, 30, 30, 30})),
|
::testing::Values(std::vector<size_t>({30, 30, 30, 30})),
|
||||||
|
::testing::Values(std::vector<size_t>({})),
|
||||||
::testing::Values("TEMPLATE")),
|
::testing::Values("TEMPLATE")),
|
||||||
SplitLayerTest::getTestCaseName);
|
SplitLayerTest::getTestCaseName);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -26,6 +26,21 @@ INSTANTIATE_TEST_CASE_P(smoke_NumSplitsCheck, SplitLayerTest,
|
|||||||
::testing::Values(InferenceEngine::Layout::ANY),
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
::testing::Values(InferenceEngine::Layout::ANY),
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
::testing::Values(std::vector<size_t>({30, 30, 30, 30})),
|
::testing::Values(std::vector<size_t>({30, 30, 30, 30})),
|
||||||
|
::testing::Values(std::vector<size_t>({})),
|
||||||
|
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||||
|
SplitLayerTest::getTestCaseName);
|
||||||
|
|
||||||
|
INSTANTIATE_TEST_CASE_P(smoke_splitWithUnusedOutputsTest, SplitLayerTest,
|
||||||
|
::testing::Combine(
|
||||||
|
::testing::Values(5),
|
||||||
|
::testing::Values(0),
|
||||||
|
::testing::ValuesIn(netPrecisions),
|
||||||
|
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||||
|
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||||
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
|
::testing::Values(std::vector<size_t>({30, 30, 30, 30})),
|
||||||
|
::testing::Values(std::vector<size_t>({0, 3})),
|
||||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||||
SplitLayerTest::getTestCaseName);
|
SplitLayerTest::getTestCaseName);
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -26,6 +26,7 @@ INSTANTIATE_TEST_CASE_P(DISABLED_smoke_NumSplitsCheck, SplitLayerTest,
|
|||||||
::testing::Values(InferenceEngine::Layout::ANY),
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
::testing::Values(InferenceEngine::Layout::ANY),
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
::testing::Values(std::vector<size_t >({30, 30})),
|
::testing::Values(std::vector<size_t >({30, 30})),
|
||||||
|
::testing::Values(std::vector<size_t>({})),
|
||||||
::testing::Values(CommonTestUtils::DEVICE_GNA)),
|
::testing::Values(CommonTestUtils::DEVICE_GNA)),
|
||||||
SplitLayerTest::getTestCaseName);
|
SplitLayerTest::getTestCaseName);
|
||||||
|
|
||||||
|
@ -27,7 +27,21 @@ INSTANTIATE_TEST_CASE_P(smoke_NumSplitsCheck, SplitLayerTest,
|
|||||||
::testing::Values(InferenceEngine::Layout::ANY),
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
::testing::Values(InferenceEngine::Layout::ANY),
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
::testing::Values(std::vector<size_t>({30, 30, 30, 30})),
|
::testing::Values(std::vector<size_t>({30, 30, 30, 30})),
|
||||||
|
::testing::Values(std::vector<size_t>({})),
|
||||||
::testing::Values(CommonTestUtils::DEVICE_GPU)),
|
::testing::Values(CommonTestUtils::DEVICE_GPU)),
|
||||||
SplitLayerTest::getTestCaseName);
|
SplitLayerTest::getTestCaseName);
|
||||||
|
|
||||||
|
INSTANTIATE_TEST_CASE_P(smoke_splitWithUnusedOutputsTest, SplitLayerTest,
|
||||||
|
::testing::Combine(
|
||||||
|
::testing::Values(5),
|
||||||
|
::testing::Values(0),
|
||||||
|
::testing::ValuesIn(netPrecisions),
|
||||||
|
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||||
|
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||||
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
|
::testing::Values(std::vector<size_t>({30, 30, 30, 30})),
|
||||||
|
::testing::Values(std::vector<size_t>({0, 3})),
|
||||||
|
::testing::Values(CommonTestUtils::DEVICE_GPU)),
|
||||||
|
SplitLayerTest::getTestCaseName);
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -16,7 +16,7 @@ const std::vector<InferenceEngine::Precision> netPrecisions = {
|
|||||||
|
|
||||||
INSTANTIATE_TEST_CASE_P(smoke_NumSplitsCheck, SplitLayerTest,
|
INSTANTIATE_TEST_CASE_P(smoke_NumSplitsCheck, SplitLayerTest,
|
||||||
::testing::Combine(
|
::testing::Combine(
|
||||||
::testing::Values(1),
|
::testing::Values(5),
|
||||||
// TODO: 0-axis excluded
|
// TODO: 0-axis excluded
|
||||||
// Check (status == ie::StatusCode::OK) failed: Failed to reshape Network:
|
// Check (status == ie::StatusCode::OK) failed: Failed to reshape Network:
|
||||||
// Failed to infer shapes for Split layer (Split_2) with error:
|
// Failed to infer shapes for Split layer (Split_2) with error:
|
||||||
@ -28,10 +28,11 @@ INSTANTIATE_TEST_CASE_P(smoke_NumSplitsCheck, SplitLayerTest,
|
|||||||
::testing::Values(InferenceEngine::Layout::ANY),
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
::testing::Values(InferenceEngine::Layout::ANY),
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
::testing::Values(std::vector<size_t>({30, 30, 30, 30})),
|
::testing::Values(std::vector<size_t>({30, 30, 30, 30})),
|
||||||
|
::testing::Values(std::vector<size_t>({})),
|
||||||
::testing::Values(CommonTestUtils::DEVICE_MYRIAD)),
|
::testing::Values(CommonTestUtils::DEVICE_MYRIAD)),
|
||||||
SplitLayerTest::getTestCaseName);
|
SplitLayerTest::getTestCaseName);
|
||||||
|
|
||||||
INSTANTIATE_TEST_CASE_P(smoke_splitWithUnusedOutputsTest, splitWithUnusedOutputsTest,
|
INSTANTIATE_TEST_CASE_P(smoke_splitWithUnusedOutputsTest, SplitLayerTest,
|
||||||
::testing::Combine(
|
::testing::Combine(
|
||||||
::testing::Values(5),
|
::testing::Values(5),
|
||||||
// TODO: 0-axis excluded
|
// TODO: 0-axis excluded
|
||||||
@ -49,5 +50,5 @@ INSTANTIATE_TEST_CASE_P(smoke_splitWithUnusedOutputsTest, splitWithUnusedOutputs
|
|||||||
std::vector<size_t>({0, 4}),
|
std::vector<size_t>({0, 4}),
|
||||||
std::vector<size_t>({2, 3})),
|
std::vector<size_t>({2, 3})),
|
||||||
::testing::Values(CommonTestUtils::DEVICE_MYRIAD)),
|
::testing::Values(CommonTestUtils::DEVICE_MYRIAD)),
|
||||||
splitWithUnusedOutputsTest::getTestCaseName);
|
SplitLayerTest::getTestCaseName);
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -23,6 +23,7 @@ typedef std::tuple<
|
|||||||
InferenceEngine::Layout, // Input layout
|
InferenceEngine::Layout, // Input layout
|
||||||
InferenceEngine::Layout, // Output layout
|
InferenceEngine::Layout, // Output layout
|
||||||
std::vector<size_t>, // Input shapes
|
std::vector<size_t>, // Input shapes
|
||||||
|
std::vector<size_t>, // Used outputs indices
|
||||||
std::string // Target device name
|
std::string // Target device name
|
||||||
> splitParams;
|
> splitParams;
|
||||||
|
|
||||||
@ -35,26 +36,4 @@ protected:
|
|||||||
void SetUp() override;
|
void SetUp() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::tuple<
|
|
||||||
size_t, // Num splits
|
|
||||||
size_t, // Axis
|
|
||||||
InferenceEngine::Precision, // Net precision
|
|
||||||
InferenceEngine::Precision, // Input precision
|
|
||||||
InferenceEngine::Precision, // Output precision
|
|
||||||
InferenceEngine::Layout, // Input layout
|
|
||||||
InferenceEngine::Layout, // Output layout
|
|
||||||
std::vector<size_t>, // Input shapes
|
|
||||||
std::vector<size_t>, // Used outputs indices
|
|
||||||
std::string // Target device name
|
|
||||||
> splitWithUnusedOutputsParams;
|
|
||||||
|
|
||||||
class splitWithUnusedOutputsTest : public testing::WithParamInterface<splitWithUnusedOutputsParams>,
|
|
||||||
virtual public LayerTestsUtils::LayerTestsCommon {
|
|
||||||
public:
|
|
||||||
static std::string getTestCaseName(testing::TestParamInfo<splitWithUnusedOutputsParams> obj);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void SetUp() override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace LayerTestsDefinitions
|
} // namespace LayerTestsDefinitions
|
||||||
|
@ -26,13 +26,16 @@ std::string SplitLayerTest::getTestCaseName(testing::TestParamInfo<splitParams>
|
|||||||
InferenceEngine::Precision netPrecision;
|
InferenceEngine::Precision netPrecision;
|
||||||
InferenceEngine::Precision inPrc, outPrc;
|
InferenceEngine::Precision inPrc, outPrc;
|
||||||
InferenceEngine::Layout inLayout, outLayout;
|
InferenceEngine::Layout inLayout, outLayout;
|
||||||
InferenceEngine::SizeVector inputShapes;
|
InferenceEngine::SizeVector inputShapes, outIndices;
|
||||||
std::string targetDevice;
|
std::string targetDevice;
|
||||||
std::tie(numSplits, axis, netPrecision, inPrc, outPrc, inLayout, outLayout, inputShapes, targetDevice) = obj.param;
|
std::tie(numSplits, axis, netPrecision, inPrc, outPrc, inLayout, outLayout, inputShapes, outIndices, targetDevice) = obj.param;
|
||||||
std::ostringstream result;
|
std::ostringstream result;
|
||||||
result << "IS=" << CommonTestUtils::vec2str(inputShapes) << "_";
|
result << "IS=" << CommonTestUtils::vec2str(inputShapes) << "_";
|
||||||
result << "numSplits=" << numSplits << "_";
|
result << "numSplits=" << numSplits << "_";
|
||||||
result << "axis=" << axis << "_";
|
result << "axis=" << axis << "_";
|
||||||
|
if (!outIndices.empty()) {
|
||||||
|
result << "outIndices" << CommonTestUtils::vec2str(outIndices) << "_";
|
||||||
|
}
|
||||||
result << "IS";
|
result << "IS";
|
||||||
result << "netPRC=" << netPrecision.name() << "_";
|
result << "netPRC=" << netPrecision.name() << "_";
|
||||||
result << "inPRC=" << inPrc.name() << "_";
|
result << "inPRC=" << inPrc.name() << "_";
|
||||||
@ -46,57 +49,14 @@ std::string SplitLayerTest::getTestCaseName(testing::TestParamInfo<splitParams>
|
|||||||
void SplitLayerTest::SetUp() {
|
void SplitLayerTest::SetUp() {
|
||||||
SetRefMode(LayerTestsUtils::RefMode::CONSTANT_FOLDING);
|
SetRefMode(LayerTestsUtils::RefMode::CONSTANT_FOLDING);
|
||||||
size_t axis, numSplits;
|
size_t axis, numSplits;
|
||||||
std::vector<size_t> inputShape;
|
std::vector<size_t> inputShape, outIndices;
|
||||||
InferenceEngine::Precision netPrecision;
|
InferenceEngine::Precision netPrecision;
|
||||||
std::tie(numSplits, axis, netPrecision, inPrc, outPrc, inLayout, outLayout, 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 split = std::dynamic_pointer_cast<ngraph::opset1::Split>(ngraph::builder::makeSplit(paramOuts[0],
|
|
||||||
ngPrc, numSplits, axis));
|
|
||||||
ngraph::ResultVector results;
|
|
||||||
for (int i = 0; i < numSplits; i++) {
|
|
||||||
results.push_back(std::make_shared<ngraph::opset1::Result>(split->output(i)));
|
|
||||||
}
|
|
||||||
function = std::make_shared<ngraph::Function>(results, params, "split");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_P(SplitLayerTest, CompareWithRefs) {
|
|
||||||
Run();
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string splitWithUnusedOutputsTest::getTestCaseName(testing::TestParamInfo<splitWithUnusedOutputsParams> obj) {
|
|
||||||
size_t numSplits, axis;
|
|
||||||
InferenceEngine::Precision netPrecision;
|
|
||||||
InferenceEngine::Precision inPrc, outPrc;
|
|
||||||
InferenceEngine::Layout inLayout, outLayout;
|
|
||||||
InferenceEngine::SizeVector inputShapes;
|
|
||||||
std::vector<size_t> outIndices;
|
|
||||||
std::string targetDevice;
|
|
||||||
std::tie(numSplits, axis, netPrecision, inPrc, outPrc, inLayout, outLayout, inputShapes, outIndices, targetDevice) = obj.param;
|
|
||||||
std::ostringstream result;
|
|
||||||
result << "IS=" << CommonTestUtils::vec2str(inputShapes) << "_";
|
|
||||||
result << "numSplits=" << numSplits << "_";
|
|
||||||
result << "axis=" << axis << "_";
|
|
||||||
result << "outIndices" << CommonTestUtils::vec2str(outIndices) << "_";
|
|
||||||
result << "IS";
|
|
||||||
result << "netPRC=" << netPrecision.name() << "_";
|
|
||||||
result << "inPRC=" << inPrc.name() << "_";
|
|
||||||
result << "outPRC=" << outPrc.name() << "_";
|
|
||||||
result << "inL=" << inLayout << "_";
|
|
||||||
result << "outL=" << outLayout << "_";
|
|
||||||
result << "trgDev=" << targetDevice;
|
|
||||||
return result.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
void splitWithUnusedOutputsTest::SetUp() {
|
|
||||||
SetRefMode(LayerTestsUtils::RefMode::CONSTANT_FOLDING);
|
|
||||||
size_t axis, numSplits;
|
|
||||||
std::vector<size_t> inputShape;
|
|
||||||
InferenceEngine::Precision netPrecision;
|
|
||||||
std::vector<size_t> outIndices;
|
|
||||||
std::tie(numSplits, axis, netPrecision, inPrc, outPrc, inLayout, outLayout, inputShape, outIndices, targetDevice) = this->GetParam();
|
std::tie(numSplits, axis, netPrecision, inPrc, outPrc, inLayout, outLayout, inputShape, outIndices, targetDevice) = this->GetParam();
|
||||||
|
if (outIndices.empty()) {
|
||||||
|
for (int i = 0; i < numSplits; ++i) {
|
||||||
|
outIndices.push_back(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision);
|
auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision);
|
||||||
auto params = ngraph::builder::makeParams(ngPrc, {inputShape});
|
auto params = ngraph::builder::makeParams(ngPrc, {inputShape});
|
||||||
auto paramOuts = ngraph::helpers::convert2OutputVector(
|
auto paramOuts = ngraph::helpers::convert2OutputVector(
|
||||||
@ -110,7 +70,7 @@ void splitWithUnusedOutputsTest::SetUp() {
|
|||||||
function = std::make_shared<ngraph::Function>(results, params, "split");
|
function = std::make_shared<ngraph::Function>(results, params, "split");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(splitWithUnusedOutputsTest, CompareWithRefs) {
|
TEST_P(SplitLayerTest, CompareWithRefs) {
|
||||||
Run();
|
Run();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user