Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update forked branch #4

Merged
merged 99 commits into from
Feb 5, 2021
Merged
Changes from 1 commit
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
5f982ca
Removed obsolete ie_profiling.hpp (#4043)
ilya-lavrenov Jan 28, 2021
08c4ac5
Refactor install_openvino_dependencies script: extra options and clea…
mshabunin Jan 28, 2021
b0f5a33
Proposal test uses special run() method to check exception throwing (…
yury-intel Jan 28, 2021
2ebae7c
Introduce the Broker API to map original framework names to OV (#3800)
ilyachur Jan 29, 2021
a67a720
-no-unused-XXX options added for selective build mode (#3702)
vladislav-volkov Jan 29, 2021
a8b9217
[CPU] Disabled input zero point fusing into fp32 Convolution (#4056)
dmitry-gorokhov Jan 29, 2021
6b54e73
Update operation attributes (#3814)
Jan 29, 2021
450f012
[compare_function] compare ops attributes (#3966)
pelszkow Jan 29, 2021
4b64c64
Suppressing warning about unused variables for selective build of MKL…
vladislav-volkov Jan 29, 2021
7500bbd
[CPU] ROIPooling with 1x1 pooled shape in bilinear mode fixed (#4020)
yury-intel Jan 29, 2021
3669205
Added support for the MxNet op take (#4071)
lazarevevgeny Jan 29, 2021
8abbfbc
Design test config and integrate in CC tests (#4051)
vurusovs Jan 29, 2021
abaf155
Prevent targets installation for 3rd party libs (mkl-dnn) (#4096)
slyubimt Jan 31, 2021
8cb25fd
[Python API] Support of FP16 blobs (#3893)
akuporos Feb 1, 2021
a6a5635
added log extractor for tf (#4090)
likholat Feb 1, 2021
1a787cb
Re-implement caffe old-style extractors with extractor extensions (#3…
evolosen Feb 1, 2021
80781ff
Add MVN-6 op to ONNX importer (#4012)
Feb 1, 2021
4aa6f6a
docs copy code button (#4017)
ntyukaev Feb 1, 2021
79fa676
[IE][VPU]: Fixes Extract Dynamic Batch (#3978)
ggladilo Feb 1, 2021
4570550
[CPU] Interpolate node: 5d support for onnx_linear mode (#3471)
chenhu-wang Feb 1, 2021
2457225
Azure CI: Disable nGraph Mac tests IE_CPU/GRUSequenceOp.onnx_model_gru*
Feb 1, 2021
a6ea479
[DOC] ShapeInference.md update. slyalin comments (#3355) (#4104)
Feb 1, 2021
0ecc360
fix comments ngraph api - master (#3519)
ntyukaev Feb 2, 2021
3a86b3a
Update ONNX dependency to v 1.8.1 (#4114)
postrational Feb 2, 2021
cca0d56
WrapType Improvements (#4040)
Feb 2, 2021
537179b
[CPU] FakeQuantize decomposition (#3741)
Feb 2, 2021
d754e9b
[CPU] CumSum tensors with rank >= 6 support. (#3859)
apertovs Feb 2, 2021
c1b0b03
Convolution (#3922)
jdanieck Feb 2, 2021
ecb6d86
Add Add->Clamp->Div->Mul to HSwish fusion (#4027)
mateusztabaka Feb 2, 2021
235cd56
Feature/azaytsev/cherry picks from 2021 2 (#4069)
andrew-zaytsev Feb 2, 2021
c56f3cd
[CPU] Fix NormalizeL2 + Multiply (#4047)
Feb 2, 2021
4e601eb
Move Extension tests from ieFuncTests to cpuFuncTests (#3927)
mateusztabaka Feb 2, 2021
b97a986
Remove ops from Layer Creator/ Node Converter - part 9 (#4019)
Feb 2, 2021
f1ffe4f
nGraph value propagation (#3368)
Feb 2, 2021
6390d32
Fix write output blob for Windows (#4126)
mikhailk62 Feb 2, 2021
1f70761
[IE][nGraph][VPU]: Enables DTS for Loop (#3838)
ggladilo Feb 2, 2021
9c1651b
Fix SELECTIVE_BUILD=COLLECT build under sh (#4108)
Feb 2, 2021
38fab02
[IE CLDNN] Fixed scatter update op & reshape kernel (#4106)
yeonbok Feb 2, 2021
cc000e5
Enable GatherElements tests on IE_CPU (#4044)
t-jankowski Feb 2, 2021
f039821
[CPU] Split layer nspc -> ncsp special case put back. (#3839)
maxnick Feb 2, 2021
fe4c48e
Compare function: change API to a class (#4077)
pelszkow Feb 2, 2021
5ab628d
Fix TF2 Keras RNN support (#4116)
rkazants Feb 2, 2021
ac7c847
[IE CLDNN] Fix most of clDNN LSTM unit tests (#3810)
Feb 2, 2021
6a0bc80
Fixed CNNNetwork iterator for some corner cases with Memory (#4084)
ilyachur Feb 2, 2021
0b3ff5e
Add MO support for MVN-6 (#3772)
mvafin Feb 2, 2021
5c08312
[Docs] Add a note about --hparams for EfficientDet (#4079)
dkurt Feb 2, 2021
75763b8
Extend GELU merger patterns (#4130)
mvafin Feb 2, 2021
804010b
Azure CI: Disable 3 failed IE UT old
Feb 2, 2021
685bf83
Fixed cldnn compilation with static runtime (#4070)
ilya-lavrenov Feb 2, 2021
da4c50f
Fuse x * HSigmoid(x) to HSwish(x) (#4121)
mateusztabaka Feb 2, 2021
9ad6513
[Hetero] Update layout in inputs info (#4131)
maxim-kurin Feb 2, 2021
359c2ca
Upgrade pyyaml to the latest (#4134)
Feb 3, 2021
461a71b
ngraph Constant operator - add `const` for c-tor input parameters (#4…
pelszkow Feb 3, 2021
d681582
[LPT] MatMul: 3D quantization support (#3391)
v-Golubev Feb 3, 2021
4d9a030
[CPU] Enable CTCGreedyDecoderSeqLen. (#3890)
nshchego Feb 3, 2021
b6c289e
Add sea to OpenVINO (#4042)
ilyachur Feb 3, 2021
6cf8a9f
Network reading failure in IE for operations ExperimentalDetectronPri…
vgavrilo Feb 3, 2021
9ff8e26
Dynamic Batch Test (#3936)
kmagiers Feb 3, 2021
a54d978
[IE CLDNN] FP16 fused eltwise fix (#4028)
vladimir-paramuzov Feb 3, 2021
be772c5
Fixed "Reverse input channels" case for common Plugin API (#4142)
ilya-lavrenov Feb 3, 2021
e71aae9
Fixed CVS-47120 (#3919)
ilya-lavrenov Feb 3, 2021
1b8930c
Remove redundant attributes in back_edges for TI and Loop layers (#4133)
Feb 3, 2021
1419e05
Add python api for CTCGreedyDecoder (#3947)
iimironov Feb 3, 2021
3ad1360
Compare function - compare attributes - unit test (#4092)
pelszkow Feb 3, 2021
8b800cc
add cl_compiler, dl_streamer and opencv deps to install dependencies …
generalova-kate Feb 3, 2021
4b1efeb
Group convolution (#3995)
jdanieck Feb 3, 2021
8d7c9de
[CPU] Enable MVN-6 operation. (#3400)
nshchego Feb 3, 2021
f57f1fa
[LPT] Q/DQ support integration (#3575)
eshoguli Feb 3, 2021
75ed358
Properly enabled ia32 build (#4145)
ilya-lavrenov Feb 3, 2021
64312bc
[IE][VPU]: Fix SEGFAULT when calling GetExecGraphInfo() from imported…
Feb 3, 2021
0a63b92
Used std::string as API paramters (#4050)
apankratovantonp Feb 3, 2021
da9d42f
setupvars.bat: Removed "setlocal enableDelayedExpansion", updated che…
artanokhov Feb 3, 2021
748780e
Supports tensor names with delimiter (#4085)
ilyachur Feb 4, 2021
22543c4
Fixed cc compilation (#4161)
ilyachur Feb 4, 2021
ff4227c
Add missing header for std::tolower (#4156)
dev0x13 Feb 4, 2021
4563101
[ONNX Importer] Onnx importer support for brocker names (#4087)
tsocha Feb 4, 2021
dc1b605
Ngraph: add methods for removing parameters from Function (#3854)
sadolini Feb 4, 2021
18a65b5
Serialization dynamic layer bug (#3982)
bszmelcz Feb 4, 2021
69e3ca5
Re-used XML utils (#4170)
ilya-lavrenov Feb 4, 2021
db84033
[CPU] Introduced Load/Store emitters (#3567)
chenhu-wang Feb 4, 2021
9b5b2bb
Add collector path for cond. comp. tests (#4159)
Feb 4, 2021
47b1244
[IE][VPU]: Enables WA for Loop creation (#4153)
ggladilo Feb 4, 2021
956c6dd
Extracted toolchain to build with static runtime from OneCore toolcha…
ilya-lavrenov Feb 4, 2021
939ddea
Moved ittapi to thirdparty (#4164)
ilyachur Feb 4, 2021
04760cb
[IE CLDNN] Added ScatterElementsUpdate op support (#4105)
isanghao Feb 4, 2021
54c889f
Implemented base cancelation implementation (#3805)
apankratovantonp Feb 4, 2021
2d979ac
Added BIN precision convertion to ngraph's u1. (#4160)
jdanieck Feb 4, 2021
367cacd
CVS-43973: added HWC layout (#4147)
ilya-lavrenov Feb 4, 2021
e80e5e7
Add python API for MVN-6 (#3816)
mvafin Feb 4, 2021
945da5f
Removed template from base (#4045)
apankratovantonp Feb 4, 2021
937c332
[ONNX][Tests][Python][Models] Increase tolerance for some models (#4150)
tsocha Feb 4, 2021
1bd7b37
[CPU] BF16 Deconvolution support (#4048)
alexey-varyzgin Feb 4, 2021
bf05b4d
[CPU] Disabled inplace for const input in Scatter node (#4148)
yury-intel Feb 4, 2021
6083c7f
Fix for switches conditional compilation (#4168)
vladislav-volkov Feb 5, 2021
47127fb
opset1::OneHot Fix shape infer function for dynamic input shape case …
Feb 5, 2021
e47186a
Modifications for Object Detection SSD Python sample (#3976)
Feb 5, 2021
abf37e1
Fix performance regression due to copying of opset (#4184)
mvafin Feb 5, 2021
90347c2
[IE][VPU]: Enables Loop Support (#4157)
ggladilo Feb 5, 2021
65e2b4a
[ONNX Importer] Switch to opset6 (#4112)
tsocha Feb 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Ngraph: add methods for removing parameters from Function (openvinoto…
…olkit#3854)

* added methods for parameters

* added tests

* remove parameter from low latency

* Revert "remove parameter from low latency"

This reverts commit 86a91dd.

* comment added

* fix style

* review fix

* extended comments

* style fixes

* review fixes

* test fix

* added full pipeline test
sadolini authored Feb 4, 2021

Unverified

This user has not yet uploaded their public signing key.
commit dc1b605b7ff080adc36d6d8d814e97eff2a2b63f
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (C) 2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#include "execution_graph_tests/remove_parameter.hpp"
#include "common_test_utils/test_constants.hpp"

using namespace ExecutionGraphTests;

namespace {

INSTANTIATE_TEST_CASE_P(smoke_removeParameter, ExecGraphRemoveParameterNode,
::testing::Values(CommonTestUtils::DEVICE_CPU),
ExecGraphRemoveParameterNode::getTestCaseName);

} // namespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (C) 2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#include "gtest/gtest.h"

namespace ExecutionGraphTests {

class ExecGraphRemoveParameterNode
: public testing::TestWithParam<std::string> {
public:
static std::string getTestCaseName(testing::TestParamInfo<std::string> obj);
};

} // namespace ExecutionGraphTests
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// Copyright (C) 2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#include "execution_graph_tests/remove_parameter.hpp"
#include "functional_test_utils/skip_tests_config.hpp"

#include <inference_engine.hpp>
#include <ngraph/ngraph.hpp>

namespace ExecutionGraphTests {

std::string ExecGraphRemoveParameterNode::getTestCaseName(
testing::TestParamInfo<std::string> obj) {
std::string targetDevice = obj.param;
return "Dev=" + targetDevice;
}

/**
* Replacing parameter by another node change indexing for other parameters,
* check that we still can correctly process changed network.
*/
TEST_P(ExecGraphRemoveParameterNode, RemoveParameterNode) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()

auto device_name = this->GetParam();
ngraph::Shape shape = {3, 2};
float in_data_2[6] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
float in_data[6] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0};
ngraph::element::Type type = ngraph::element::f32;

using std::make_shared;
using namespace ngraph::op;

// Some simple graph with 2 Parameters
// in2 in1 //
// \ / | //
// mul | //
// \ | //
// sum //
// | //
// out //
auto input = make_shared<Parameter>(type, shape);
auto input2 = make_shared<Parameter>(type, shape);
auto mul = make_shared<ngraph::op::v1::Multiply>(input2, input);
auto sum = make_shared<ngraph::op::v1::Add>(mul, input);

auto function = std::make_shared<ngraph::Function>(
ngraph::NodeVector{sum}, ngraph::ParameterVector{input2, input},
"SimpleNet");

// Load into plugin and get exec graph
auto ie = InferenceEngine::Core();
auto net = InferenceEngine::CNNNetwork(function);
auto exec_net = ie.LoadNetwork(net, device_name);
auto exec_graph = exec_net.GetExecGraphInfo();
auto infer_req = exec_net.CreateInferRequest();
InferenceEngine::TensorDesc tDesc(InferenceEngine::Precision::FP32, shape,
InferenceEngine::Layout::NC);
InferenceEngine::Blob::Ptr inBlob2 =
InferenceEngine::make_shared_blob<float>(tDesc, in_data_2);
infer_req.SetBlob(input2->get_name(), inBlob2);

InferenceEngine::Blob::Ptr inBlob =
InferenceEngine::make_shared_blob<float>(tDesc, in_data);
infer_req.SetBlob(input->get_name(), inBlob);

infer_req.Infer();

auto outBlob = infer_req.GetBlob(sum->get_name());
InferenceEngine::MemoryBlob::CPtr output =
InferenceEngine::as<InferenceEngine::MemoryBlob>(outBlob);
auto outputHolder = output->rmap();
const auto ref_result = outputHolder.as<float *>();

ASSERT_EQ(function->get_parameter_index(input2), 0);
ASSERT_EQ(function->get_parameter_index(input), 1);

// Replace input2 by constant
auto const_in =
make_shared<Constant>(type, shape, std::vector<float>(6, 1.0));
mul->input(0).replace_source_output(const_in->output(0));
function->remove_parameter(input2);

ASSERT_EQ(function->get_parameters().size(), 1);
ASSERT_EQ(function->get_parameter_index(input), 0);

// Load new function into plugin and get exec graph
auto new_net = InferenceEngine::CNNNetwork(function);
auto new_exec_net = ie.LoadNetwork(new_net, device_name);
auto new_exec_graph = new_exec_net.GetExecGraphInfo();

// infer new graph
auto new_infer_req = new_exec_net.CreateInferRequest();
new_infer_req.SetBlob(input->get_name(), inBlob);

new_infer_req.Infer();

auto new_outBlob = new_infer_req.GetBlob(sum->get_name());
InferenceEngine::MemoryBlob::CPtr new_output =
InferenceEngine::as<InferenceEngine::MemoryBlob>(new_outBlob);
auto new_outputHolder = new_output->rmap();
const auto result = new_outputHolder.as<float *>();

for (int i = 0; i < 6; i++) {
ASSERT_NEAR(result[i], ref_result[i], 1e-5);
}
}

} // namespace ExecutionGraphTests
29 changes: 28 additions & 1 deletion ngraph/core/include/ngraph/function.hpp
Original file line number Diff line number Diff line change
@@ -170,6 +170,33 @@ namespace ngraph
/// \param result Result node to delete
void remove_result(const std::shared_ptr<op::Result>& result);

/// \brief Add new Parameter nodes to the list.
///
/// Method doesn't change or validate graph, it should be done manually.
/// For example, if you want to replace `ReadValue` node by `Parameter`, you should do the
/// following steps:
/// * replace node `ReadValue` by `Parameter` in graph
/// * call add_parameter() to add new input to the list
/// * call graph validation to check correctness of changes
///
/// \param params new Parameter nodes
void add_parameters(const ParameterVector& params);

/// \brief Delete Parameter node from the list of parameters. Method will not delete node
/// from graph. You need to replace Parameter with other operation manually.
/// Attention: Indexing of parameters can be changed.
///
/// Possible use of method is to replace input by variable. For it the following steps
/// should be done:
/// * `Parameter` node should be replaced by `ReadValue`
/// * call remove_parameter(param) to remove input from the list
/// * check if any parameter indexes are saved/used somewhere, update it for all inputs
/// because indexes can be changed
/// * call graph validation to check all changes
///
/// \param param Parameter node to delete
void remove_parameter(const std::shared_ptr<op::Parameter>& param);

private:
Function(const Function&) = delete;
Function(const Function&&) = delete;
@@ -205,4 +232,4 @@ namespace ngraph
0};
const DiscreteTypeInfo& get_type_info() const override { return type_info; }
};
}
} // namespace ngraph
25 changes: 25 additions & 0 deletions ngraph/core/src/function.cpp
Original file line number Diff line number Diff line change
@@ -417,4 +417,29 @@ void Function::remove_result(const std::shared_ptr<op::Result>& result)
m_results.end());
}

void Function::add_parameters(const ParameterVector& params)
{
for (int i = 0; i < params.size(); i++)
{
for (int j = 0; j < m_parameters.size(); j++)
{
NGRAPH_CHECK(params[i] != m_parameters[j],
"add_parameters(): Tried to add parameter (index in array ",
i,
") but function already have the same parameter with index ",
j);
}
}
m_parameters.insert(m_parameters.end(), params.begin(), params.end());
}

void Function::remove_parameter(const std::shared_ptr<op::Parameter>& param)
{
m_parameters.erase(
std::remove_if(m_parameters.begin(),
m_parameters.end(),
[&param](std::shared_ptr<op::v0::Parameter>& r) { return r == param; }),
m_parameters.end());
}

constexpr DiscreteTypeInfo AttributeAdapter<shared_ptr<Function>>::type_info;
88 changes: 88 additions & 0 deletions ngraph/test/build_graph.cpp
Original file line number Diff line number Diff line change
@@ -364,3 +364,91 @@ TEST(build_graph, build_graph_with_remove_result)
nodes = f->get_ops();
EXPECT_EQ(nodes.size(), 5);
}

TEST(build_graph, build_graph_with_add_parameter)
{
auto arg = make_shared<op::Parameter>(element::f32, Shape{2, 4});
auto arg2 = make_shared<op::Parameter>(element::f32, Shape{2, 2});
auto init_const = op::Constant::create(element::f32, Shape{2, 2}, {0, 0, 0, 0});
auto read = make_shared<op::ReadValue>(init_const, "v0");
std::vector<shared_ptr<Node>> args = {arg, read};
auto pattern = make_shared<op::Concat>(args, 1);
auto res = make_shared<op::Result>(pattern);
const auto axis = op::Constant::create(element::i64, Shape{}, {1});
auto crop = make_shared<op::v1::Split>(pattern, axis, 3);
auto res2 = make_shared<op::Result>(crop, "v0");

auto f = make_shared<Function>(ResultVector({res, res2}), ParameterVector{arg});

NodeVector nodes = f->get_ops();
EXPECT_EQ(nodes.size(), 8);
ParameterVector params = f->get_parameters();
EXPECT_EQ(params.size(), 1);

pattern->input(1).replace_source_output(arg2->output(0));

f->add_parameters(ParameterVector({arg2}));
params = f->get_parameters();
EXPECT_EQ(params.size(), 2);
EXPECT_EQ(params[1], arg2);
nodes = f->get_ops();
EXPECT_EQ(nodes.size(), 7);
}

TEST(build_graph, build_graph_with_remove_parameter)
{
auto arg = make_shared<op::Parameter>(element::f32, Shape{2, 4});
auto arg2 = make_shared<op::Parameter>(element::f32, Shape{2, 2});
auto init_const = op::Constant::create(element::f32, Shape{2, 2}, {0, 0, 0, 0});
auto read = make_shared<op::ReadValue>(init_const, "v0");
std::vector<shared_ptr<Node>> args = {arg, arg2};
auto pattern = make_shared<op::Concat>(args, 1);
auto res = make_shared<op::Result>(pattern);
const auto axis = op::Constant::create(element::i64, Shape{}, {1});
auto crop = make_shared<op::v1::Split>(pattern, axis, 3);
auto res2 = make_shared<op::Result>(crop, "v0");

auto f = make_shared<Function>(ResultVector({res, res2}), ParameterVector{arg, arg2});

NodeVector nodes = f->get_ops();
EXPECT_EQ(nodes.size(), 7);
ParameterVector params = f->get_parameters();
EXPECT_EQ(params.size(), 2);

pattern->input(1).replace_source_output(read->output(0));
f->remove_parameter(arg2);
params = f->get_parameters();
EXPECT_EQ(params.size(), 1);
nodes = f->get_ops();
EXPECT_EQ(nodes.size(), 8);
}

TEST(build_graph, build_graph_with_remove_parameter_indexing)
{
auto arg = make_shared<op::Parameter>(element::f32, Shape{2, 4});
auto arg2 = make_shared<op::Parameter>(element::f32, Shape{2, 2});
auto init_const = op::Constant::create(element::f32, Shape{2, 2}, {0, 0, 0, 0});
auto read = make_shared<op::ReadValue>(init_const, "v0");
std::vector<shared_ptr<Node>> args = {arg2, arg};
auto pattern = make_shared<op::Concat>(args, 1);
auto res = make_shared<op::Result>(pattern);
const auto axis = op::Constant::create(element::i64, Shape{}, {1});
auto crop = make_shared<op::v1::Split>(pattern, axis, 3);
auto res2 = make_shared<op::Result>(crop, "v0");

auto f = make_shared<Function>(ResultVector({res, res2}), ParameterVector{arg2, arg});

NodeVector nodes = f->get_ops();
EXPECT_EQ(nodes.size(), 7);
ParameterVector params = f->get_parameters();
EXPECT_EQ(params.size(), 2);

pattern->input(0).replace_source_output(read->output(0));
f->remove_parameter(arg2);
params = f->get_parameters();
EXPECT_EQ(params.size(), 1);
nodes = f->get_ops();
EXPECT_EQ(nodes.size(), 8);

f->validate_nodes_and_infer_types();
}