From 0a4509914acf418a867d65e4650e006098823a2a Mon Sep 17 00:00:00 2001 From: Alexander Peskov Date: Thu, 29 Oct 2020 01:34:18 +0300 Subject: [PATCH] [TEST] One more trivival loop test Signed-off-by: Alexander Peskov --- .../shared/src/single_layer_tests/loop.cpp | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/inference-engine/tests/functional/plugin/shared/src/single_layer_tests/loop.cpp b/inference-engine/tests/functional/plugin/shared/src/single_layer_tests/loop.cpp index 68db20c146c..d519cef4160 100644 --- a/inference-engine/tests/functional/plugin/shared/src/single_layer_tests/loop.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/single_layer_tests/loop.cpp @@ -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(prc, shape); + auto count = std::make_shared(ngraph::element::i64, scalarShape, 5); + auto icond = std::make_shared(ngraph::element::boolean, scalarShape, true); + + // Loop body + auto b_data = std::make_shared(prc, shape); + auto b_cond = std::make_shared(ngraph::element::boolean, scalarShape, true); + auto b_iter = std::make_shared(ngraph::element::i64, scalarShape); + + auto body = std::make_shared( + ngraph::OutputVector {b_cond, b_data}, + ngraph::ParameterVector {b_data, b_iter}); + + auto loop = std::make_shared(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::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