[TEST] One more trivival loop test

Signed-off-by: Alexander Peskov <alexander.peskov@intel.com>
This commit is contained in:
Alexander Peskov 2020-10-29 01:34:18 +03:00
parent 045d26ff31
commit 0a4509914a

View File

@ -293,7 +293,7 @@ namespace LayerTestsDefinitions {
Run();
}
TEST_P(TrivialLoopTest, CheckLoad) {
TEST_P(TrivialLoopTest, PassThroughBody) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
InferenceEngine::Precision iePrc;
InferenceEngine::SizeVector ieShape;
@ -337,4 +337,47 @@ namespace LayerTestsDefinitions {
Run();
}
TEST_P(TrivialLoopTest, UnusedInputBody) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
InferenceEngine::Precision iePrc;
InferenceEngine::SizeVector ieShape;
std::tie(iePrc, ieShape, targetDevice) = GetParam();
const auto prc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(iePrc);
const auto shape = ngraph::Shape{ieShape};
const auto scalarShape = ngraph::Shape{};
auto start = std::make_shared<ngraph::op::Parameter>(prc, shape);
auto count = std::make_shared<ngraph::op::Constant>(ngraph::element::i64, scalarShape, 5);
auto icond = std::make_shared<ngraph::op::Constant>(ngraph::element::boolean, scalarShape, true);
// Loop body
auto b_data = std::make_shared<ngraph::op::Parameter>(prc, shape);
auto b_cond = std::make_shared<ngraph::op::Constant>(ngraph::element::boolean, scalarShape, true);
auto b_iter = std::make_shared<ngraph::op::Parameter>(ngraph::element::i64, scalarShape);
auto body = std::make_shared<ngraph::Function>(
ngraph::OutputVector {b_cond, b_data},
ngraph::ParameterVector {b_data, b_iter});
auto loop = std::make_shared<ngraph::opset5::Loop>(count, icond);
loop->set_function(body);
loop->set_special_body_ports({1, 0});
loop->set_invariant_input(b_data, start);
loop->get_iter_value(b_data, -1);
function = std::make_shared<ngraph::Function>(
ngraph::OutputVector {loop},
ngraph::ParameterVector {start});
// Precalculated ref blobs
auto blob = make_blob_with_precision({iePrc, ieShape, InferenceEngine::TensorDesc::getLayoutByDims(ieShape)});
blob->allocate();
CommonTestUtils::fill_data_with_broadcast(blob, 0, {10});
inputGens[""] = [&] (InferenceEngine::TensorDesc tdesc) { return blob; };
outputGens[""] = [&] (InferenceEngine::TensorDesc tdesc) { return blob; };
Run();
}
} // namespace LayerTestsDefinitions