Files
openvino/ngraph/test/replace_node.cpp

111 lines
3.5 KiB
C++
Raw Normal View History

// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "gtest/gtest.h"
#include "util/type_prop.hpp"
#include "ngraph/ngraph.hpp"
using namespace std;
using namespace ngraph;
//
// Graph before (params in [] brackets, constants in () parens, results in {} braces):
//
// [x] [y] [z]
// \ / |
// Add (k) |
// \ / |
// Mul** |
// \ /
// Sub
// |
// {r}
//
// Param substitutions:
//
// [x] -> [x']
//
// Body substitutions:
//
// (k) -> (k')
// [y] -> (k'')
// [z] -> [x'] + **
//
// After replacement:
//
// [x']---------
// | |
// | (k'') | [z] and [y] is still there, but dead
// \ / |
// Add (k') |
// \ / |
// Mul |
// \ /
// Sub ***
// |
// {r}
//
TEST(replace_node, replace_nodes)
{
auto x = make_shared<op::Parameter>(element::f32, Shape{2});
auto y = make_shared<op::Parameter>(element::f32, Shape{2});
auto z = make_shared<op::Parameter>(element::f32, Shape{2});
Remove opset0 support and undesired passes from Interpreter backend (#1469) * Move evaluate() interface from some OPs to Interpreter * commit * Move shuffle channels reference to OP's evaluate * Add some operations missed in evaluate_node * Fix select references invocation from evaluate_node() * Activation refs (#2) * HardSigmoid * Elu * Selu * Gelu * Move to test runtime * Rollback donwgrade passes delition * Initial batch to space refs * Return opset1_upgrade * WIP: Add space to batch evaluate * Fix space to batch * add evaluates function in evaluates_map (#4) * Add space to batch evaluate * Fix crop in batch to space references * Remove vectors reallocation in evaluates for b2s and s2b * . * Add SpaceToDepth evaluate * Add depth to space evaluate * Remove code duplication depth to space evaluate * Fix some failed layer tests * Ngraph test (#3) * Remove some v0 ops & fix some tests * Fixes BatchNorm * Next * dd * s * Add dot & replace slice refs * d * dkj * Review fixes part 1 * Fixes. Part 2 * Fixes. Part 3 * Enable cells refs in evaluate map * Fix some failed layer tests * Some more fixes * Fix code style (#6) * Tests (#7) * PriorBox * Mod * NormilizeL2 * Update prior_box.hpp * Fix one hot ref call * . * Select (#8) * Select * Fix code style * Fix select messages * ReverseSeq (#9) * ReverseSeq * Select * ExtractImagePatches, Seqence * Fix Code Style * remove extra * Remove etra line@ * Add fake quantize reference * Align convolution layer tests instantiations with updated definition * Disabled some failed LPT tests * Disabled some failed LPT tests * Remove undesired changes * Update unit-test manifests + some code cleanup * Fix code style (#10) * Normalize L2 refs support (from PR #2327) * Fix code style * Apply review comments. Part 1 (#11) * Apply first part of review comments * Update onnx_import.in.cpp * Remove redundant reshape from shuffle_channels evaluate * Decompose GroupConvolution * [IE Ngraph] Fix some operation inheritance (#13) * [IE TESTS] Depth2Space * Space2Depth * ShuffleChannels * Fix ode style * Fix code style * [IE NGraph] Remove decompose op (#14) * . * Fix loosing control dependency in replace_node * Fix loosing control dependency in replace_node * Fix code style * Fix FQ references build on windows * Fix code style * Apply comments (#15) * [Ie Ngraph] Remove using v1::Add * [Ie Ngraph] Remove using v1::Mutliply * [Ie Ngraph] Remove using v1::Subtract * [Ie Ngraph] Remove using v1::Divide * [Ie Ngraph] Remove using v1::Equal * [Ie Ngraph] Remove using v1::Greater * [Ie Ngraph] Remove using v1::Greater_eq * [Ie Ngraph] Remove using v1::Less * [Ie Ngraph] Remove using v1::LessEq * [Ie Ngraph] Remove using operator+ * [Ie Ngraph] Remove using operator/ * [Ie Ngraph] Remove using operator* * [Ie Ngraph] Remove using operator- * Fix code style * Ci (#16) * Fix CentOS compilation * Revert ngraph::op::vo::Multiply removing due to OpenCV * Android fix (#17) * fix failures * Fix code style * Add (#18) * Android fix * Add * Add in opset1 upgrade pass * Add in opset1 upgrade pass * Remove v0::Add, Reverted removing v0::Multiply (#19) * Remove overloaded math operators from PyNgraph * Remove overloaded math operators from PyNgraph * Fix gna tests (#20) * Fix gna tests * Squashed commit of the following: commit 565b504c1cb8d4f21bc0cb45836e9e473a2b871e Author: Alexander Zhogov <alexander.zhogov@intel.com> Date: Tue Oct 13 13:27:34 2020 +0300 GitHub CI: Add files_size.yml (#2570) * GitHub CI: Add files_size.yml * Update job name commit ab0fb298530152f25c7a8c5cc5ee3d6ba03d6516 Author: Vladislav Vinogradov <vlad.vinogradov@intel.com> Date: Tue Oct 13 11:37:30 2020 +0300 [IE][BUILD] Fix C5208 warning under Windows (#2628) * C++ feature in C `typedef struct` code. * The warning can be promoted to error in dependent projects. C5208: unnamed class used in typedef name cannot declare members other than non-static data members, member enumerations, or member classes commit 15a338e89ba9336038e836c7fb086cdd4fed1d7a Author: helmutg <helmut@subdivi.de> Date: Mon Oct 12 22:24:24 2020 +0200 add build option USE_SYSTEM_PUGIXML (#2502) It allows skipping inference-engine/thirdparty/pugixml and using the system copy instead. Thanks to @Osse for helping understand cmake scoping rules. Co-authored-by: Helmut Grohne <helmut.grohne@intenta.de> commit 7ac8cd858617dd558b66b86df56aea151941288c Author: Alexander Zhogov <alexander.zhogov@intel.com> Date: Mon Oct 12 19:23:00 2020 +0300 Azure CI: Fix nGraph ONNX commit 3a2e33962ce445369d718a8fbd36fb8e69dd5363 Author: Alexander Zhogov <alexander.zhogov@intel.com> Date: Mon Oct 12 19:20:28 2020 +0300 Azure CI: Disable steps in nGraph ONNX commit 5835974fad10b28e6b530317a2cbbd62ec2bff8d Author: azhogov <alexander.zhogov@intel.com> Date: Mon Oct 12 18:46:14 2020 +0300 Azure CI: Add linux_ngraph_onnx.yml * LRN Reference (#21) * Disable failed tests on ia32 * Remove redundant broadcast from MVN ref * Fix missed GatherND in opset_int_tbl + code style * Remove one extra temporary buffer from MVN ref * Merge master (#22) * Leaky relu transformation refactor (#2640) * Refactored LeakyRelu transformation * Added unit test for LeakyRelu transformation + removed duplicate test function valued_const * nGraph implementation of NMS-5 (without `evaluate()`) (#2651) * Written nGraph NMS-5 without evaluate(). * Used NGRAPH_RTTI_DECLARATION. * setupvars.sh: Updated setting pyenv error to warning. (#2663) * Fix itt build (#2662) * Loop-5 operation specification (#2291) The Loop-5 operation specification * Time tests improvements (#2642) * Remove extra functions from run_timetest.py * Add `log.debug` of raw and aggregated statistics in run_timetest.py * Implement storing of models locally for test_timetest.py * Fixed CVS-35316 (#2072) * Extend MO for operation GatherND (#2540) * Extend MO for operation GatherND * Update documentation * Rename GatherNd.py to gathernd.py Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Add hsigmoid op to ngraph (#2647) * [IE CLDNN] Fixes for GatherTree and ReverseSequence (#2660) * ReorgYolo reference implementation (#2384) * Align ReorgYolo to the spec (vector strides -> int stride) * ReorgYolo ref impl * ReorgYolo evaluate method * ReorgYolo tests * Tests update * Style apply * Add some coments * Code refactor * Comment update * Style apply * Build fix, mark evaluate as override * Revert "Align ReorgYolo to the spec (vector strides -> int stride)" * Use int_executable instead of evaluate * Use char* instead of templates * Code refactor * Comment update * Code review comment * Add constructor aligned with spec * Update shape validation * Update attributes tests * Add type_prop tests * Update backend tests * Add single layer tests * Update the spec * Remove wrong transformation test * Add ReorgYolo to evaluates_map * code style Co-authored-by: Evgeny Lazarev <evgeny.lazarev@intel.com> Co-authored-by: Vladimir Gavrilov <vladimir.gavrilov@intel.com> Co-authored-by: Artyom Anokhov <artyom.anokhov@intel.com> Co-authored-by: Andrey Somsikov <andrey.somsikov@intel.com> Co-authored-by: Vitaliy Urusovskij <vitaliy.urusovskij@intel.com> Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com> Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com> Co-authored-by: iliya mironov <iliya.mironov@intel.com> Co-authored-by: Vladimir Paramuzov <vladimir.paramuzov@intel.com> Co-authored-by: Katarzyna Mitrus <katarzyna.mitrus@intel.com> * RegionYolo * Apply review comments * Merge remote-tracking branch 'upstream/master' into update_evaluates # Conflicts: # ngraph/core/src/op/mvn.cpp # ngraph/test/backend/fused_op.in.cpp # ngraph/test/runtime/ie/unit_test.manifest # ngraph/test/runtime/interpreter/int_executable.hpp # ngraph/test/runtime/interpreter/opset_int_tbl.hpp # ngraph/test/runtime/interpreter/unit_test.manifest # ngraph/test/runtime/opset0_tbl.hpp * Apply code style * Apply comments * Apply code style * Fix RegionYolo evaluate redefinition * Removed defines from evaluates map * Apply code style * Fix MVN ref * rename select reference argument * Fix code style * Fix Fake Quantize references calculation (#24) * Fix MVN ref * Fix MVN & adding NMS * Fix TI * Temporary relax comparison threshold for FQ SLT * Fix GPU LPT Tests * Add explicit rounding mode seetting in FQ references * Apply code style * Rollback op_is test deletion * Apply code style * Fix merge conflict resolving issues * Apply code style Co-authored-by: Irina Efode <irina.efode@intel.com> Co-authored-by: Anton Zaytsev <anton.zaytsev@intel.com> Co-authored-by: Evgeny Lazarev <evgeny.lazarev@intel.com> Co-authored-by: Vladimir Gavrilov <vladimir.gavrilov@intel.com> Co-authored-by: Artyom Anokhov <artyom.anokhov@intel.com> Co-authored-by: Andrey Somsikov <andrey.somsikov@intel.com> Co-authored-by: Vitaliy Urusovskij <vitaliy.urusovskij@intel.com> Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com> Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com> Co-authored-by: iliya mironov <iliya.mironov@intel.com> Co-authored-by: Vladimir Paramuzov <vladimir.paramuzov@intel.com> Co-authored-by: Katarzyna Mitrus <katarzyna.mitrus@intel.com>
2020-12-03 12:36:34 +03:00
auto add = make_shared<op::v1::Add>(x, y);
auto k = make_shared<op::Constant>(element::f32, Shape{2}, vector<float>{1, 2});
Remove opset0 support and undesired passes from Interpreter backend (#1469) * Move evaluate() interface from some OPs to Interpreter * commit * Move shuffle channels reference to OP's evaluate * Add some operations missed in evaluate_node * Fix select references invocation from evaluate_node() * Activation refs (#2) * HardSigmoid * Elu * Selu * Gelu * Move to test runtime * Rollback donwgrade passes delition * Initial batch to space refs * Return opset1_upgrade * WIP: Add space to batch evaluate * Fix space to batch * add evaluates function in evaluates_map (#4) * Add space to batch evaluate * Fix crop in batch to space references * Remove vectors reallocation in evaluates for b2s and s2b * . * Add SpaceToDepth evaluate * Add depth to space evaluate * Remove code duplication depth to space evaluate * Fix some failed layer tests * Ngraph test (#3) * Remove some v0 ops & fix some tests * Fixes BatchNorm * Next * dd * s * Add dot & replace slice refs * d * dkj * Review fixes part 1 * Fixes. Part 2 * Fixes. Part 3 * Enable cells refs in evaluate map * Fix some failed layer tests * Some more fixes * Fix code style (#6) * Tests (#7) * PriorBox * Mod * NormilizeL2 * Update prior_box.hpp * Fix one hot ref call * . * Select (#8) * Select * Fix code style * Fix select messages * ReverseSeq (#9) * ReverseSeq * Select * ExtractImagePatches, Seqence * Fix Code Style * remove extra * Remove etra line@ * Add fake quantize reference * Align convolution layer tests instantiations with updated definition * Disabled some failed LPT tests * Disabled some failed LPT tests * Remove undesired changes * Update unit-test manifests + some code cleanup * Fix code style (#10) * Normalize L2 refs support (from PR #2327) * Fix code style * Apply review comments. Part 1 (#11) * Apply first part of review comments * Update onnx_import.in.cpp * Remove redundant reshape from shuffle_channels evaluate * Decompose GroupConvolution * [IE Ngraph] Fix some operation inheritance (#13) * [IE TESTS] Depth2Space * Space2Depth * ShuffleChannels * Fix ode style * Fix code style * [IE NGraph] Remove decompose op (#14) * . * Fix loosing control dependency in replace_node * Fix loosing control dependency in replace_node * Fix code style * Fix FQ references build on windows * Fix code style * Apply comments (#15) * [Ie Ngraph] Remove using v1::Add * [Ie Ngraph] Remove using v1::Mutliply * [Ie Ngraph] Remove using v1::Subtract * [Ie Ngraph] Remove using v1::Divide * [Ie Ngraph] Remove using v1::Equal * [Ie Ngraph] Remove using v1::Greater * [Ie Ngraph] Remove using v1::Greater_eq * [Ie Ngraph] Remove using v1::Less * [Ie Ngraph] Remove using v1::LessEq * [Ie Ngraph] Remove using operator+ * [Ie Ngraph] Remove using operator/ * [Ie Ngraph] Remove using operator* * [Ie Ngraph] Remove using operator- * Fix code style * Ci (#16) * Fix CentOS compilation * Revert ngraph::op::vo::Multiply removing due to OpenCV * Android fix (#17) * fix failures * Fix code style * Add (#18) * Android fix * Add * Add in opset1 upgrade pass * Add in opset1 upgrade pass * Remove v0::Add, Reverted removing v0::Multiply (#19) * Remove overloaded math operators from PyNgraph * Remove overloaded math operators from PyNgraph * Fix gna tests (#20) * Fix gna tests * Squashed commit of the following: commit 565b504c1cb8d4f21bc0cb45836e9e473a2b871e Author: Alexander Zhogov <alexander.zhogov@intel.com> Date: Tue Oct 13 13:27:34 2020 +0300 GitHub CI: Add files_size.yml (#2570) * GitHub CI: Add files_size.yml * Update job name commit ab0fb298530152f25c7a8c5cc5ee3d6ba03d6516 Author: Vladislav Vinogradov <vlad.vinogradov@intel.com> Date: Tue Oct 13 11:37:30 2020 +0300 [IE][BUILD] Fix C5208 warning under Windows (#2628) * C++ feature in C `typedef struct` code. * The warning can be promoted to error in dependent projects. C5208: unnamed class used in typedef name cannot declare members other than non-static data members, member enumerations, or member classes commit 15a338e89ba9336038e836c7fb086cdd4fed1d7a Author: helmutg <helmut@subdivi.de> Date: Mon Oct 12 22:24:24 2020 +0200 add build option USE_SYSTEM_PUGIXML (#2502) It allows skipping inference-engine/thirdparty/pugixml and using the system copy instead. Thanks to @Osse for helping understand cmake scoping rules. Co-authored-by: Helmut Grohne <helmut.grohne@intenta.de> commit 7ac8cd858617dd558b66b86df56aea151941288c Author: Alexander Zhogov <alexander.zhogov@intel.com> Date: Mon Oct 12 19:23:00 2020 +0300 Azure CI: Fix nGraph ONNX commit 3a2e33962ce445369d718a8fbd36fb8e69dd5363 Author: Alexander Zhogov <alexander.zhogov@intel.com> Date: Mon Oct 12 19:20:28 2020 +0300 Azure CI: Disable steps in nGraph ONNX commit 5835974fad10b28e6b530317a2cbbd62ec2bff8d Author: azhogov <alexander.zhogov@intel.com> Date: Mon Oct 12 18:46:14 2020 +0300 Azure CI: Add linux_ngraph_onnx.yml * LRN Reference (#21) * Disable failed tests on ia32 * Remove redundant broadcast from MVN ref * Fix missed GatherND in opset_int_tbl + code style * Remove one extra temporary buffer from MVN ref * Merge master (#22) * Leaky relu transformation refactor (#2640) * Refactored LeakyRelu transformation * Added unit test for LeakyRelu transformation + removed duplicate test function valued_const * nGraph implementation of NMS-5 (without `evaluate()`) (#2651) * Written nGraph NMS-5 without evaluate(). * Used NGRAPH_RTTI_DECLARATION. * setupvars.sh: Updated setting pyenv error to warning. (#2663) * Fix itt build (#2662) * Loop-5 operation specification (#2291) The Loop-5 operation specification * Time tests improvements (#2642) * Remove extra functions from run_timetest.py * Add `log.debug` of raw and aggregated statistics in run_timetest.py * Implement storing of models locally for test_timetest.py * Fixed CVS-35316 (#2072) * Extend MO for operation GatherND (#2540) * Extend MO for operation GatherND * Update documentation * Rename GatherNd.py to gathernd.py Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Add hsigmoid op to ngraph (#2647) * [IE CLDNN] Fixes for GatherTree and ReverseSequence (#2660) * ReorgYolo reference implementation (#2384) * Align ReorgYolo to the spec (vector strides -> int stride) * ReorgYolo ref impl * ReorgYolo evaluate method * ReorgYolo tests * Tests update * Style apply * Add some coments * Code refactor * Comment update * Style apply * Build fix, mark evaluate as override * Revert "Align ReorgYolo to the spec (vector strides -> int stride)" * Use int_executable instead of evaluate * Use char* instead of templates * Code refactor * Comment update * Code review comment * Add constructor aligned with spec * Update shape validation * Update attributes tests * Add type_prop tests * Update backend tests * Add single layer tests * Update the spec * Remove wrong transformation test * Add ReorgYolo to evaluates_map * code style Co-authored-by: Evgeny Lazarev <evgeny.lazarev@intel.com> Co-authored-by: Vladimir Gavrilov <vladimir.gavrilov@intel.com> Co-authored-by: Artyom Anokhov <artyom.anokhov@intel.com> Co-authored-by: Andrey Somsikov <andrey.somsikov@intel.com> Co-authored-by: Vitaliy Urusovskij <vitaliy.urusovskij@intel.com> Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com> Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com> Co-authored-by: iliya mironov <iliya.mironov@intel.com> Co-authored-by: Vladimir Paramuzov <vladimir.paramuzov@intel.com> Co-authored-by: Katarzyna Mitrus <katarzyna.mitrus@intel.com> * RegionYolo * Apply review comments * Merge remote-tracking branch 'upstream/master' into update_evaluates # Conflicts: # ngraph/core/src/op/mvn.cpp # ngraph/test/backend/fused_op.in.cpp # ngraph/test/runtime/ie/unit_test.manifest # ngraph/test/runtime/interpreter/int_executable.hpp # ngraph/test/runtime/interpreter/opset_int_tbl.hpp # ngraph/test/runtime/interpreter/unit_test.manifest # ngraph/test/runtime/opset0_tbl.hpp * Apply code style * Apply comments * Apply code style * Fix RegionYolo evaluate redefinition * Removed defines from evaluates map * Apply code style * Fix MVN ref * rename select reference argument * Fix code style * Fix Fake Quantize references calculation (#24) * Fix MVN ref * Fix MVN & adding NMS * Fix TI * Temporary relax comparison threshold for FQ SLT * Fix GPU LPT Tests * Add explicit rounding mode seetting in FQ references * Apply code style * Rollback op_is test deletion * Apply code style * Fix merge conflict resolving issues * Apply code style Co-authored-by: Irina Efode <irina.efode@intel.com> Co-authored-by: Anton Zaytsev <anton.zaytsev@intel.com> Co-authored-by: Evgeny Lazarev <evgeny.lazarev@intel.com> Co-authored-by: Vladimir Gavrilov <vladimir.gavrilov@intel.com> Co-authored-by: Artyom Anokhov <artyom.anokhov@intel.com> Co-authored-by: Andrey Somsikov <andrey.somsikov@intel.com> Co-authored-by: Vitaliy Urusovskij <vitaliy.urusovskij@intel.com> Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com> Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com> Co-authored-by: iliya mironov <iliya.mironov@intel.com> Co-authored-by: Vladimir Paramuzov <vladimir.paramuzov@intel.com> Co-authored-by: Katarzyna Mitrus <katarzyna.mitrus@intel.com>
2020-12-03 12:36:34 +03:00
auto mul = make_shared<op::v1::Multiply>(add, k);
auto sub = make_shared<op::v1::Subtract>(mul, z);
auto f = make_shared<Function>(NodeVector{sub}, ParameterVector{x, y, z});
unordered_map<shared_ptr<op::Parameter>, shared_ptr<op::Parameter>> parameter_replacement_map;
auto x_replacement = make_shared<op::Parameter>(element::f32, Shape{2});
parameter_replacement_map[x] = x_replacement;
unordered_map<shared_ptr<Node>, shared_ptr<Node>> body_replacement_map;
auto y_replacement = make_shared<op::Constant>(element::f32, Shape{2}, vector<float>{3, 4});
auto k_replacement = make_shared<op::Constant>(element::f32, Shape{2}, vector<float>{5, 6});
Remove opset0 support and undesired passes from Interpreter backend (#1469) * Move evaluate() interface from some OPs to Interpreter * commit * Move shuffle channels reference to OP's evaluate * Add some operations missed in evaluate_node * Fix select references invocation from evaluate_node() * Activation refs (#2) * HardSigmoid * Elu * Selu * Gelu * Move to test runtime * Rollback donwgrade passes delition * Initial batch to space refs * Return opset1_upgrade * WIP: Add space to batch evaluate * Fix space to batch * add evaluates function in evaluates_map (#4) * Add space to batch evaluate * Fix crop in batch to space references * Remove vectors reallocation in evaluates for b2s and s2b * . * Add SpaceToDepth evaluate * Add depth to space evaluate * Remove code duplication depth to space evaluate * Fix some failed layer tests * Ngraph test (#3) * Remove some v0 ops & fix some tests * Fixes BatchNorm * Next * dd * s * Add dot & replace slice refs * d * dkj * Review fixes part 1 * Fixes. Part 2 * Fixes. Part 3 * Enable cells refs in evaluate map * Fix some failed layer tests * Some more fixes * Fix code style (#6) * Tests (#7) * PriorBox * Mod * NormilizeL2 * Update prior_box.hpp * Fix one hot ref call * . * Select (#8) * Select * Fix code style * Fix select messages * ReverseSeq (#9) * ReverseSeq * Select * ExtractImagePatches, Seqence * Fix Code Style * remove extra * Remove etra line@ * Add fake quantize reference * Align convolution layer tests instantiations with updated definition * Disabled some failed LPT tests * Disabled some failed LPT tests * Remove undesired changes * Update unit-test manifests + some code cleanup * Fix code style (#10) * Normalize L2 refs support (from PR #2327) * Fix code style * Apply review comments. Part 1 (#11) * Apply first part of review comments * Update onnx_import.in.cpp * Remove redundant reshape from shuffle_channels evaluate * Decompose GroupConvolution * [IE Ngraph] Fix some operation inheritance (#13) * [IE TESTS] Depth2Space * Space2Depth * ShuffleChannels * Fix ode style * Fix code style * [IE NGraph] Remove decompose op (#14) * . * Fix loosing control dependency in replace_node * Fix loosing control dependency in replace_node * Fix code style * Fix FQ references build on windows * Fix code style * Apply comments (#15) * [Ie Ngraph] Remove using v1::Add * [Ie Ngraph] Remove using v1::Mutliply * [Ie Ngraph] Remove using v1::Subtract * [Ie Ngraph] Remove using v1::Divide * [Ie Ngraph] Remove using v1::Equal * [Ie Ngraph] Remove using v1::Greater * [Ie Ngraph] Remove using v1::Greater_eq * [Ie Ngraph] Remove using v1::Less * [Ie Ngraph] Remove using v1::LessEq * [Ie Ngraph] Remove using operator+ * [Ie Ngraph] Remove using operator/ * [Ie Ngraph] Remove using operator* * [Ie Ngraph] Remove using operator- * Fix code style * Ci (#16) * Fix CentOS compilation * Revert ngraph::op::vo::Multiply removing due to OpenCV * Android fix (#17) * fix failures * Fix code style * Add (#18) * Android fix * Add * Add in opset1 upgrade pass * Add in opset1 upgrade pass * Remove v0::Add, Reverted removing v0::Multiply (#19) * Remove overloaded math operators from PyNgraph * Remove overloaded math operators from PyNgraph * Fix gna tests (#20) * Fix gna tests * Squashed commit of the following: commit 565b504c1cb8d4f21bc0cb45836e9e473a2b871e Author: Alexander Zhogov <alexander.zhogov@intel.com> Date: Tue Oct 13 13:27:34 2020 +0300 GitHub CI: Add files_size.yml (#2570) * GitHub CI: Add files_size.yml * Update job name commit ab0fb298530152f25c7a8c5cc5ee3d6ba03d6516 Author: Vladislav Vinogradov <vlad.vinogradov@intel.com> Date: Tue Oct 13 11:37:30 2020 +0300 [IE][BUILD] Fix C5208 warning under Windows (#2628) * C++ feature in C `typedef struct` code. * The warning can be promoted to error in dependent projects. C5208: unnamed class used in typedef name cannot declare members other than non-static data members, member enumerations, or member classes commit 15a338e89ba9336038e836c7fb086cdd4fed1d7a Author: helmutg <helmut@subdivi.de> Date: Mon Oct 12 22:24:24 2020 +0200 add build option USE_SYSTEM_PUGIXML (#2502) It allows skipping inference-engine/thirdparty/pugixml and using the system copy instead. Thanks to @Osse for helping understand cmake scoping rules. Co-authored-by: Helmut Grohne <helmut.grohne@intenta.de> commit 7ac8cd858617dd558b66b86df56aea151941288c Author: Alexander Zhogov <alexander.zhogov@intel.com> Date: Mon Oct 12 19:23:00 2020 +0300 Azure CI: Fix nGraph ONNX commit 3a2e33962ce445369d718a8fbd36fb8e69dd5363 Author: Alexander Zhogov <alexander.zhogov@intel.com> Date: Mon Oct 12 19:20:28 2020 +0300 Azure CI: Disable steps in nGraph ONNX commit 5835974fad10b28e6b530317a2cbbd62ec2bff8d Author: azhogov <alexander.zhogov@intel.com> Date: Mon Oct 12 18:46:14 2020 +0300 Azure CI: Add linux_ngraph_onnx.yml * LRN Reference (#21) * Disable failed tests on ia32 * Remove redundant broadcast from MVN ref * Fix missed GatherND in opset_int_tbl + code style * Remove one extra temporary buffer from MVN ref * Merge master (#22) * Leaky relu transformation refactor (#2640) * Refactored LeakyRelu transformation * Added unit test for LeakyRelu transformation + removed duplicate test function valued_const * nGraph implementation of NMS-5 (without `evaluate()`) (#2651) * Written nGraph NMS-5 without evaluate(). * Used NGRAPH_RTTI_DECLARATION. * setupvars.sh: Updated setting pyenv error to warning. (#2663) * Fix itt build (#2662) * Loop-5 operation specification (#2291) The Loop-5 operation specification * Time tests improvements (#2642) * Remove extra functions from run_timetest.py * Add `log.debug` of raw and aggregated statistics in run_timetest.py * Implement storing of models locally for test_timetest.py * Fixed CVS-35316 (#2072) * Extend MO for operation GatherND (#2540) * Extend MO for operation GatherND * Update documentation * Rename GatherNd.py to gathernd.py Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Add hsigmoid op to ngraph (#2647) * [IE CLDNN] Fixes for GatherTree and ReverseSequence (#2660) * ReorgYolo reference implementation (#2384) * Align ReorgYolo to the spec (vector strides -> int stride) * ReorgYolo ref impl * ReorgYolo evaluate method * ReorgYolo tests * Tests update * Style apply * Add some coments * Code refactor * Comment update * Style apply * Build fix, mark evaluate as override * Revert "Align ReorgYolo to the spec (vector strides -> int stride)" * Use int_executable instead of evaluate * Use char* instead of templates * Code refactor * Comment update * Code review comment * Add constructor aligned with spec * Update shape validation * Update attributes tests * Add type_prop tests * Update backend tests * Add single layer tests * Update the spec * Remove wrong transformation test * Add ReorgYolo to evaluates_map * code style Co-authored-by: Evgeny Lazarev <evgeny.lazarev@intel.com> Co-authored-by: Vladimir Gavrilov <vladimir.gavrilov@intel.com> Co-authored-by: Artyom Anokhov <artyom.anokhov@intel.com> Co-authored-by: Andrey Somsikov <andrey.somsikov@intel.com> Co-authored-by: Vitaliy Urusovskij <vitaliy.urusovskij@intel.com> Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com> Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com> Co-authored-by: iliya mironov <iliya.mironov@intel.com> Co-authored-by: Vladimir Paramuzov <vladimir.paramuzov@intel.com> Co-authored-by: Katarzyna Mitrus <katarzyna.mitrus@intel.com> * RegionYolo * Apply review comments * Merge remote-tracking branch 'upstream/master' into update_evaluates # Conflicts: # ngraph/core/src/op/mvn.cpp # ngraph/test/backend/fused_op.in.cpp # ngraph/test/runtime/ie/unit_test.manifest # ngraph/test/runtime/interpreter/int_executable.hpp # ngraph/test/runtime/interpreter/opset_int_tbl.hpp # ngraph/test/runtime/interpreter/unit_test.manifest # ngraph/test/runtime/opset0_tbl.hpp * Apply code style * Apply comments * Apply code style * Fix RegionYolo evaluate redefinition * Removed defines from evaluates map * Apply code style * Fix MVN ref * rename select reference argument * Fix code style * Fix Fake Quantize references calculation (#24) * Fix MVN ref * Fix MVN & adding NMS * Fix TI * Temporary relax comparison threshold for FQ SLT * Fix GPU LPT Tests * Add explicit rounding mode seetting in FQ references * Apply code style * Rollback op_is test deletion * Apply code style * Fix merge conflict resolving issues * Apply code style Co-authored-by: Irina Efode <irina.efode@intel.com> Co-authored-by: Anton Zaytsev <anton.zaytsev@intel.com> Co-authored-by: Evgeny Lazarev <evgeny.lazarev@intel.com> Co-authored-by: Vladimir Gavrilov <vladimir.gavrilov@intel.com> Co-authored-by: Artyom Anokhov <artyom.anokhov@intel.com> Co-authored-by: Andrey Somsikov <andrey.somsikov@intel.com> Co-authored-by: Vitaliy Urusovskij <vitaliy.urusovskij@intel.com> Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com> Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com> Co-authored-by: iliya mironov <iliya.mironov@intel.com> Co-authored-by: Vladimir Paramuzov <vladimir.paramuzov@intel.com> Co-authored-by: Katarzyna Mitrus <katarzyna.mitrus@intel.com>
2020-12-03 12:36:34 +03:00
auto z_replacement = make_shared<op::v1::Add>(x_replacement, mul);
body_replacement_map[y] = y_replacement;
body_replacement_map[k] = k_replacement;
body_replacement_map[z] = z_replacement;
replace_nodes(f, parameter_replacement_map, body_replacement_map);
// Should still have three params.
ASSERT_EQ(f->get_parameters().size(), 3);
// The three params be {x_replacement, y, z}.
ASSERT_EQ(f->get_parameters()[0], x_replacement);
ASSERT_EQ(f->get_parameters()[1], y);
ASSERT_EQ(f->get_parameters()[2], z);
// y, z should be dead.
ASSERT_EQ(y->get_users(true).size(), 0);
ASSERT_EQ(z->get_users(true).size(), 0);
// Should still have one result.
ASSERT_EQ(f->get_results().size(), 1);
// Result node should be sub (unchanged).
ASSERT_EQ(f->get_results()[0]->get_input_node_shared_ptr(0), sub);
// sub's arguments should be mul (unchanged) and z_replacement.
ASSERT_EQ(sub->get_input_node_shared_ptr(0), mul);
ASSERT_EQ(sub->get_input_node_shared_ptr(1), z_replacement);
// mul's arguments should be add (unchanged) and k_replacement.
ASSERT_EQ(mul->get_input_node_shared_ptr(0), add);
ASSERT_EQ(mul->get_input_node_shared_ptr(1), k_replacement);
// add's arguments should be x_replacement and y_replacement.
ASSERT_EQ(add->get_input_node_shared_ptr(0), x_replacement);
ASSERT_EQ(add->get_input_node_shared_ptr(1), y_replacement);
// z_replacement's arguments should be x_replacement and mul.
ASSERT_EQ(z_replacement->get_input_node_shared_ptr(0), x_replacement);
ASSERT_EQ(z_replacement->get_input_node_shared_ptr(1), mul);
}