From d4c5cb2375a8ef08ee4a9b4590c7bd0b1c4141f4 Mon Sep 17 00:00:00 2001 From: Ivan Tikhonov Date: Tue, 2 Mar 2021 18:10:41 +0300 Subject: [PATCH] Removing unnecessary order checking in Loop/TI operations (#4531) * deleting a check of order of the input/output descs in ti/loop operations * added ngraph_reader unit test * unrolling for Loop operation, fix LowLatency transformation for Loop * Revert "unrolling for Loop operation, fix LowLatency transformation for Loop" This reverts commit 7188921ad7b77c9ba8b5d2d5932389d31246d59f. --- .../inference_engine/ngraph_reader/loop.cpp | 204 ++++++++++++++++++ ngraph/core/src/op/loop.cpp | 6 - ngraph/core/src/op/tensor_iterator.cpp | 6 - 3 files changed, 204 insertions(+), 12 deletions(-) diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/loop.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/loop.cpp index 07395cf60ea..062881962ca 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/loop.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/loop.cpp @@ -381,3 +381,207 @@ TEST_F(NGraphReaderTests, ReadLoopNetwork_2) { weights->buffer().as()[1] = 0; EXPECT_NO_THROW(reader.ReadNetwork(model, weights)); } + +TEST_F(NGraphReaderTests, ReadLoopNetwork_ExternalPort1IsNotConnected) { + std::string model = R"V0G0N( + + + + + + + + 1 + + + + + + + + + + + + + + 1 + 2 + + + + + + + 1 + + + + 1 + 2 + + + + + 1 + 2 + + + 3 + 1 + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + + + + + + + + 1 + 2 + + + + + + + 1 + 2 + + + 1 + 2 + + + + + 1 + 2 + + + + + + + 1 + 2 + + + + + + + + 1 + + + + + + + 1 + 2 + + + 1 + + + + + 3 + 1 + 2 + + + + + + + 3 + 1 + 2 + + + + + + + + + + + + + + + + + + + 1 + 2 + + + + + + + 3 + 1 + 2 + + + + + + + + + + + + + +)V0G0N"; + + Core reader; + Blob::Ptr weights; + weights = make_shared_blob(TensorDesc(Precision::U8, {8}, Layout::C)); + weights->allocate(); + weights->buffer().as()[0] = 0; + weights->buffer().as()[1] = 0; + EXPECT_NO_THROW(reader.ReadNetwork(model, weights)); +} + diff --git a/ngraph/core/src/op/loop.cpp b/ngraph/core/src/op/loop.cpp index eab26e5eb90..d552abc9141 100644 --- a/ngraph/core/src/op/loop.cpp +++ b/ngraph/core/src/op/loop.cpp @@ -185,12 +185,9 @@ void op::v5::Loop::validate_and_infer_types() "Number of inputs must be the same as number of input descriptions"); // Input - uint64_t index_it = input_offset; for (const auto& input_description : m_input_descriptions) { auto index = input_description->m_input_index; - NODE_VALIDATION_CHECK(this, index == index_it, "Input_index not in order"); - index_it++; if (auto slice_input_description = as_type_ptr(input_description)) { @@ -242,12 +239,9 @@ void op::v5::Loop::validate_and_infer_types() m_body->validate_nodes_and_infer_types(); // Output - index_it = 0; for (const auto& output_description : m_output_descriptions) { auto index = output_description->m_output_index; - NODE_VALIDATION_CHECK(this, index == index_it, "Output_index not in order"); - index_it++; auto body_value = m_body->get_results().at(output_description->m_body_value_index)->input_value(0); diff --git a/ngraph/core/src/op/tensor_iterator.cpp b/ngraph/core/src/op/tensor_iterator.cpp index 2b151fdb62e..158cd2cb90d 100644 --- a/ngraph/core/src/op/tensor_iterator.cpp +++ b/ngraph/core/src/op/tensor_iterator.cpp @@ -102,12 +102,9 @@ void op::v0::TensorIterator::validate_and_infer_types() }; // Input - uint64_t index_it = 0; for (const auto& input_description : m_input_descriptions) { auto index = input_description->m_input_index; - NODE_VALIDATION_CHECK(this, index == index_it, "Input_index not in order"); - index_it++; if (auto slice_input_description = as_type_ptr(input_description)) { @@ -170,12 +167,9 @@ void op::v0::TensorIterator::validate_and_infer_types() // Output try_to_set_num_iterations_if_no_slice_inputs(); - index_it = 0; for (const auto& output_description : m_output_descriptions) { auto index = output_description->m_output_index; - NODE_VALIDATION_CHECK(this, index == index_it, "Output_index not in order"); - index_it++; auto body_value = m_body->get_results().at(output_description->m_body_value_index)->input_value(0);