-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[opset5] ngraph implementation of Loop op (#2583)
* Loop op ngraph implementation, update IE IR Reader and ngraph to cnn converter * refactoring SubGraphOp class * type prop unit tests * ngraph code style * update comment * single layer tests for Loop operation * fix file name * Add SpecialBodyPorts attribute in Loop op, update single layer tests * add several new tests cases, strict checks in Loop impl, temporary disable single layer tests * ngraph codestyle, refactoring, clone_new_args test * resolve review remarks * fix build * fix tests * add a new constructor of Loop op, resolve review remarks
- Loading branch information
Showing
22 changed files
with
2,488 additions
and
728 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...nce-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/loop.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (C) 2019 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include <vector> | ||
#include <ngraph/op/util/attr_types.hpp> | ||
#include "single_layer_tests/loop.hpp" | ||
#include "common_test_utils/test_constants.hpp" | ||
|
||
using namespace LayerTestsDefinitions; | ||
|
||
namespace { | ||
// without clip values increase rapidly, so use only seq_lenghts = 2 | ||
std::vector<bool> execute_first_iteration{true}; | ||
std::vector<bool> is_body_condition_const{true, false}; | ||
std::vector<bool> body_condition{true, false}; // works only if is_body_condition_const == true | ||
std::vector<int64_t> trip_count{1, 10, -1}; // -1 means infinity | ||
std::vector<std::vector<std::pair<std::vector<size_t>, LOOP_IN_TYPE>>> inputs = { | ||
{{{32, 1, 10}, LOOP_IN_TYPE::INVARIANT}, {{32, 1, 10}, LOOP_IN_TYPE::INVARIANT}, {{32, 1, 10}, LOOP_IN_TYPE::MERGED}}, | ||
}; | ||
std::vector<InferenceEngine::Precision> netPrecisions = {InferenceEngine::Precision::FP32, | ||
InferenceEngine::Precision::FP16}; | ||
|
||
INSTANTIATE_TEST_CASE_P(smoke_LoopCommonZeroClip, LoopTest, | ||
::testing::Combine( | ||
::testing::ValuesIn(execute_first_iteration), | ||
::testing::ValuesIn(is_body_condition_const), | ||
::testing::ValuesIn(body_condition), | ||
::testing::ValuesIn(trip_count), | ||
::testing::ValuesIn(inputs), | ||
::testing::ValuesIn(netPrecisions), | ||
::testing::Values(CommonTestUtils::DEVICE_CPU)), | ||
LoopTest::getTestCaseName); | ||
} // namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
inference-engine/tests/functional/plugin/shared/include/single_layer_tests/loop.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (C) 2019 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include <tuple> | ||
#include <string> | ||
#include <vector> | ||
#include <memory> | ||
#include <ngraph/op/util/attr_types.hpp> | ||
#include "functional_test_utils/layer_test_utils.hpp" | ||
#include "ngraph_functions/builders.hpp" | ||
#include "ngraph_functions/utils/ngraph_helpers.hpp" | ||
|
||
namespace LayerTestsDefinitions { | ||
enum LOOP_IN_TYPE { | ||
INVARIANT, | ||
MERGED | ||
}; | ||
|
||
using LoopParams = typename std::tuple< | ||
bool, // ExecuteFirstIteration | ||
bool, // BodyCondition is a constant? | ||
bool, // BodyCondition value, if it is a Const | ||
int64_t, // TripCount, -1 means infinity | ||
std::vector<std::pair<std::vector<size_t>, LOOP_IN_TYPE>>, // inputs | ||
InferenceEngine::Precision, // Network precision | ||
std::string>; // Device name | ||
|
||
class LoopTest : public testing::WithParamInterface<LoopParams>, | ||
virtual public LayerTestsUtils::LayerTestsCommon { | ||
public: | ||
static std::string getTestCaseName(const testing::TestParamInfo<LoopParams> &obj); | ||
|
||
protected: | ||
void SetUp() override; | ||
}; | ||
|
||
} // namespace LayerTestsDefinitions |
Oops, something went wrong.