Remove operators with existing functional tests from layer creator (#2772)
authorBartosz Lesniewski <bartosz.lesniewski@intel.com>
Fri, 30 Oct 2020 04:42:27 +0000 (05:42 +0100)
committerGitHub <noreply@github.com>
Fri, 30 Oct 2020 04:42:27 +0000 (07:42 +0300)
* Remove 49 operators from layer creator

* Remove debug code

* Add specificCreator for deconvolution

* add specificCreator for logical not

* Fix concat creator behavior for negative axis

* add creator for TopK, overrides for visit_attribute methods

* remove layerCreator templates for removed ops

* Disable exception check for Deconvolution and TopK

* add specificCreator for stridedSlice

* add specificCreator for DetecionOutput

* resolve conflict with batchNormInference changes

* fix detection output visit_attributes for some of the bools

* Remove Ceiling from LayerCreator

* Change detectionOutput param validation to expect bool instead of uint

* detectionOutput specificCreator to set bool params as int strings

* Add vector of integer value accessor handling to xml deserializer.

* Fix indentation

inference-engine/src/legacy_api/include/legacy/ngraph_ops/topk_ie.hpp
inference-engine/src/legacy_api/src/convert_function_to_cnn_network.cpp
inference-engine/src/legacy_api/src/ie_cnn_layer_builder_ngraph.cpp
inference-engine/src/legacy_api/src/ie_layer_validators.cpp
inference-engine/src/legacy_api/src/ngraph_ops/topk_ie.cpp
inference-engine/src/readers/ir_reader/ie_ir_parser.cpp
inference-engine/src/readers/ir_reader/ie_ir_parser.hpp
inference-engine/src/transformations/include/ngraph_ops/deconvolution_ie.hpp
inference-engine/src/transformations/src/ngraph_ops/deconvolution_ie.cpp
inference-engine/tests/functional/inference_engine/cnn_network/convert_ngraph_to_cnn_network_tests.cpp
ngraph/core/src/op/strided_slice.cpp

index 65641f2..284e70e 100644 (file)
@@ -36,6 +36,7 @@ public:
     ngraph::op::TopKMode get_mode() { return m_mode; }
 
     ngraph::op::TopKSortType get_sort_type() { return m_sort_type; }
+    bool visit_attributes(AttributeVisitor &visitor) override;
 
 private:
     int64_t m_axis;
index 1b1efd1..a90a9f3 100644 (file)
@@ -6,6 +6,7 @@
 #include <memory>
 #include <vector>
 #include <unordered_set>
+#include <regex>
 
 #include <cnn_network_ngraph_impl.hpp>
 #include "ngraph_ops/convolution_ie.hpp"
@@ -93,6 +94,11 @@ public:
         params[name] = data;
     }
 
+    void on_adapter(const std::string& name, ::ngraph::ValueAccessor<std::vector<int32_t>>& adapter) override {
+        auto shape = adapter.get();
+        params[name] = joinVec(shape);
+    }
+
     void on_adapter(const std::string& name, ::ngraph::ValueAccessor<std::vector<int64_t>>& adapter) override {
         auto shape = adapter.get();
         params[name] = joinVec(shape);
@@ -232,9 +238,11 @@ InferenceEngine::details::CNNLayerCreator::CNNLayerCreator(const std::shared_ptr
     addSpecificCreator({"Concat"}, [](const std::shared_ptr<::ngraph::Node>& node,
                                       const std::map<std::string, std::string>& params) -> CNNLayerPtr {
         LayerParams attrs = {node->get_friendly_name(), node->description(),
-            details::convertPrecision(node->get_output_element_type(0))};
+                             details::convertPrecision(node->get_output_element_type(0))};
         auto res = std::make_shared<ConcatLayer>(attrs);
         res->params = params;
+        auto axis = std::stoi(res->params["axis"]);
+        res->params["axis"] = Builder::asString(axis < 0 ? axis + node->get_input_shape(0).size() : axis);
         return res;
     });
     addSpecificCreator({"AvgPool", "MaxPool"}, [](const std::shared_ptr<::ngraph::Node>& node,
@@ -414,6 +422,82 @@ InferenceEngine::details::CNNLayerCreator::CNNLayerCreator(const std::shared_ptr
         return res;
     });
 
+    addSpecificCreator({"DeconvolutionIE"},
+                       [](const std::shared_ptr<::ngraph::Node> &node,
+                          const std::map<std::string, std::string> &params) -> CNNLayerPtr {
+        LayerParams attrs = {node->get_friendly_name(), "Deconvolution",
+                             details::convertPrecision(node->get_output_element_type(0))};
+        auto res = std::make_shared<DeconvolutionLayer>(attrs);
+
+        res->params = params;
+        const auto& shape = node->get_input_shape(1);
+        res->params["output"] = Builder::asString(shape[1]);
+        std::string kernel_value;
+        for (size_t i = 2; i < shape.size(); i++) {
+            if (!kernel_value.empty()) kernel_value += ",";
+            kernel_value += Builder::asString(shape[i]);
+        }
+        res->params["kernel"] = kernel_value;
+
+        Builder::NodeConverter<ngraph::op::Constant> converter;
+        const auto weightsNode = node->input_value(1).get_node_shared_ptr();
+        if (converter.canCreate(weightsNode)) {
+            const auto& weights = converter.createLayer(weightsNode);
+            res->blobs["weights"] = weights->blobs["custom"];
+            res->_weights = weights->blobs["custom"];
+
+            if (node->inputs().size() == 3) {
+                const auto biasNode = node->input_value(2).get_node_shared_ptr();
+                if (converter.canCreate(biasNode)) {
+                    const auto& bias = converter.createLayer(biasNode);
+                    res->blobs["biases"] = bias->blobs["custom"];
+                    res->_biases = bias->blobs["custom"];
+                }
+            }
+        }
+        return res;
+    });
+
+    addSpecificCreator({"DetectionOutput"},
+                       [](const std::shared_ptr<::ngraph::Node> &node,
+                          const std::map<std::string, std::string> &params) -> CNNLayerPtr {
+        LayerParams attrs = {node->get_friendly_name(), "DetectionOutput",
+                            details::convertPrecision(node->get_output_element_type(0))};
+        auto res = std::make_shared<InferenceEngine::CNNLayer>(attrs);
+        res->params = params;
+        auto parseBoolStrToIntStr = [](const std::string &param) -> const std::string {
+            if (param == "true") {
+                return "1";
+            }
+            else if (param == "false") {
+                return "0";
+            }
+            return param;
+        };
+        if (res->params["code_type"] == "caffe.priorboxparameter.center_size"){
+            res->params["code_type"] = "caffe.PriorBoxParameter.CENTER_SIZE";
+        }
+        else{
+            res->params["code_type"] =  "caffe.PriorBoxParameter.CORNER";
+        }
+        res->params["variance_encoded_in_target"] = parseBoolStrToIntStr(res->params["variance_encoded_in_target"]);
+        res->params["share_location"] = parseBoolStrToIntStr(res->params["share_location"]);
+        res->params["clip_after_nms"] = parseBoolStrToIntStr(res->params["clip_after_nms"]);
+        res->params["clip_before_nms"] = parseBoolStrToIntStr(res->params["clip_before_nms"]);
+        res->params["decrease_label_id"] = parseBoolStrToIntStr(res->params["decrease_label_id"]);
+        res->params["normalized"] = parseBoolStrToIntStr(res->params["normalized"]);
+        return res;
+    });
+
+    addSpecificCreator({"LogicalNot"}, [](const std::shared_ptr<::ngraph::Node>& node,
+                                         const std::map<std::string, std::string> params) -> CNNLayerPtr {
+        LayerParams attrs = {node->get_friendly_name(), "Activation",
+                              details::convertPrecision(node->get_output_element_type(0))};
+        auto res = std::make_shared<InferenceEngine::CNNLayer>(attrs);
+        res->params["type"] = "not";
+        return res;                                
+    });
+
     addSpecificCreator({"LSTMCellIE"}, [](const std::shared_ptr<::ngraph::Node>& node,
                                          const std::map<std::string, std::string> params) -> CNNLayerPtr {
         LayerParams attrs = {node->get_friendly_name(), "LSTMCell",
@@ -512,6 +596,40 @@ InferenceEngine::details::CNNLayerCreator::CNNLayerCreator(const std::shared_ptr
         return res;
     });
 
+    addSpecificCreator({"StridedSlice"}, [](const std::shared_ptr<::ngraph::Node> &node,
+        const std::map<std::string, std::string> &params) -> CNNLayerPtr {
+        LayerParams attrs = {node->get_friendly_name(), "StridedSlice",
+            details::convertPrecision(node->get_output_element_type(0))};
+        auto res = std::make_shared<InferenceEngine::StridedSliceLayer>(attrs);
+        auto stridedSliceInvertMaskStr = [](const std::string& str) -> std::string {
+            std::string value;
+            auto found_numbers = details::split(str,",");
+            for (const auto &val : found_numbers)
+            {
+                if (!value.empty())
+                    value += ",";
+                value += Builder::asString((1 - std::stoi(val)));
+            }
+            return value;
+        };
+
+        res->params = params;
+        // plugins require reversed value of begin_mask and end_mask
+        res->params["begin_mask"] = stridedSliceInvertMaskStr(res->params["begin_mask"]);
+        res->params["end_mask"] = stridedSliceInvertMaskStr(res->params["end_mask"]);
+
+        return res;
+    });
+
+    addSpecificCreator({"TopK","TopKIE"}, [](const std::shared_ptr<::ngraph::Node>& node,
+        const std::map<std::string, std::string>& params) -> CNNLayerPtr {
+        LayerParams attrs = {node->get_friendly_name(), "TopK",
+                          details::convertPrecision(node->get_output_element_type(0))};
+        auto res = std::make_shared<InferenceEngine::TopKLayer>(attrs);
+        res->params = params;
+        return res;
+    });
+
     addSpecificCreator({"Transpose"}, [](const std::shared_ptr<::ngraph::Node>& node,
         const std::map<std::string, std::string>& params) -> CNNLayerPtr {
         LayerParams attrs = {node->get_friendly_name(), "Permute",
@@ -652,12 +770,11 @@ InferenceEngine::details::CNNLayerCreator::CNNLayerCreator(const std::shared_ptr
     REQUIRED_IE_CONVERSION_CREATOR("Interpolate", "Interp");
     REQUIRED_IE_CONVERSION_CREATOR("NormalizeL2", "NormalizeIE");
     REQUIRED_IE_CONVERSION_CREATOR("GroupConvolution", "ConvolutionIE");
-    REQUIRED_IE_CONVERSION_CREATOR("ConvolutionBackpropData", "DeconvolutionIE");
     REQUIRED_IE_CONVERSION_CREATOR("GroupConvolutionBackpropData", "DeconvolutionIE");
 
     addSpecificCreator({ "Convolution", "Gather", "GatherTree", "GRUCell", "GRUSequence", "HardSigmoid",
                       "LRN", "LSTMCell", "LSTMSequence", "NonMaxSuppression", "RNNCell", "RNNSequence", "OneHot",
-                      "Pad", "PriorBoxClustered", "PriorBox", "Proposal", "Selu", "Swish", "Tile", "TopK"},
+                      "Pad", "PriorBoxClustered", "PriorBox", "Proposal", "Selu", "Swish", "Tile"},
             [](const std::shared_ptr<::ngraph::Node>& node, const std::map<std::string, std::string>& params)
             -> CNNLayerPtr {
         const std::string& type_name = node->get_type_name();
@@ -726,39 +843,24 @@ void convertFunctionToICNNNetwork(const std::shared_ptr<const ::ngraph::Function
             }
         };
         const static std::vector<std::shared_ptr<Builder::INodeConverter>> convertors = {
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Abs>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Acos>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::v1::Add>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Asin>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Atan>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::v1::AvgPool>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::Clamp>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Concat>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::Constant>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::ConvolutionIE>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::DeconvolutionIE>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Cos>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Cosh>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::CropIE>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::Convert>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::CTCGreedyDecoder>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::DetectionOutput>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::v1::DeformableConvolution>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::v1::DeformablePSROIPooling>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::v1::Divide>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::v1::Reshape>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::Eltwise>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::Elu>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Erf>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Exp>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::FakeQuantize>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Floor>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::Ceiling>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::GatherIE>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::GatherTreeIE>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::Interp>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::v0::Interpolate>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Log>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::LRN_IE>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::MVN>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::FullyConnected>>(),
@@ -766,9 +868,7 @@ void convertFunctionToICNNNetwork(const std::shared_ptr<const ::ngraph::Function
                 std::make_shared<Builder::NodeConverter<::ngraph::op::GenericIE>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::GRN>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::v1::MaxPool>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::v1::Maximum>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::v1::Minimum>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::v1::Multiply>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::NormalizeIE>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::OneHotIE>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::PRelu>>(),
@@ -781,7 +881,6 @@ void convertFunctionToICNNNetwork(const std::shared_ptr<const ::ngraph::Function
                 std::make_shared<Builder::NodeConverter<::ngraph::op::Relu>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::SeluIE>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::ReLUIE>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Range>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::ReverseSequence>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::ResampleV2>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::RegionYolo>>(),
@@ -789,29 +888,16 @@ void convertFunctionToICNNNetwork(const std::shared_ptr<const ::ngraph::Function
                 std::make_shared<Builder::NodeConverter<::ngraph::op::ROIPooling>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::PSROIPooling>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::ScaleShiftIE>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::ShapeOf>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Sigmoid>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Sin>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Sign>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Sinh>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::SquaredDifference>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::v1::Softmax>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::v1::Split>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::VariadicSplit>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::v1::StridedSlice>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Squeeze>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Sqrt>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::Subtract>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Tan>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::Tanh>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::TileIE>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::v1::TopK>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::TopKIE>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::Unsqueeze>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::TensorIterator>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::opset5::Loop>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::HardSigmoid_IE>>(),
-                std::make_shared<Builder::NodeConverter<::ngraph::op::v1::LogicalNot>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::ShuffleChannels>>(),
                 std::make_shared<Builder::NodeConverter<::ngraph::op::v4::Interpolate>>(),
                 std::make_shared<Builder::NodeConverter<::ExecGraphInfoSerialization::ExecutionNode>>(),
index e846c64..4fc0dd6 100644 (file)
@@ -10,7 +10,6 @@
 
 #include "legacy/ngraph_ops/crop_ie.hpp"
 #include "ngraph_ops/convolution_ie.hpp"
-#include "ngraph_ops/deconvolution_ie.hpp"
 #include "legacy/ngraph_ops/eltwise.hpp"
 #include "legacy/ngraph_ops/fully_connected.hpp"
 #include "legacy/ngraph_ops/gather_ie.hpp"
@@ -32,7 +31,6 @@
 #include "legacy/ngraph_ops/selu_ie.hpp"
 #include "legacy/ngraph_ops/scaleshift.hpp"
 #include "legacy/ngraph_ops/tile_ie.hpp"
-#include "legacy/ngraph_ops/topk_ie.hpp"
 #include "legacy/ngraph_ops/rnn_cell_ie.hpp"
 #include "legacy/ngraph_ops/hard_sigmoid_ie.hpp"
 #include "generic_ie.hpp"
@@ -789,74 +787,6 @@ CNNLayer::Ptr NodeConverter<ngraph::op::ConvolutionIE>::createLayer(
 }
 
 template <>
-CNNLayer::Ptr NodeConverter<ngraph::op::DeconvolutionIE>::createLayer(
-        const std::shared_ptr<ngraph::Node>& layer) const {
-    LayerParams params = {layer->get_friendly_name(), "Deconvolution",
-                          details::convertPrecision(layer->get_output_element_type(0))};
-    auto res = std::make_shared<InferenceEngine::DeconvolutionLayer>(params);
-    auto castedLayer = ngraph::as_type_ptr<ngraph::op::DeconvolutionIE>(layer);
-    if (castedLayer == nullptr) THROW_IE_EXCEPTION << "Cannot get " << params.type << " layer " << params.name;
-
-    std::string value;
-    for (const auto& val : castedLayer->get_pads_begin()) {
-        if (!value.empty()) value += ",";
-        value += asString(val);
-    }
-    res->params["pads_begin"] = value;
-
-    value.clear();
-    for (const auto& val : castedLayer->get_pads_end()) {
-        if (!value.empty()) value += ",";
-        value += asString(val);
-    }
-    res->params["pads_end"] = value;
-
-    value.clear();
-    for (const auto& val : castedLayer->get_strides()) {
-        if (!value.empty()) value += ",";
-        value += asString(val);
-    }
-    res->params["strides"] = value;
-
-    value.clear();
-    for (const auto& val : castedLayer->get_dilations()) {
-        if (!value.empty()) value += ",";
-        value += asString(val);
-    }
-    res->params["dilations"] = value;
-
-    // Restore kernel size and output
-    const auto& shape = castedLayer->get_input_shape(1);
-    res->params["output"] = asString(shape[1]);
-
-    value.clear();
-    for (size_t i = 2; i < shape.size(); i++) {
-        if (!value.empty()) value += ",";
-        value += asString(shape[i]);
-    }
-    res->params["kernel"] = value;
-    res->params["group"] = asString(castedLayer->get_group());
-
-    NodeConverter<ngraph::op::Constant> converter;
-    const auto weightsNode = castedLayer->input_value(1).get_node_shared_ptr();
-    if (converter.canCreate(weightsNode)) {
-        const auto& weights = converter.createLayer(weightsNode);
-        res->blobs["weights"] = weights->blobs["custom"];
-        res->_weights = weights->blobs["custom"];
-
-        if (castedLayer->inputs().size() == 3) {
-            const auto biasNode = castedLayer->input_value(2).get_node_shared_ptr();
-            if (converter.canCreate(biasNode)) {
-                const auto& bias = converter.createLayer(biasNode);
-                res->blobs["biases"] = bias->blobs["custom"];
-                res->_biases = bias->blobs["custom"];
-            }
-        }
-    }
-    return res;
-}
-
-template <>
 CNNLayer::Ptr NodeConverter<ngraph::op::v1::DeformableConvolution>::createLayer(
         const std::shared_ptr<ngraph::Node>& layer) const {
     LayerParams params = {layer->get_friendly_name(), "DeformableConvolution",
@@ -1385,43 +1315,6 @@ CNNLayer::Ptr NodeConverter<ngraph::op::ShuffleChannels>::createLayer(const std:
 }
 
 template <>
-CNNLayer::Ptr NodeConverter<ngraph::op::DetectionOutput>::createLayer(
-    const std::shared_ptr<ngraph::Node>& layer) const {
-    LayerParams params = {layer->get_friendly_name(), "DetectionOutput",
-                          details::convertPrecision(layer->get_output_element_type(0))};
-    auto res = std::make_shared<InferenceEngine::CNNLayer>(params);
-
-    auto castedLayer = ngraph::as_type_ptr<ngraph::op::DetectionOutput>(layer);
-    if (castedLayer == nullptr) THROW_IE_EXCEPTION << "Cannot get " << params.type << " layer " << params.name;
-
-    auto attr = castedLayer->get_attrs();
-    std::string param;
-
-    res->params["num_classes"] = asString(attr.num_classes);
-    res->params["background_label_id"] = asString(attr.background_label_id);
-    res->params["top_k"] = asString(attr.top_k);
-    res->params["variance_encoded_in_target"] = (attr.variance_encoded_in_target ? "1" : "0");
-    for (const auto& val : attr.keep_top_k) {
-        if (!param.empty()) param += ",";
-        param += asString(val);
-    }
-    res->params["keep_top_k"] = param;
-    res->params["code_type"] = attr.code_type;
-    res->params["share_location"] = (attr.share_location ? "1" : "0");
-    res->params["nms_threshold"] = asString(attr.nms_threshold);
-    res->params["confidence_threshold"] = asString(attr.confidence_threshold);
-    res->params["clip_after_nms"] = (attr.clip_after_nms ? "1" : "0");
-    res->params["clip_before_nms"] = (attr.clip_before_nms ? "1" : "0");
-    res->params["decrease_label_id"] = (attr.decrease_label_id ? "1" : "0");
-    res->params["normalized"] = (attr.normalized ? "1" : "0");
-    res->params["input_height"] = asString(attr.input_height);
-    res->params["input_width"] = asString(attr.input_width);
-    res->params["objectness_score"] = asString(attr.objectness_score);
-
-    return res;
-}
-
-template <>
 CNNLayer::Ptr NodeConverter<ngraph::op::ProposalIE>::createLayer(const std::shared_ptr<ngraph::Node>& layer) const {
     LayerParams params = {layer->get_friendly_name(), "Proposal",
                           details::convertPrecision(layer->get_output_element_type(0))};
@@ -1595,36 +1488,6 @@ CNNLayer::Ptr NodeConverter<ngraph::op::PowerIE>::createLayer(const std::shared_
 }
 
 template <>
-CNNLayer::Ptr NodeConverter<ngraph::op::v1::TopK>::createLayer(const std::shared_ptr<ngraph::Node>& layer) const {
-    LayerParams params = {layer->get_friendly_name(), "TopK",
-                          details::convertPrecision(layer->get_output_element_type(0))};
-    auto res = std::make_shared<InferenceEngine::TopKLayer>(params);
-    auto castedLayer = ngraph::as_type_ptr<ngraph::op::v1::TopK>(layer);
-    if (castedLayer == nullptr) THROW_IE_EXCEPTION << "Cannot get " << params.type << " layer " << params.name;
-
-    res->params["mode"] = ngraph::as_string<ngraph::op::v1::TopK::Mode>(castedLayer->get_mode());;
-    res->params["sort"] = ngraph::as_string<ngraph::op::v1::TopK::SortType>(castedLayer->get_sort_type());
-    res->params["axis"] = asString(castedLayer->get_axis());
-
-    return res;
-}
-
-template <>
-CNNLayer::Ptr NodeConverter<ngraph::op::TopKIE>::createLayer(const std::shared_ptr<ngraph::Node>& layer) const {
-    LayerParams params = {layer->get_friendly_name(), "TopK",
-                          details::convertPrecision(layer->get_output_element_type(0))};
-    auto res = std::make_shared<InferenceEngine::TopKLayer>(params);
-    auto castedLayer = ngraph::as_type_ptr<ngraph::op::TopKIE>(layer);
-    if (castedLayer == nullptr) THROW_IE_EXCEPTION << "Cannot get " << params.type << " layer " << params.name;
-
-    res->params["mode"] = ngraph::as_string<ngraph::op::v1::TopK::Mode>(castedLayer->get_mode());;
-    res->params["sort"] = ngraph::as_string<ngraph::op::v1::TopK::SortType>(castedLayer->get_sort_type());
-    res->params["axis"] = asString(castedLayer->get_axis());
-
-    return res;
-}
-
-template <>
 CNNLayer::Ptr NodeConverter<ngraph::op::Eltwise>::createLayer(const std::shared_ptr<ngraph::Node>& layer) const {
     LayerParams params = {layer->get_friendly_name(), "Eltwise",
                           details::convertPrecision(layer->get_output_element_type(0))};
@@ -2115,55 +1978,6 @@ CNNLayer::Ptr NodeConverter<ngraph::op::Sqrt>::createLayer(const std::shared_ptr
 }
 
 template <>
-CNNLayer::Ptr NodeConverter<ngraph::op::v1::StridedSlice>::createLayer(
-        const std::shared_ptr<ngraph::Node>& layer) const {
-    LayerParams params = {layer->get_friendly_name(), "StridedSlice",
-                          details::convertPrecision(layer->get_output_element_type(0))};
-    auto res = std::make_shared<InferenceEngine::StridedSliceLayer>(params);
-    auto castedLayer = std::dynamic_pointer_cast<ngraph::op::v1::StridedSlice>(layer);
-    if (castedLayer == nullptr) THROW_IE_EXCEPTION << "Cannot get " << params.type << " layer " << params.name;
-
-    std::string value;
-    for (const auto& val : castedLayer->get_begin_mask()) {
-        if (!value.empty()) value += ",";
-        // plugins require reverse value of this mask.
-        value += asString((1-val));
-    }
-    res->params["begin_mask"] = value;
-
-    value.clear();
-    for (const auto& val : castedLayer->get_end_mask()) {
-        if (!value.empty()) value += ",";
-        // plugins require reverse value of this mask.
-        value += asString((1-val));
-    }
-    res->params["end_mask"] = value;
-
-    value.clear();
-    for (const auto& val : castedLayer->get_new_axis_mask()) {
-        if (!value.empty()) value += ",";
-        value += asString(val);
-    }
-    res->params["new_axis_mask"] = value;
-
-    value.clear();
-    for (const auto& val : castedLayer->get_shrink_axis_mask()) {
-        if (!value.empty()) value += ",";
-        value += asString(val);
-    }
-    res->params["shrink_axis_mask"] = value;
-
-    value.clear();
-    for (const auto& val : castedLayer->get_ellipsis_mask()) {
-        if (!value.empty()) value += ",";
-        value += asString(val);
-    }
-    res->params["ellipsis_mask"] = value;
-
-    return res;
-}
-
-template <>
 CNNLayer::Ptr NodeConverter<ngraph::op::OneHotIE>::createLayer(const std::shared_ptr<ngraph::Node>& layer) const {
     LayerParams params = {layer->get_friendly_name(), "OneHot", Precision::FP32};
 
@@ -2203,13 +2017,5 @@ CNNLayer::Ptr NodeConverter<ngraph::op::GRN>::createLayer(const std::shared_ptr<
     return res;
 }
 
-template <>
-CNNLayer::Ptr NodeConverter<ngraph::op::v1::LogicalNot>::createLayer(const std::shared_ptr<ngraph::Node>& layer) const {
-    LayerParams params = {layer->get_friendly_name(), "Activation", details::convertPrecision(layer->get_output_element_type(0))};
-    auto res = std::make_shared<InferenceEngine::CNNLayer>(params);
-    res->params["type"] = "not";
-    return res;
-}
-
 }  // namespace Builder
 }  // namespace InferenceEngine
index 11e9633..ee9757a 100644 (file)
@@ -939,11 +939,11 @@ void DetectionOutputValidator::parseParams(CNNLayer* layer) {
         int _background_label_id = layer->GetParamAsUInt("background_label_id", -1);
     if (layer->CheckParamPresence("top_k")) int _top_k = layer->GetParamAsUInt("top_k", -1);
     if (layer->CheckParamPresence("variance_encoded_in_target"))
-        bool _variance_encoded_in_target = static_cast<bool>(layer->GetParamAsUInt("variance_encoded_in_target"));
+        bool _variance_encoded_in_target = static_cast<bool>(layer->GetParamAsUInt("variance_encoded_in_target", 0));
     if (layer->CheckParamPresence("num_orient_classes"))
         int _num_orient_classes = layer->GetParamAsUInt("num_orient_classes");
     if (layer->CheckParamPresence("share_location"))
-        bool _share_location = static_cast<bool>(layer->GetParamAsUInt("share_location"));
+        bool _share_location = static_cast<bool>(layer->GetParamAsUInt("share_location", 1));
     if (layer->CheckParamPresence("interpolate_orientation"))
         int _interpolate_orientation = layer->GetParamAsInt("interpolate_orientation");
     if (layer->CheckParamPresence("confidence_threshold")) {
@@ -955,7 +955,11 @@ void DetectionOutputValidator::parseParams(CNNLayer* layer) {
 
     if (layer->CheckParamPresence("code_type")) {
         std::string _code_type = layer->GetParamAsString("code_type");
-        std::vector<std::string> code_types = {"caffe.PriorBoxParameter.CENTER_SIZE", "caffe.PriorBoxParameter.CORNER"};
+        for (auto& c: _code_type)
+        {
+            c = std::tolower(c);
+        }
+        std::vector<std::string> code_types = {"caffe.priorboxparameter.center_size", "caffe.priorboxparameter.corner"};
         auto it = std::find(code_types.begin(), code_types.end(), _code_type);
         if (it == code_types.end()) {
             THROW_IE_EXCEPTION << "Parameter code_type of DetectionOutput layer ";
index 59a6687..0a780d2 100644 (file)
@@ -53,4 +53,11 @@ void op::TopKIE::validate_and_infer_types() {
     set_output_size(2);
     set_output_type(0, topk->get_output_element_type(0), topk->get_output_partial_shape(0));
     set_output_type(1, topk->get_output_element_type(1), topk->get_output_partial_shape(1));
-}
\ No newline at end of file
+}
+
+bool op::TopKIE::visit_attributes(AttributeVisitor& visitor) {
+    visitor.on_attribute("axis", m_axis);
+    visitor.on_attribute("mode", m_mode);
+    visitor.on_attribute("sort", m_sort_type);
+    return true;
+}
index fd43522..5bc294a 100644 (file)
@@ -388,25 +388,13 @@ std::shared_ptr<ngraph::Node> V10Parser::createNode(const std::vector<ngraph::Ou
                                                     const pugi::xml_node& node, std::istream& binStream,
                                                     const GenericLayerParams& params) {
     static std::vector<std::shared_ptr<LayerBaseCreator>> creators = {
-        std::make_shared<LayerCreator<ngraph::op::Abs>>("Abs"),
-        std::make_shared<LayerCreator<ngraph::op::Acos>>("Acos"),
-        std::make_shared<LayerCreator<ngraph::op::v1::Add>>("Add"),
-        std::make_shared<LayerCreator<ngraph::op::Asin>>("Asin"),
-        std::make_shared<LayerCreator<ngraph::op::Atan>>("Atan"),
         std::make_shared<LayerCreator<ngraph::op::v1::AvgPool>>("AvgPool"),
-        std::make_shared<LayerCreator<ngraph::op::Ceiling>>("Ceiling"),
         std::make_shared<LayerCreator<ngraph::op::Clamp>>("Clamp"),
-        std::make_shared<LayerCreator<ngraph::op::Concat>>("Concat"),
         std::make_shared<LayerCreator<ngraph::op::Constant>>("Const"),
         std::make_shared<LayerCreator<ngraph::op::Convert>>("Convert"),
         std::make_shared<LayerCreator<ngraph::op::CTCGreedyDecoder>>("CTCGreedyDecoder"),
-        std::make_shared<LayerCreator<ngraph::op::ReverseSequence>>("ReverseSequence"),
-        std::make_shared<LayerCreator<ngraph::op::Cos>>("Cos"),
-        std::make_shared<LayerCreator<ngraph::op::Cosh>>("Cosh"),
-        std::make_shared<LayerCreator<ngraph::op::DetectionOutput>>("DetectionOutput"),
         std::make_shared<LayerCreator<ngraph::op::v1::DeformableConvolution>>("DeformableConvolution"),
         std::make_shared<LayerCreator<ngraph::op::v1::DeformablePSROIPooling>>("DeformablePSROIPooling"),
-        std::make_shared<LayerCreator<ngraph::op::v1::Divide>>("Divide"),
         std::make_shared<LayerCreator<ngraph::op::SpaceToDepth>>("SpaceToDepth"),
         std::make_shared<LayerCreator<ngraph::op::DepthToSpace>>("DepthToSpace"),
         std::make_shared<LayerCreator<ngraph::op::v1::Subtract>>("Subtract"),
@@ -415,13 +403,9 @@ std::shared_ptr<ngraph::Node> V10Parser::createNode(const std::vector<ngraph::Ou
         std::make_shared<LayerCreator<ngraph::op::v1::Reshape>>("Reshape"),
         std::make_shared<LayerCreator<ngraph::op::v1::StridedSlice>>("StridedSlice"),
         std::make_shared<LayerCreator<ngraph::op::Elu>>("ELU"),
-        std::make_shared<LayerCreator<ngraph::op::Exp>>("Exp"),
-        std::make_shared<LayerCreator<ngraph::op::Erf>>("Erf"),
         std::make_shared<LayerCreator<ngraph::op::FakeQuantize>>("FakeQuantize"),
-        std::make_shared<LayerCreator<ngraph::op::Floor>>("Floor"),
         std::make_shared<LayerCreator<ngraph::op::v1::Gather>>("Gather"),
         std::make_shared<LayerCreator<ngraph::op::v1::GatherTree>>("GatherTree"),
-        std::make_shared<LayerCreator<ngraph::op::v1::Greater>>("Greater"),
         std::make_shared<LayerCreator<ngraph::op::v1::GreaterEqual>>("GreaterEqual"),
         std::make_shared<LayerCreator<ngraph::op::v1::Convolution>>("Convolution"),
         std::make_shared<LayerCreator<ngraph::op::v1::GroupConvolution>>("GroupConvolution"),
@@ -430,22 +414,16 @@ std::shared_ptr<ngraph::Node> V10Parser::createNode(const std::vector<ngraph::Ou
         std::make_shared<LayerCreator<ngraph::op::v1::BinaryConvolution>>("BinaryConvolution"),
         std::make_shared<LayerCreator<ngraph::op::GRN>>("GRN"),
         std::make_shared<LayerCreator<ngraph::op::HardSigmoid>>("HardSigmoid"),
-        std::make_shared<LayerCreator<ngraph::op::Log>>("Log"),
         std::make_shared<LayerCreator<ngraph::op::SquaredDifference>>("SquaredDifference"),
-        std::make_shared<LayerCreator<ngraph::op::v1::Less>>("Less"),
         std::make_shared<LayerCreator<ngraph::op::v1::LessEqual>>("LessEqual"),
         std::make_shared<LayerCreator<ngraph::op::v1::Equal>>("Equal"),
         std::make_shared<LayerCreator<ngraph::op::v1::NotEqual>>("NotEqual"),
         std::make_shared<LayerCreator<ngraph::op::v1::FloorMod>>("FloorMod"),
-        std::make_shared<LayerCreator<ngraph::op::v1::Select>>("Select"),
         std::make_shared<LayerCreator<ngraph::op::LRN>>("LRN"),
         std::make_shared<LayerCreator<ngraph::op::MVN>>("MVN"),
         std::make_shared<LayerCreator<ngraph::op::v0::LSTMCell>>("LSTMCell"),
         std::make_shared<LayerCreator<ngraph::op::v1::MaxPool>>("MaxPool"),
-        std::make_shared<LayerCreator<ngraph::op::v1::Maximum>>("Maximum"),
         std::make_shared<LayerCreator<ngraph::op::v1::Minimum>>("Minimum"),
-        std::make_shared<LayerCreator<ngraph::op::v1::Multiply>>("Multiply"),
-        std::make_shared<LayerCreator<ngraph::op::Negative>>("Negative"),
         std::make_shared<LayerCreator<ngraph::op::v1::NonMaxSuppression>>("NonMaxSuppression"),
         std::make_shared<LayerCreator<ngraph::op::NormalizeL2>>("NormalizeL2"),
         std::make_shared<LayerCreator<ngraph::op::v1::OneHot>>("OneHot"),
@@ -453,7 +431,7 @@ std::shared_ptr<ngraph::Node> V10Parser::createNode(const std::vector<ngraph::Ou
         std::make_shared<LayerCreator<ngraph::op::Relu>>("ReLU"),
         std::make_shared<LayerCreator<ngraph::op::v1::Pad>>("Pad"),
         std::make_shared<LayerCreator<ngraph::op::v1::Power>>("Power"),
-        std::make_shared<LayerCreator<ngraph::op::Range>>("Range"),
+        std::make_shared<LayerCreator<ngraph::op::ReverseSequence>>("ReverseSequence"),
         std::make_shared<LayerCreator<ngraph::op::PriorBox>>("PriorBox"),
         std::make_shared<LayerCreator<ngraph::op::PriorBoxClustered>>("PriorBoxClustered"),
         std::make_shared<LayerCreator<ngraph::op::ReorgYolo>>("ReorgYolo"),
@@ -461,25 +439,14 @@ std::shared_ptr<ngraph::Node> V10Parser::createNode(const std::vector<ngraph::Ou
         std::make_shared<LayerCreator<ngraph::op::Result>>("Result"),
         std::make_shared<LayerCreator<ngraph::op::ROIPooling>>("ROIPooling"),
         std::make_shared<LayerCreator<ngraph::op::PSROIPooling>>("PSROIPooling"),
-        std::make_shared<LayerCreator<ngraph::op::ShapeOf>>("ShapeOf"),
         std::make_shared<LayerCreator<ngraph::op::v0::Selu>>("Selu"),
-        std::make_shared<LayerCreator<ngraph::op::Sigmoid>>("Sigmoid"),
-        std::make_shared<LayerCreator<ngraph::op::Sin>>("Sin"),
-        std::make_shared<LayerCreator<ngraph::op::Sign>>("Sign"),
-        std::make_shared<LayerCreator<ngraph::op::Sinh>>("Sinh"),
         std::make_shared<LayerCreator<ngraph::op::v1::Softmax>>("Softmax"),
         std::make_shared<LayerCreator<ngraph::op::v1::Split>>("Split"),
         std::make_shared<LayerCreator<ngraph::op::VariadicSplit>>("VariadicSplit"),
-        std::make_shared<LayerCreator<ngraph::op::Sqrt>>("Sqrt"),
-        std::make_shared<LayerCreator<ngraph::op::Squeeze>>("Squeeze"),
-        std::make_shared<LayerCreator<ngraph::op::Tan>>("Tan"),
         std::make_shared<LayerCreator<ngraph::op::Tanh>>("TanH"),
         std::make_shared<LayerCreator<ngraph::op::v0::Tile>>("Tile"),
-        std::make_shared<LayerCreator<ngraph::op::v1::TopK>>("TopK"),
         std::make_shared<LayerCreator<ngraph::op::TensorIterator>>("TensorIterator"),
         std::make_shared<LayerCreator<ngraph::opset5::Loop>>("Loop"),
-        std::make_shared<LayerCreator<ngraph::op::Transpose>>("Transpose"),
-        std::make_shared<LayerCreator<ngraph::op::Unsqueeze>>("Unsqueeze"),
         std::make_shared<LayerCreator<ngraph::op::v1::LogicalAnd>>("LogicalAnd"),
         std::make_shared<LayerCreator<ngraph::op::v1::LogicalOr>>("LogicalOr"),
         std::make_shared<LayerCreator<ngraph::op::v1::LogicalXor>>("LogicalXor"),
@@ -615,54 +582,6 @@ std::shared_ptr<ngraph::Node> V10Parser::createNode(const std::vector<ngraph::Ou
 namespace InferenceEngine {
 
 
-// DetectionOutput layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::DetectionOutput>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    pugi::xml_node dn = node.child("data");
-
-    if (dn.empty())
-        THROW_IE_EXCEPTION << "Cannot read parameter for " << getType() << " layer with name: " << layerParsePrms.name;
-
-    ngraph::op::DetectionOutputAttrs attr;
-
-    attr.num_classes = GetIntAttr(dn, "num_classes");
-    attr.background_label_id = GetIntAttr(dn, "background_label_id", 0);
-    attr.top_k = GetIntAttr(dn, "top_k", -1);
-    attr.variance_encoded_in_target = GetIntAttr(dn, "variance_encoded_in_target", 0) != 0;
-    attr.keep_top_k = getParameters<int>(dn, "keep_top_k", {});
-    attr.code_type = GetStrAttr(dn, "code_type", "caffe.PriorBoxParameter.CORNER");
-    attr.share_location = GetIntAttr(dn, "share_location", 1) != 0;
-    attr.clip_after_nms = GetIntAttr(dn, "clip_after_nms", 0) != 0;
-    attr.clip_before_nms = GetIntAttr(dn, "clip_before_nms", 0) != 0;
-    attr.decrease_label_id = GetIntAttr(dn, "decrease_label_id", 0) != 0;
-    attr.normalized = GetIntAttr(dn, "normalized", 0) != 0;
-    attr.input_height = GetUIntAttr(dn, "input_height", 1);
-    attr.input_width = GetUIntAttr(dn, "input_width", 1);
-    attr.objectness_score = GetFloatAttr(dn, "objectness_score", 0);
-    attr.nms_threshold = GetFloatAttr(dn, "nms_threshold");
-    attr.confidence_threshold = GetFloatAttr(dn, "confidence_threshold", 0);
-
-    if (inputs.size() != 3 && inputs.size() != 5) {
-        THROW_IE_EXCEPTION << "DetectionOutput has incorrect number of input ports!";
-    }
-
-    if (inputs.size() == 3) {
-        return std::make_shared<ngraph::op::DetectionOutput>(inputs[0],
-                                                             inputs[1],
-                                                             inputs[2],
-                                                             attr);
-    } else {
-        return std::make_shared<ngraph::op::DetectionOutput>(inputs[0],
-                                                             inputs[1],
-                                                             inputs[2],
-                                                             inputs[3],
-                                                             inputs[4],
-                                                             attr);
-    }
-}
-
 // SubGraph layer
 std::shared_ptr<ngraph::Node>
 V10Parser::LayerBaseCreator::fillSubGraphLayer(const ngraph::OutputVector &inputs, const pugi::xml_node &node,
@@ -911,15 +830,6 @@ std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::PriorBox>::cre
     return std::make_shared<ngraph::op::PriorBox>(inputs[0], inputs[1], attr);
 }
 
-// ShapeOf layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::ShapeOf>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 1);
-    return std::make_shared<ngraph::op::ShapeOf>(inputs[0]);
-}
-
 // FakeQuantize layer
 template <>
 std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::FakeQuantize>::createLayer(
@@ -991,43 +901,6 @@ std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::CTCGreedyDecod
                                                           GetBoolAttr(dn, "ctc_merge_repeated", true));
 }
 
-// TopK layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::TopK>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 2);
-    pugi::xml_node dn = node.child("data");
-    if (dn.empty())
-        THROW_IE_EXCEPTION << "Cannot read parameter for " << getType() << " layer with name: " << layerParsePrms.name;
-
-    size_t axis = GetUInt64Attr(dn, "axis");
-    std::string str_mode = GetStrAttr(dn, "mode");
-    std::string str_sort = GetStrAttr(dn, "sort");
-
-    ngraph::op::v1::TopK::Mode mode;
-    ngraph::op::v1::TopK::SortType sort;
-    if (str_mode == "max") {
-        mode = ngraph::op::v1::TopK::Mode::MAX;
-    } else if (str_mode == "min") {
-        mode = ngraph::op::v1::TopK::Mode::MIN;
-    } else {
-        THROW_IE_EXCEPTION << "Unsupported mode: " << str_mode;
-    }
-
-    if (str_sort == "none") {
-        sort = ngraph::op::v1::TopK::SortType::NONE;
-    } else if (str_sort == "value") {
-        sort = ngraph::op::v1::TopK::SortType::SORT_VALUES;
-    } else if (str_sort == "index") {
-        sort = ngraph::op::v1::TopK::SortType::SORT_INDICES;
-    } else {
-        THROW_IE_EXCEPTION << "Unsupported sort type: " << str_sort;
-    }
-
-    return std::make_shared<ngraph::op::v1::TopK>(inputs[0], inputs[1], axis, mode, sort);
-}
-
 // Pad layer
 template <>
 std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Pad>::createLayer(
@@ -1074,15 +947,6 @@ std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::SquaredDiffere
     return std::make_shared<ngraph::op::SquaredDifference>(inputs[0], inputs[1]);
 }
 
-// Greater layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Greater>::createLayer(
-        const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-        const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 2);
-    return std::make_shared<ngraph::op::v1::Greater>(inputs[0], inputs[1]);
-}
-
 // GreaterEqual layer
 template <>
 std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::GreaterEqual>::createLayer(
@@ -1092,15 +956,6 @@ std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::GreaterEqu
     return std::make_shared<ngraph::op::v1::GreaterEqual>(inputs[0], inputs[1]);
 }
 
-// Less layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Less>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 2);
-    return std::make_shared<ngraph::op::v1::Less>(inputs[0], inputs[1]);
-}
-
 // LessEqual layer
 template <>
 std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::LessEqual>::createLayer(
@@ -1137,15 +992,6 @@ std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::FloorMod>:
     return std::make_shared<ngraph::op::v1::FloorMod>(inputs[0], inputs[1]);
 }
 
-// Select layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Select>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 3);
-    return std::make_shared<ngraph::op::v1::Select>(inputs[0], inputs[1], inputs[2]);
-}
-
 // MVN layer
 template <>
 std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::MVN>::createLayer(
@@ -1163,15 +1009,6 @@ std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::MVN>::createLa
     return std::make_shared<ngraph::op::MVN>(inputs[0], across, normalize_variance, eps);
 }
 
-// Log layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Log>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 1);
-    return std::make_shared<ngraph::op::Log>(inputs[0]);
-}
-
 // LRN layer
 template <>
 std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::LRN>::createLayer(
@@ -1230,15 +1067,6 @@ std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Split>::cr
     return std::make_shared<ngraph::op::v1::Split>(inputs[0], inputs[1], num_splits);
 }
 
-// Sigmoid layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Sigmoid>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 1);
-    return std::make_shared<ngraph::op::Sigmoid>(inputs[0]);
-}
-
 // ELU layer
 template <>
 std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Elu>::createLayer(
@@ -1299,15 +1127,6 @@ std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::PRelu>::create
     return std::make_shared<ngraph::op::PRelu>(inputs[0], inputs[1]);
 }
 
-// Exp layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Exp>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 1);
-    return std::make_shared<ngraph::op::Exp>(inputs[0]);
-}
-
 // ReLU layer
 template <>
 std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Relu>::createLayer(
@@ -1317,24 +1136,6 @@ std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Relu>::createL
     return std::make_shared<ngraph::op::Relu>(inputs[0]);
 }
 
-// Negative layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Negative>::createLayer(
-        const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-        const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 1);
-    return std::make_shared<ngraph::op::Negative>(inputs[0]);
-}
-
-// Range layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Range>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 3);
-    return std::make_shared<ngraph::op::Range>(inputs[0], inputs[1], inputs[2]);
-}
-
 // Tanh layer
 template <>
 std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Tanh>::createLayer(
@@ -1401,42 +1202,6 @@ std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Reshape>::
     return std::make_shared<ngraph::op::v1::Reshape>(inputs[0], inputs[1], GetBoolAttr(dn, "special_zero"));
 }
 
-// Squeeze layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Squeeze>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 2);
-    return std::make_shared<ngraph::op::Squeeze>(inputs[0], inputs[1]);
-}
-
-// Unsqueeze layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Unsqueeze>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 2);
-    return std::make_shared<ngraph::op::Unsqueeze>(inputs[0], inputs[1]);
-}
-
-// Abs layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Abs>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 1);
-    return std::make_shared<ngraph::op::Abs>(inputs[0]);
-}
-
-// Add layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Add>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 2);
-    return std::make_shared<ngraph::op::v1::Add>(inputs[0], inputs[1]);
-}
-
 // Minimum layer
 template <>
 std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Minimum>::createLayer(
@@ -1446,24 +1211,6 @@ std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Minimum>::
     return std::make_shared<ngraph::op::v1::Minimum>(inputs[0], inputs[1]);
 }
 
-// Maximum layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Maximum>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 2);
-    return std::make_shared<ngraph::op::v1::Maximum>(inputs[0], inputs[1]);
-}
-
-// Divide layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Divide>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 2);
-    return std::make_shared<ngraph::op::v1::Divide>(inputs[0], inputs[1]);
-}
-
 // Subtract layer
 template <>
 std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Subtract>::createLayer(
@@ -1473,15 +1220,6 @@ std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Subtract>:
     return std::make_shared<ngraph::op::v1::Subtract>(inputs[0], inputs[1]);
 }
 
-// Multiply layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Multiply>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 2);
-    return std::make_shared<ngraph::op::v1::Multiply>(inputs[0], inputs[1]);
-}
-
 // Broadcast layer
 template <>
 std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Broadcast>::createLayer(
@@ -1568,15 +1306,6 @@ std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Softmax>::
     return std::make_shared<ngraph::op::v1::Softmax>(inputs[0], GetUIntAttr(dn, "axis"));
 }
 
-// Sqrt layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Sqrt>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 1);
-    return std::make_shared<ngraph::op::Sqrt>(inputs[0]);
-}
-
 // RegionYolo layer
 template <>
 std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::RegionYolo>::createLayer(
@@ -1616,15 +1345,6 @@ std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::ReorgYolo>::cr
     return std::make_shared<ngraph::op::ReorgYolo>(inputs[0], ngraph::Strides {stride});
 }
 
-// Transpose layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Transpose>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 2);
-    return std::make_shared<ngraph::op::Transpose>(inputs[0], inputs[1]);
-}
-
 // BinaryConvolution layer
 template <>
 std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::BinaryConvolution>::createLayer(
@@ -1989,20 +1709,6 @@ std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Deformable
     }
 }
 
-// Concat layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Concat>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, -1);
-    pugi::xml_node dn = node.child("data");
-
-    if (dn.empty())
-        THROW_IE_EXCEPTION << "Cannot read parameter for " << getType() << " layer with name: " << layerParsePrms.name;
-
-    return std::make_shared<ngraph::op::Concat>(inputs, GetUIntAttr(dn, "axis"));
-}
-
 // Gather layer
 template <>
 std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Gather>::createLayer(
@@ -2060,114 +1766,6 @@ std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::NormalizeL2>::
     return std::make_shared<ngraph::op::NormalizeL2>(inputs[0], inputs[1], eps, em);
 }
 
-// Erf layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Erf>::createLayer(
-        const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-        const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 1);
-    return std::make_shared<ngraph::op::Erf>(inputs[0]);
-}
-
-// Sin layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Sin>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 1);
-    return std::make_shared<ngraph::op::Sin>(inputs[0]);
-}
-
-// Sign layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Sign>::createLayer(
-        const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-        const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 1);
-    return std::make_shared<ngraph::op::Sign>(inputs[0]);
-}
-
-// Sinh layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Sinh>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 1);
-    return std::make_shared<ngraph::op::Sinh>(inputs[0]);
-}
-
-// Asin layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Asin>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 1);
-    return std::make_shared<ngraph::op::Asin>(inputs[0]);
-}
-
-// Cos layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Cos>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 1);
-    return std::make_shared<ngraph::op::Cos>(inputs[0]);
-}
-
-// Cosh layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Cosh>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 1);
-    return std::make_shared<ngraph::op::Cosh>(inputs[0]);
-}
-
-// Acos layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Acos>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 1);
-    return std::make_shared<ngraph::op::Acos>(inputs[0]);
-}
-
-// Tan layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Tan>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 1);
-    return std::make_shared<ngraph::op::Tan>(inputs[0]);
-}
-
-// Atan layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Atan>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 1);
-    return std::make_shared<ngraph::op::Atan>(inputs[0]);
-}
-
-// Floor layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Floor>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 1);
-    return std::make_shared<ngraph::op::Floor>(inputs[0]);
-}
-
-// Ceiling layer
-template <>
-std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Ceiling>::createLayer(
-    const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
-    const GenericLayerParams& layerParsePrms) {
-    checkParameters(inputs, layerParsePrms, 1);
-    return std::make_shared<ngraph::op::Ceiling>(inputs[0]);
-}
-
 // HardSigmoid layer
 template <>
 std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::HardSigmoid>::createLayer(
index c515cc6..2e6f5e4 100644 (file)
@@ -265,6 +265,12 @@ private:
             adapter.set(value);
         }
 
+        void on_adapter(const std::string& name, ngraph::ValueAccessor<std::vector<int32_t>>& adapter) override {
+            std::vector<int32_t> value;
+            if (!getParameters<int32_t>(node.child("data"), name, value)) return;
+            adapter.set(value);
+        }
+
         void on_adapter(const std::string& name, ngraph::ValueAccessor<std::vector<float>>& adapter) override {
             std::vector<float> value;
             if (!getParameters<float>(node.child("data"), name, value)) return;
index fb43b5b..f27d976 100644 (file)
@@ -68,6 +68,7 @@ public:
     /// \return The group
     const size_t& get_group() const { return m_group; }
     void set_group(const size_t & group) { m_group = group; }
+    bool visit_attributes(AttributeVisitor& visitor) override;
 
 protected:
     Strides m_strides;
index e55998f..2cdf140 100644 (file)
@@ -116,3 +116,12 @@ shared_ptr<Node> op::DeconvolutionIE::clone_with_new_inputs(const ngraph::Output
     }
     throw ngraph::ngraph_error("Unexpected number of arguments");
 }
+
+bool op::DeconvolutionIE::visit_attributes(AttributeVisitor& visitor) {
+        visitor.on_attribute("strides", m_strides);
+        visitor.on_attribute("dilations", m_dilations);
+        visitor.on_attribute("pads_begin", m_pads_begin);
+        visitor.on_attribute("pads_end", m_pads_end);
+        visitor.on_attribute("group", m_group);
+        return true;
+}
index b21e946..372c169 100644 (file)
@@ -82,7 +82,6 @@ TEST(ConvertFunctionToCNNNetworkTests, OpsShouldBeConvertedToIERepresentation) {
     ngraph::NodeVector should_converted_to_ie = {
             std::make_shared<ngraph::opset4::Broadcast>(),
             std::make_shared<ngraph::opset4::Convolution>(),
-            std::make_shared<ngraph::opset4::ConvolutionBackpropData>(),
             std::make_shared<ngraph::opset4::Gather>(),
             std::make_shared<ngraph::opset4::GatherTree>(),
             std::make_shared<ngraph::opset4::GroupConvolution>(),
@@ -105,7 +104,6 @@ TEST(ConvertFunctionToCNNNetworkTests, OpsShouldBeConvertedToIERepresentation) {
             std::make_shared<ngraph::opset4::Selu>(),
             std::make_shared<ngraph::opset4::Swish>(),
             std::make_shared<ngraph::opset4::Tile>(),
-            std::make_shared<ngraph::opset4::TopK>(),
     };
 
     // create simple ngraph function Parameter -> Result
index ee9a9fc..8dc5ca0 100644 (file)
@@ -106,7 +106,7 @@ op::v1::StridedSlice::StridedSlice(const Output<Node>& data,
 {
 }
 
-bool ngraph::op::v1::StridedSlice::visit_attributes(AttributeVisitor& visitor)
+bool op::v1::StridedSlice::visit_attributes(AttributeVisitor& visitor)
 {
     visitor.on_attribute("begin_mask", m_begin_mask);
     visitor.on_attribute("end_mask", m_end_mask);