Skip to content

Commit

Permalink
Remove generic ie op (#4213)
Browse files Browse the repository at this point in the history
* Removed legacy IE shape infer

* Removed GenericIE operation

* Removed legacy shape infer tests

* Removed legacy test with legacy IE reshape

* Fixed compilation issues related to removal of GenericIE

* Fixed one more compilation issue with clDNN

* Fixed test for reading experimental ops

* Updated tests and make IR Reader to load old experimenal and extension ops as opset6

* Change opset of some ops only if they are currently experimental/extension to avoid situation like opset1::Proposal -> opset6::Proposal

* Removed more legacy code

* Returned back code removed by mistake

* Fixed issues related to incorrect merge with master

* Merge fixes

* Fixed unit tests which starts to fail because now loading the model with unknown operation is failed earlier

* Removed incorrectly added code

Co-authored-by: Evgeny Lazarev <[email protected]>
  • Loading branch information
lazarevevgeny and undef-nnov authored Feb 13, 2021
1 parent 0442184 commit 3f5ff2c
Show file tree
Hide file tree
Showing 30 changed files with 14 additions and 464 deletions.
3 changes: 1 addition & 2 deletions docs/IE_PLUGIN_DG/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,7 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*

EXCLUDE_PATTERNS = generic_ie.hpp \
function_name.hpp \
EXCLUDE_PATTERNS = function_name.hpp \
macro_overload.hpp

# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
Expand Down
2 changes: 0 additions & 2 deletions docs/doxygen/ie_plugin_api.config
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ FILE_PATTERNS = *.c \
*.hpp \
*.md

EXCLUDE_PATTERNS = generic_ie.hpp

EXCLUDE_SYMBOLS = InferenceEngine::details

TAGFILES = "@DOCS_BUILD_DIR@/ie_api.tag=.." \
Expand Down
3 changes: 0 additions & 3 deletions inference-engine/src/cldnn_engine/cldnn_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <ngraph/opsets/opset5.hpp>
#include <ngraph/pass/manager.hpp>
#include <ngraph/pass/constant_folding.hpp>
#include <generic_ie.hpp>
#include <ie_ngraph_utils.hpp>

#include <transformations/opset_conversions/convert_opset3_to_opset2.hpp>
Expand Down Expand Up @@ -137,8 +136,6 @@ InferenceEngine::CNNNetwork clDNNEngine::CloneAndTransformNetwork(const Inferenc
if (clonedNetwork.getFunction()) {
OV_ITT_SCOPED_TASK(itt::domains::CLDNNPlugin, "clDNNEngine::TransformNetwork");
auto nGraphFunc = clonedNetwork.getFunction();
// Disable shape inference (WA for generic operations)
ngraph::op::GenericIE::DisableReshape noReshape(nGraphFunc);

bool enableInt8;
{
Expand Down
3 changes: 1 addition & 2 deletions inference-engine/src/cldnn_engine/cldnn_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#include <sys/stat.h>
#include <exec_graph_info.hpp>
#include <ie_ngraph_utils.hpp>
#include "generic_ie.hpp"
#include <ngraph/variant.hpp>
#include <ngraph/ngraph.hpp>
#include "cldnn_itt.h"

using namespace InferenceEngine;
Expand Down Expand Up @@ -464,7 +464,6 @@ InferenceEngine::CNNNetwork CLDNNGraph::GetExecGraphInfoByPrimitivesInfo(std::ve
create_ngraph_node(pi);
}

ngraph::op::GenericIE::DisableReshape reshape(nodes);
auto function = std::make_shared<ngraph::Function>(results, params, "runtime_gpu_graph");
InferenceEngine::CNNNetwork net(function);
return net;
Expand Down
3 changes: 0 additions & 3 deletions inference-engine/src/gna_plugin/gna_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include <layers/gna_fake_quantize_layer.hpp>
#include "gna_graph_patterns.hpp"

#include <generic_ie.hpp>
#include <ngraph/pass/manager.hpp>
#include <legacy/convert_function_to_cnn_network.hpp>
#include <legacy/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.hpp>
Expand Down Expand Up @@ -682,8 +681,6 @@ void GNAPlugin::LoadNetwork(CNNNetwork & _network) {
if (_network.getFunction()) {
CNNNetwork clonedNetwork = InferenceEngine::cloneNetwork(_network);
const auto& graph = clonedNetwork.getFunction();
// Disable shape inference (WA for generic operations)
ngraph::op::GenericIE::DisableReshape noReshape(graph);
ngraph::pass::Manager manager;
manager.register_pass<ngraph::pass::InitNodeInfo>();
// WA: ConvertPriorBox must be executed before the 1st ConstantFolding pass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "ie_ngraph_utils.hpp"
#include "exec_graph_info.hpp"
#include "ie_itt.hpp"
#include "generic_ie.hpp"

using namespace std;
using namespace InferenceEngine;
Expand All @@ -44,7 +43,6 @@ static std::shared_ptr<ngraph::Function> copyFunction(const std::shared_ptr<cons
bool constFolding) {
OV_ITT_SCOPED_TASK(itt::domains::IE, "copyFunction");

::ngraph::op::GenericIE::DisableReshape noReshape(func);
auto specialized_function = ngraph::clone_function(*func);

if (constFolding) {
Expand Down Expand Up @@ -286,8 +284,6 @@ std::shared_ptr<ngraph::Function> CNNNetworkNGraphImpl::cloneFunction(bool const
}

void CNNNetworkNGraphImpl::reshape() {
// Disable reshape for generic nodes
::ngraph::op::GenericIE::DisableReshape noReshape(_ngraph_function);
reshape({});
}

Expand Down
115 changes: 0 additions & 115 deletions inference-engine/src/inference_engine/generic_ie.cpp

This file was deleted.

3 changes: 0 additions & 3 deletions inference-engine/src/legacy_api/src/cnn_network_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <ngraph/pass/manager.hpp>
#include <ie_common.h>

#include "generic_ie.hpp"
#include "cnn_network_ngraph_impl.hpp"
#include <transformations/init_node_info.hpp>
#include <transformations/common_optimizations/common_optimizations.hpp>
Expand Down Expand Up @@ -94,8 +93,6 @@ CNNNetworkImpl::CNNNetworkImpl(const ICNNNetwork & ngraphImpl) {
IE_ASSERT(ngraphImplPtr != nullptr);
IE_ASSERT(ngraphImplPtr->getFunction() != nullptr);
auto graph = ngraph::clone_function(*ngraphImpl.getFunction());
// Disable shape inference (WA for generic operations)
::ngraph::op::GenericIE::DisableReshape noReshape(graph);

::ngraph::pass::Manager manager;
manager.register_pass<::ngraph::pass::InitNodeInfo>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include "legacy/ngraph_ops/rnn_sequence_ie.hpp"
#include "legacy/ngraph_ops/lstm_sequence_ie.hpp"
#include "legacy/ngraph_ops/gru_sequence_ie.hpp"
#include "generic_ie.hpp"
#include "exec_graph_info.hpp"

#include "caseless.hpp"
Expand Down Expand Up @@ -1710,36 +1709,6 @@ InferenceEngine::details::CNNLayerCreator::CNNLayerCreator(const std::shared_ptr
return res;
});

addSpecificCreator({"GenericIE"}, [](const std::shared_ptr<::ngraph::Node> &node,
const std::map<std::string, std::string> &params) -> CNNLayerPtr {
auto type = params.at("__generic_ie_type__");
auto castedLayer = ngraph::as_type_ptr<ngraph::op::GenericIE>(node);
LayerParams attrs = {node->get_friendly_name(), type, details::convertPrecision(node->get_output_element_type(0))};
auto res = std::make_shared<InferenceEngine::CNNLayer>(attrs);
if (type == "RNNCell") {
res = std::make_shared<InferenceEngine::RNNCell>(attrs);
}
if (type == "GRUCell") {
res = std::make_shared<InferenceEngine::GRUCell>(attrs);
}

auto weightableLayer = std::dynamic_pointer_cast<InferenceEngine::WeightableLayer>(res);
for (const auto& param : castedLayer->getParameters()) {
if (param.second.is<Blob::Ptr>()) {
res->blobs[param.first] = param.second.as<Blob::Ptr>();
} else if (param.second.is<Blob::CPtr>()) {
res->blobs[param.first] = std::const_pointer_cast<Blob>(param.second.as<Blob::CPtr>());
} else if (param.second.is<std::string>()) {
res->params[param.first] = param.second.as<std::string>();
}
if (weightableLayer && param.first == "weights")
weightableLayer->_weights = res->blobs[param.first];
if (weightableLayer && param.first == "biases")
weightableLayer->_biases = res->blobs[param.first];
}
return res;
});

addSpecificCreator({"ShuffleChannels"}, [](const std::shared_ptr<::ngraph::Node>& node,
const std::map<std::string, std::string>& params) -> CNNLayerPtr {
LayerParams attrs = {node->get_friendly_name(), "ShuffleChannels", details::convertPrecision(node->get_output_element_type(0))};
Expand Down
3 changes: 1 addition & 2 deletions inference-engine/src/mkldnn_plugin/mkldnn_graph_dumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <ie_ngraph_utils.hpp>
#include "exec_graph_info.hpp"
#include "mkldnn_debug.h"
#include "generic_ie.hpp"
#include <ngraph/variant.hpp>
#include "ngraph/ngraph.hpp"

#include <vector>
#include <string>
Expand Down Expand Up @@ -136,7 +136,6 @@ InferenceEngine::CNNNetwork dump_graph_as_ie_ngraph_net(const MKLDNNGraph &graph
holder->add_control_dependency(node);
}

ngraph::op::GenericIE::DisableReshape reshape(nodes);
auto function = std::make_shared<ngraph::Function>(results, params, graph._name);
InferenceEngine::CNNNetwork net(function);
return net;
Expand Down
3 changes: 0 additions & 3 deletions inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <vector>
#include <tuple>
#include <ie_system_conf.h>
#include <generic_ie.hpp>
#include <nodes/list.hpp>
#include <legacy/ie_util_internal.hpp>
#include <legacy/graph_transformer.h>
Expand Down Expand Up @@ -106,8 +105,6 @@ Engine::~Engine() {

static void Transformation(CNNNetwork& clonedNetwork, const Config& conf) {
auto nGraphFunc = clonedNetwork.getFunction();
// Disable shape inference (WA for generic operations)
ngraph::op::GenericIE::DisableReshape noReshape(nGraphFunc);

ngraph::pass::Manager manager;
manager.register_pass<ngraph::pass::InitNodeInfo>();
Expand Down
Loading

0 comments on commit 3f5ff2c

Please sign in to comment.