diff --git a/inference-engine/src/legacy_api/include/legacy/convert_function_to_cnn_network.hpp b/inference-engine/src/legacy_api/include/legacy/convert_function_to_cnn_network.hpp index 8f75de6b775..92193a27583 100644 --- a/inference-engine/src/legacy_api/include/legacy/convert_function_to_cnn_network.hpp +++ b/inference-engine/src/legacy_api/include/legacy/convert_function_to_cnn_network.hpp @@ -11,6 +11,9 @@ #include #include +#include +#include "blob_factory.hpp" +#include namespace InferenceEngine { namespace details { @@ -25,6 +28,74 @@ convertFunctionToICNNNetwork(const std::shared_ptr& gr CNNNetworkImpl* cnnNetworkImpl, bool keep_constant_inputs = false); +// TODO: move ConstAllocatorWrapper class, shareWeights add addBlob into CNNLayerCreator when NodeConverter class is removed +class ConstAllocatorWrapper : public IAllocator { +public: + explicit ConstAllocatorWrapper(std::shared_ptr constOp): _constOp(std::move(constOp)) {} + + void Release() noexcept override { + delete this; + } + + void* lock(void* handle, LockOp) noexcept override { + return handle; + } + + void unlock(void*) noexcept override {} // NOLINT + + void* alloc(size_t) noexcept override { + return const_cast(_constOp->get_data_ptr()); + } + + bool free(void*) noexcept override { // NOLINT + return true; + } + +private: + std::shared_ptr _constOp; +}; + +enum BlobType { + weights, + biases }; + +inline Blob::Ptr shareWeights(const std::shared_ptr& constLayer) { + if (!constLayer) THROW_IE_EXCEPTION << "Cannot share weights! Constant operation is empty!"; + auto dataPrecision = convertPrecision(constLayer->get_element_type()); + + size_t shapeSize = ngraph::shape_size(constLayer->get_shape()); + constexpr size_t byte_size{8}; + if (dataPrecision == Precision::BIN) { + shapeSize = (shapeSize + (byte_size - 1)) / byte_size; + } + + TensorDesc td(dataPrecision, {shapeSize}, Layout::C); + + auto blob = make_blob_with_precision(td, std::make_shared(constLayer)); + blob->allocate(); + + return blob; +} + +template +bool addBlob(const std::shared_ptr& weightsNode, std::shared_ptr& res, BlobType type) { + auto constWeights = ngraph::as_type_ptr(weightsNode); + if (constWeights) { + Blob::Ptr dataBlob = shareWeights(constWeights); + if (type == weights) { + res->blobs["weights"] = dataBlob; + res->_weights = dataBlob; + } else if (type == biases) { + res->blobs["biases"] = dataBlob; + res->_biases = dataBlob; + } else { + return false; + } + return true; + } else { + return false; + } +} } // namespace details } // namespace InferenceEngine diff --git a/inference-engine/src/legacy_api/src/convert_function_to_cnn_network.cpp b/inference-engine/src/legacy_api/src/convert_function_to_cnn_network.cpp index 5084b537815..30934ac08d8 100644 --- a/inference-engine/src/legacy_api/src/convert_function_to_cnn_network.cpp +++ b/inference-engine/src/legacy_api/src/convert_function_to_cnn_network.cpp @@ -132,6 +132,13 @@ public: void on_adapter(const std::string& name, ::ngraph::ValueAccessor& adapter) override; + void on_adapter(const std::string& name, ::ngraph::ValueAccessor& adapter) override { + if (std::string(node->get_type_name()) != "Constant") { + const auto data_beg = static_cast(adapter.get_ptr()); + params[name] = std::string(data_beg, adapter.size()); + } + } + private: std::shared_ptr<::ngraph::Node> node; std::map params; @@ -353,14 +360,9 @@ InferenceEngine::details::CNNLayerCreator::CNNLayerCreator(const std::shared_ptr res->params["input"] = Builder::asString(weights_shape[1]); res->params["pad_value"] = Builder::asString(castedLayer->get_pad_value()); - Builder::NodeConverter<::ngraph::op::Constant> converter; - const auto weightsNode = castedLayer->input(1).get_source_output().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"]; - } + InferenceEngine::details::addBlob(weightsNode, res, InferenceEngine::details::weights); + return res; }); @@ -439,20 +441,11 @@ InferenceEngine::details::CNNLayerCreator::CNNLayerCreator(const std::shared_ptr } res->params["kernel"] = kernel_value; - Builder::NodeConverter 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"]; - + const auto weightsNode = node->input_value(1).get_node_shared_ptr(); + if (InferenceEngine::details::addBlob(weightsNode, res, InferenceEngine::details::weights)) { 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"]; - } + InferenceEngine::details::addBlob(biasNode, res, InferenceEngine::details::biases); } } return res; @@ -504,20 +497,12 @@ InferenceEngine::details::CNNLayerCreator::CNNLayerCreator(const std::shared_ptr details::convertPrecision(node->get_output_element_type(0))}; auto res = std::make_shared(attrs); res->params = params; - Builder::NodeConverter converter; const auto weightsNode = node->input_value(3).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"]; - } + InferenceEngine::details::addBlob(weightsNode, res, InferenceEngine::details::weights); const auto biasNode = node->input_value(4).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"]; - } + InferenceEngine::details::addBlob(biasNode, res, InferenceEngine::details::biases); + return res; }); @@ -528,20 +513,12 @@ InferenceEngine::details::CNNLayerCreator::CNNLayerCreator(const std::shared_ptr auto res = std::make_shared(attrs); res->params = params; - Builder::NodeConverter converter; const auto weightsNode = node->input_value(2).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"]; - } + InferenceEngine::details::addBlob(weightsNode, res, InferenceEngine::details::weights); const auto biasNode = node->input_value(3).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"]; - } + InferenceEngine::details::addBlob(biasNode, res, InferenceEngine::details::biases); + return res; }); @@ -552,20 +529,12 @@ InferenceEngine::details::CNNLayerCreator::CNNLayerCreator(const std::shared_ptr auto res = std::make_shared(attrs); res->params = params; - Builder::NodeConverter converter; const auto weightsNode = node->input_value(2).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"]; - } + InferenceEngine::details::addBlob(weightsNode, res, InferenceEngine::details::weights); const auto biasNode = node->input_value(3).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"]; - } + InferenceEngine::details::addBlob(biasNode, res, InferenceEngine::details::biases); + return res; }); @@ -758,20 +727,12 @@ InferenceEngine::details::CNNLayerCreator::CNNLayerCreator(const std::shared_ptr res->cellType = RNNSequenceLayer::CellType::GRU_LBR; } - Builder::NodeConverter converter; const auto weightsNode = node->input_value(3).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"]; - } + InferenceEngine::details::addBlob(weightsNode, res, InferenceEngine::details::weights); const auto biasNode = node->input_value(4).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"]; - } + InferenceEngine::details::addBlob(biasNode, res, InferenceEngine::details::biases); + return res; }); @@ -792,20 +753,12 @@ InferenceEngine::details::CNNLayerCreator::CNNLayerCreator(const std::shared_ptr else res->params["direction"] = "Bidirectional"; - Builder::NodeConverter converter; const auto weightsNode = node->input_value(3).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"]; - } + InferenceEngine::details::addBlob(weightsNode, res, InferenceEngine::details::weights); const auto biasNode = node->input_value(4).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"]; - } + InferenceEngine::details::addBlob(biasNode, res, InferenceEngine::details::biases); + return res; }); @@ -826,20 +779,12 @@ InferenceEngine::details::CNNLayerCreator::CNNLayerCreator(const std::shared_ptr else res->params["direction"] = "Bidirectional"; - Builder::NodeConverter converter; const auto weightsNode = node->input_value(4).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"]; - } + InferenceEngine::details::addBlob(weightsNode, res, InferenceEngine::details::weights); const auto biasNode = node->input_value(5).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"]; - } + InferenceEngine::details::addBlob(biasNode, res, InferenceEngine::details::biases); + return res; }); @@ -893,6 +838,17 @@ InferenceEngine::details::CNNLayerCreator::CNNLayerCreator(const std::shared_ptr res->params["keep_dims"] = reduce_node->get_keep_dims() ? "True" : "False"; return res; }); + + addSpecificCreator({"Constant"}, [](const std::shared_ptr<::ngraph::Node>& node, const std::map& params) -> CNNLayerPtr { + LayerParams attrs = {node->get_friendly_name(), "Const", details::convertPrecision(node->get_output_element_type(0))}; + auto res = std::make_shared(attrs); + auto castedLayer = ngraph::as_type_ptr(node); + if (!res) THROW_IE_EXCEPTION << "Cannot get " << attrs.type << " layer " << attrs.name; + + res->blobs["custom"] = InferenceEngine::details::shareWeights(castedLayer); + + return res; + }); } CNNLayerPtr InferenceEngine::details::CNNLayerCreator::create() { @@ -922,7 +878,6 @@ void convertFunctionToICNNNetwork(const std::shared_ptr> convertors = { std::make_shared>(), std::make_shared>(), - std::make_shared>(), std::make_shared>(), std::make_shared>(), std::make_shared>(), diff --git a/inference-engine/src/legacy_api/src/ie_cnn_layer_builder_ngraph.cpp b/inference-engine/src/legacy_api/src/ie_cnn_layer_builder_ngraph.cpp index 9f1f95190f1..fb97e194024 100644 --- a/inference-engine/src/legacy_api/src/ie_cnn_layer_builder_ngraph.cpp +++ b/inference-engine/src/legacy_api/src/ie_cnn_layer_builder_ngraph.cpp @@ -342,18 +342,6 @@ CNNLayer::Ptr NodeConverter::createLayer(const std::shared return res; } -template <> -CNNLayer::Ptr NodeConverter::createLayer(const std::shared_ptr& layer) const { - LayerParams params = {layer->get_friendly_name(), "Const", - details::convertPrecision(layer->get_output_element_type(0))}; - auto res = std::make_shared(params); - auto castedLayer = ngraph::as_type_ptr(layer); - if (castedLayer == nullptr) THROW_IE_EXCEPTION << "Cannot get " << params.type << " layer " << params.name; - - res->blobs["custom"] = shareWeights(castedLayer); - return res; -} - template <> CNNLayer::Ptr NodeConverter::createLayer(const std::shared_ptr& layer) const { LayerParams params = {layer->get_friendly_name(), "Convert", @@ -732,22 +720,14 @@ CNNLayer::Ptr NodeConverter::createLayer( keep_constants = attr->get(); } - NodeConverter converter; - const auto weightsNode = castedLayer->input_value(1).get_node_shared_ptr(); - if (!keep_constants && converter.canCreate(weightsNode)) { - const auto& weights = converter.createLayer(weightsNode); - res->blobs["weights"] = weights->blobs["custom"]; - res->_weights = weights->blobs["custom"]; - + const auto weightsNode = castedLayer->input_value(1).get_node_shared_ptr(); + if (!keep_constants && InferenceEngine::details::addBlob(weightsNode, res, InferenceEngine::details::weights)) { 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"]; - } + InferenceEngine::details::addBlob(biasNode, res, InferenceEngine::details::biases); } } + return res; } @@ -816,13 +796,9 @@ CNNLayer::Ptr NodeConverter::createLayer( res->params["group"] = asString(castedLayer->get_group()); res->params["deformable_group"] = asString(castedLayer->get_deformable_group()); - NodeConverter converter; const auto weightsNode = castedLayer->input_value(2).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"]; - } + InferenceEngine::details::addBlob(weightsNode, res, InferenceEngine::details::weights); + return res; } @@ -1031,7 +1007,7 @@ CNNLayer::Ptr NodeConverter::createLayer(const std::shared_pt dataShape = {dataShape[1]}; } - Blob::Ptr dataBlb = shareWeights(const_weights); + Blob::Ptr dataBlb = InferenceEngine::details::shareWeights(const_weights); res->blobs["weights"] = dataBlb; res->_weights = dataBlb; @@ -1217,20 +1193,10 @@ CNNLayer::Ptr NodeConverter::createLayer(const std::sh details::convertPrecision(layer->get_output_element_type(0))}; auto res = std::make_shared(params); - NodeConverter converter; const auto weightsNode = layer->input_value(1).get_node_shared_ptr(); - if (converter.canCreate(weightsNode)) { - const auto& weightsLayer = converter.createLayer(weightsNode); - res->blobs["weights"] = weightsLayer->blobs["custom"]; - res->_weights = weightsLayer->blobs["custom"]; - } - + InferenceEngine::details::addBlob(weightsNode, res, InferenceEngine::details::weights); const auto biasNode = layer->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"]; - } + InferenceEngine::details::addBlob(biasNode, res, InferenceEngine::details::biases); return res; } @@ -1683,21 +1649,12 @@ CNNLayer::Ptr NodeConverter::createLayer(const std:: keep_constants = attr->get(); } - NodeConverter converter; - const auto weightsNode = layer->input_value(1).get_node_shared_ptr(); - if (!keep_constants && converter.canCreate(weightsNode)) { - const auto& weights = converter.createLayer(weightsNode); - res->blobs["weights"] = weights->blobs["custom"]; - res->_weights = weights->blobs["custom"]; - + if (!keep_constants && InferenceEngine::details::addBlob(weightsNode, res, InferenceEngine::details::weights)) { const auto biasNode = layer->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"]; - } + InferenceEngine::details::addBlob(biasNode, res, InferenceEngine::details::biases); } + return res; } @@ -1821,13 +1778,10 @@ CNNLayer::Ptr NodeConverter::createLayer(const std::sha res->params["channel_shared"] = castedLayer->get_channel_shared() ? "1" : "0"; res->params["across_spatial"] = castedLayer->get_across_spatial() ? "1" : "0"; - NodeConverter 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"]; - } else { - THROW_IE_EXCEPTION << "Cannot convert weight node for NormalizeIE op"; + const auto weightsNode = layer->input_value(1).get_node_shared_ptr(); + if (auto constWeights = ngraph::as_type_ptr(weightsNode)) { + Blob::Ptr dataBlob = InferenceEngine::details::shareWeights(constWeights); + res->blobs["weights"] = dataBlob; } return res; diff --git a/inference-engine/src/legacy_api/src/ie_cnn_layer_builder_ngraph.h b/inference-engine/src/legacy_api/src/ie_cnn_layer_builder_ngraph.h index 3391591325f..20ecdf461ad 100644 --- a/inference-engine/src/legacy_api/src/ie_cnn_layer_builder_ngraph.h +++ b/inference-engine/src/legacy_api/src/ie_cnn_layer_builder_ngraph.h @@ -64,50 +64,6 @@ public: auto castedPtr = ngraph::as_type_ptr(node); return castedPtr != nullptr; } - -private: - class ConstAllocatorWrapper : public IAllocator { - public: - explicit ConstAllocatorWrapper(std::shared_ptr constOp): _constOp(std::move(constOp)) {} - - void Release() noexcept override { - delete this; - } - - void* lock(void* handle, LockOp) noexcept override { - return handle; - } - - void unlock(void*) noexcept override {} // NOLINT - - void* alloc(size_t) noexcept override { - return const_cast(_constOp->get_data_ptr()); - } - - bool free(void*) noexcept override { // NOLINT - return true; - } - - private: - std::shared_ptr _constOp; - }; - - Blob::Ptr shareWeights(const std::shared_ptr& constLayer) const { - if (!constLayer) THROW_IE_EXCEPTION << "Cannot share weights! Constant operation is empty!"; - auto dataPrecision = details::convertPrecision(constLayer->get_element_type()); - - size_t shapeSize = ngraph::shape_size(constLayer->get_shape()); - if (dataPrecision == Precision::BIN) { - shapeSize = (shapeSize % 8 == 0 ? shapeSize / 8 : (shapeSize / 8) + 1); - } - - TensorDesc td(dataPrecision, {shapeSize}, Layout::C); - - auto blob = make_blob_with_precision(td, std::make_shared(constLayer)); - blob->allocate(); - - return blob; - } }; } // namespace Builder diff --git a/inference-engine/src/readers/ir_reader/ie_ir_parser.cpp b/inference-engine/src/readers/ir_reader/ie_ir_parser.cpp index f9e9a214ab2..db8ca524467 100644 --- a/inference-engine/src/readers/ir_reader/ie_ir_parser.cpp +++ b/inference-engine/src/readers/ir_reader/ie_ir_parser.cpp @@ -398,7 +398,6 @@ std::shared_ptr V10Parser::createNode(const std::vector> creators = { std::make_shared>("AvgPool"), std::make_shared>("Clamp"), - std::make_shared>("Const"), std::make_shared>("Convert"), std::make_shared>("CTCGreedyDecoder"), std::make_shared>("DeformableConvolution"), @@ -504,15 +503,18 @@ std::shared_ptr V10Parser::createNode(const std::vector(opset.create(params.type)); + ngraphNode = std::shared_ptr(opset.create(type)); ngraphNode->set_friendly_name(params.name); ngraphNode->set_arguments(inputs); - XmlDeserializer visitor(node); + XmlDeserializer visitor(node, weights); if (ngraphNode->visit_attributes(visitor)) ngraphNode->constructor_validate_and_infer_types(); } @@ -1237,44 +1239,6 @@ std::shared_ptr V10Parser::LayerCreator THROW_IE_EXCEPTION << "Invalid number of inputs: " << layerParsePrms.inputPorts.size(); } -// Constant layer -template <> -std::shared_ptr V10Parser::LayerCreator::createLayer( - const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights, - const GenericLayerParams& layerParsePrms) { - checkParameters(inputs, layerParsePrms, 0); - 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 offset = GetUInt64Attr(dn, "offset"); - size_t size = GetUInt64Attr(dn, "size"); - - size_t length = weights->byteSize(); - if (!length) - THROW_IE_EXCEPTION << "Cannot read network! The model requires weights data! " - << "Bin file cannot be found! Please specify the path to bin file."; - if (static_cast(length) < offset + size) - THROW_IE_EXCEPTION << "Cannot create " << getType() << " layer with name: " << layerParsePrms.name - << ". Layer has incorrect weights!"; - - auto port = layerParsePrms.outputPorts[0]; - ngraph::Shape shape(port.dims); - ngraph::element::Type el_type(port.precision); - if (size < std::ceil(ngraph::shape_size(shape) * el_type.bitwidth() / 8.f)) - THROW_IE_EXCEPTION << "Cannot create Constant op " << layerParsePrms.name << " size attribute and shape size are inconsistent!"; - - char* data = weights->cbuffer().as() + offset; - - using SharedBuffer = ngraph::runtime::SharedBuffer; - - auto buffer = std::make_shared(data, size, weights); - auto constant = std::make_shared(port.precision, shape, buffer); - - return constant; -} - // Power layer template <> std::shared_ptr V10Parser::LayerCreator::createLayer( diff --git a/inference-engine/src/readers/ir_reader/ie_ir_parser.hpp b/inference-engine/src/readers/ir_reader/ie_ir_parser.hpp index 2b13fad89cc..d2dc3807e75 100644 --- a/inference-engine/src/readers/ir_reader/ie_ir_parser.hpp +++ b/inference-engine/src/readers/ir_reader/ie_ir_parser.hpp @@ -182,7 +182,7 @@ private: class XmlDeserializer : public ngraph::AttributeVisitor { public: - explicit XmlDeserializer(const pugi::xml_node& node): node(node) {} + explicit XmlDeserializer(const pugi::xml_node& node, const Blob::CPtr& weights): node(node), weights(weights) {} void on_adapter(const std::string& name, ngraph::ValueAccessor& value) override { std::string val; if (!getStrAttribute(node.child("data"), name, val)) return; @@ -243,7 +243,7 @@ private: } else if (auto a = ngraph::as_type>(&adapter)) { if (!getStrAttribute(node.child("data"), name, val)) return; static_cast(*a) = ngraph::as_enum(val); - } else { + } else { THROW_IE_EXCEPTION << "Error IR reading. Attribute adapter can not be found for " << name << " parameter"; } @@ -256,6 +256,43 @@ private: stringToType(val, value); adapter.set(value); } + void on_adapter(const std::string& name, ngraph::ValueAccessor& adapter) override { + std::string value; + pugi::xml_node dn = node.child("data"); + auto type = XMLParseUtils::GetStrAttr(node, "type"); + + if (dn.empty()) + THROW_IE_EXCEPTION << "No attrtibutes defined for " << type << " op!"; + + if (getStrAttribute(dn, name, value)) { + auto data = static_cast(adapter.get_ptr()); + size_t length = std::min(value.size(), adapter.size()); + value.copy(data, length); + } else if (name == "value" && type == "Const") { + std::vector shape; + std::string el_type_str; + + size_t offset = XMLParseUtils::GetUInt64Attr(dn, "offset"); + size_t size = XMLParseUtils::GetUInt64Attr(dn, "size"); + if (!getStrAttribute(dn, "element_type", el_type_str)) return; + if (!getParameters(dn, "shape", shape)) return; + + ngraph::element::Type el_type = details::convertPrecision(el_type_str); + + size_t length = weights->byteSize(); + if (!length) + THROW_IE_EXCEPTION << "Empty weights data in bin file or bin file cannot be found!"; + if (length < offset + size) + THROW_IE_EXCEPTION << "Incorrect weights in bin file!"; + if (size < std::ceil(ngraph::shape_size(shape) * el_type.bitwidth() / 8.f)) + THROW_IE_EXCEPTION << "Attribute and shape size are inconsistent for " << type << " op!"; + + auto data = static_cast(adapter.get_ptr()); + char* weights_data = weights->cbuffer().as() + offset; + + std::memcpy(data, weights_data, size); + } + } void on_adapter(const std::string& name, ngraph::ValueAccessor& adapter) override { std::string val; if (!getStrAttribute(node.child("data"), name, val)) @@ -285,6 +322,7 @@ private: private: const pugi::xml_node node; + const Blob::CPtr& weights; bool getStrAttribute(const pugi::xml_node& node, const std::string& name, std::string& value) { if (!node) return false; diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/batch_norm_inference_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/batch_norm_inference_tests.cpp index a8e59cc1a4f..e94ec987c1f 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/batch_norm_inference_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/batch_norm_inference_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadBatchNormInferenceNetwork) { - + 3 @@ -56,7 +56,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadBatchNormInferenceNetwork) { - + 3 @@ -64,7 +64,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadBatchNormInferenceNetwork) { - + 3 @@ -72,7 +72,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadBatchNormInferenceNetwork) { - + 3 @@ -80,7 +80,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadBatchNormInferenceNetwork) { - + 3 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/broadcast_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/broadcast_tests.cpp index 4140d8757a6..52ee678c781 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/broadcast_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/broadcast_tests.cpp @@ -18,7 +18,7 @@ TEST_F(NGraphReaderTests, ConvertBroadcastToTiles1) { - + 4 @@ -173,7 +173,7 @@ TEST_F(NGraphReaderTests, ConvertBroadcastToTiles2) { - + 4 @@ -351,7 +351,7 @@ TEST_F(NGraphReaderTests, ConvertBroadcastToTiles3) { - + 4 @@ -462,7 +462,7 @@ TEST_F(NGraphReaderTests, ConvertBroadcastToTiles4) { - + 4 @@ -470,7 +470,7 @@ TEST_F(NGraphReaderTests, ConvertBroadcastToTiles4) { - + 2 @@ -612,7 +612,7 @@ TEST_F(NGraphReaderTests, DISABLED_ConvertBroadcastToTiles5) { - + 4 @@ -620,7 +620,7 @@ TEST_F(NGraphReaderTests, DISABLED_ConvertBroadcastToTiles5) { - + 2 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/constant_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/constant_tests.cpp index cb28d3032d5..dff67ecf225 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/constant_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/constant_tests.cpp @@ -13,7 +13,7 @@ TEST_F(NGraphReaderTests, ReadConstantNetwork) { - + 1 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/convolution_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/convolution_tests.cpp index bfb38594715..3ef99740539 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/convolution_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/convolution_tests.cpp @@ -21,7 +21,7 @@ TEST_F(NGraphReaderTests, ReadConvolutionNetwork) { - + 96 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/custom_op_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/custom_op_tests.cpp new file mode 100644 index 00000000000..35f0875fcc1 --- /dev/null +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/custom_op_tests.cpp @@ -0,0 +1,133 @@ +// Copyright (C) 2020 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include +#include +#include +#include +#include "ngraph_reader_tests.hpp" + +class CustomAddConst : public ngraph::op::Op { +public: + static constexpr ngraph::NodeTypeInfo type_info{"CustomAddConst", 100600}; + const ngraph::NodeTypeInfo& get_type_info() const override { return type_info; } + CustomAddConst() = default; + CustomAddConst(const ngraph::Output& arg, const ngraph::element::Type element_type, + const ngraph::Shape shape, const std::shared_ptr data): + ngraph::op::Op({arg}), + m_element_type(element_type), + m_shape(shape), + m_data(data) { + constructor_validate_and_infer_types(); + } + void validate_and_infer_types() override { + set_output_type(0, m_element_type, m_shape); + } + std::shared_ptr clone_with_new_inputs(const ngraph::OutputVector& new_args) const override { + return std::make_shared(new_args.at(0), m_element_type, m_shape, m_data); + } + bool visit_attributes(ngraph::AttributeVisitor& visitor) override { + visitor.on_attribute("element_type", m_element_type); + visitor.on_attribute("shape", m_shape); + if (!m_data) { + m_data = std::make_shared(shape_size(m_shape) * m_element_type.size(), 64); + } + visitor.on_attribute("value", m_data); + return true; + } + + ngraph::Shape getShapeAttr() const { return m_shape; } + void* getDataPtr() { return (m_data ? m_data->get_ptr() : nullptr); } + + private: + ngraph::element::Type m_element_type; + ngraph::Shape m_shape{}; + std::shared_ptr m_data; +}; + +constexpr ngraph::NodeTypeInfo CustomAddConst::type_info; + +class CustomAddConstExtension : public InferenceEngine::IExtension { + public: + CustomAddConstExtension() { + } + + void GetVersion(const InferenceEngine::Version*& versionInfo) const noexcept override {} + + void Release() noexcept override { delete this; } + + void Unload() noexcept override {} + + std::map getOpSets() override { + std::map opsets; + ngraph::OpSet opset; + opset.insert(); + opsets["custom_opset"] = opset; + return opsets; + } +}; + +TEST_F(NGraphReaderTests, ReadCustomAddConstNetwork) { + std::string model = R"V0G0N( + + + + + + + 4 + + + + + + + + 4 + + + + + 4 + + + + + + + 4 + + + + + + + + + +)V0G0N"; + + std::string expectedValue = std::string("0?|%.g6/,-{5~P1>"); + REPLACE_WITH_STR(model, "_VALUE_", expectedValue); + InferenceEngine::Blob::CPtr weights; + InferenceEngine::Core ie; + ie.AddExtension(std::make_shared()); + + auto network = ie.ReadNetwork(model, weights); + + IE_SUPPRESS_DEPRECATED_START + auto convertedNetwork = std::make_shared(network); + + for (auto it = details::CNNNetworkIterator(convertedNetwork.get()); it != details::CNNNetworkIterator(); it++) { + InferenceEngine::CNNLayerPtr layer = *it; + ASSERT_NE(nullptr, layer->getNode()); + } + + InferenceEngine::CNNLayerPtr customAdd; + convertedNetwork->getLayerByName("activation", customAdd, nullptr); + + ASSERT_EQ(expectedValue, customAdd->GetParamAsString("value")); + + IE_SUPPRESS_DEPRECATED_END +} diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/deconvolution_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/deconvolution_tests.cpp index a773030a182..518659d93e6 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/deconvolution_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/deconvolution_tests.cpp @@ -21,7 +21,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadDeconvolution3DNetwork) { - + 512 @@ -140,7 +140,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadDeconvolution2DNetwork) { - + 512 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/divide_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/divide_tests.cpp index 3fec2562cc7..d56d31d38ed 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/divide_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/divide_tests.cpp @@ -22,7 +22,7 @@ TEST_F(NGraphReaderTests, ReadDivideNetwork) { - + 1 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/fake_quantize_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/fake_quantize_tests.cpp index f768a1fdfcc..2bdd5658708 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/fake_quantize_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/fake_quantize_tests.cpp @@ -22,7 +22,7 @@ TEST_F(NGraphReaderTests, ReadFQNetwork) { - + 1 @@ -33,7 +33,7 @@ TEST_F(NGraphReaderTests, ReadFQNetwork) { - + 1 @@ -44,7 +44,7 @@ TEST_F(NGraphReaderTests, ReadFQNetwork) { - + 1 @@ -55,7 +55,7 @@ TEST_F(NGraphReaderTests, ReadFQNetwork) { - + 1 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/fusion_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/fusion_tests.cpp index 19f686701e5..76a54809d00 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/fusion_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/fusion_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, ConvBiasFusion) { - + 96 @@ -56,7 +56,7 @@ TEST_F(NGraphReaderTests, ConvBiasFusion) { - + 96 @@ -174,7 +174,7 @@ TEST_F(NGraphReaderTests, DISABLED_ConvBiasFusionFP16) { - + 96 @@ -210,7 +210,7 @@ TEST_F(NGraphReaderTests, DISABLED_ConvBiasFusionFP16) { - + 96 @@ -326,7 +326,7 @@ TEST_F(NGraphReaderTests, MatMulBiasFusionNoBroadcast) { - + 2048 @@ -353,7 +353,7 @@ TEST_F(NGraphReaderTests, MatMulBiasFusionNoBroadcast) { - + 1 @@ -448,7 +448,7 @@ TEST_F(NGraphReaderTests, DISABLED_MatMulBiasFusion) { - + 2048 @@ -475,7 +475,7 @@ TEST_F(NGraphReaderTests, DISABLED_MatMulBiasFusion) { - + 1000 @@ -483,7 +483,7 @@ TEST_F(NGraphReaderTests, DISABLED_MatMulBiasFusion) { - + 2 @@ -491,7 +491,7 @@ TEST_F(NGraphReaderTests, DISABLED_MatMulBiasFusion) { - + 4 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/gather_tree_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/gather_tree_tests.cpp index 4ff515ddc23..184869fb016 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/gather_tree_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/gather_tree_tests.cpp @@ -37,7 +37,7 @@ TEST_F(NGraphReaderTests, ReadGatherTreeNetwork) { - + diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/greater_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/greater_tests.cpp index c5491f6a24d..9222e786e45 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/greater_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/greater_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadGreaterNetwork) { - + 1 @@ -149,7 +149,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadGreaterEqualNetwork) { - + 1 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/hard_sigmoid_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/hard_sigmoid_tests.cpp index 962e706ded9..bfb2173b2fd 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/hard_sigmoid_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/hard_sigmoid_tests.cpp @@ -20,13 +20,13 @@ TEST_F(NGraphReaderTests, ReadHardSigmoidNetwork) { - + - + diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/interpolate_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/interpolate_tests.cpp index a45abfea5f5..078f1c7df54 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/interpolate_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/interpolate_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, ReadInterpolateNetwork) { - + 2 @@ -127,7 +127,7 @@ TEST_F(NGraphReaderTests, ReadInterpolate2Network) { - + 4 @@ -237,7 +237,7 @@ TEST_F(NGraphReaderTests, ReadInterpolate4Network) { - + 2 @@ -245,7 +245,7 @@ TEST_F(NGraphReaderTests, ReadInterpolate4Network) { - + 2 @@ -253,7 +253,7 @@ TEST_F(NGraphReaderTests, ReadInterpolate4Network) { - + 2 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/less_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/less_tests.cpp index 8036c2aa177..a30f95be3bd 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/less_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/less_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadLessNetwork) { - + 1 @@ -149,7 +149,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadLessEqualNetwork) { - + 1 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/linear_ops_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/linear_ops_tests.cpp index 046c62c6942..4a4f9e4a0ae 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/linear_ops_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/linear_ops_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, ConvertMulAddToScaleShift) { - + 64 @@ -53,7 +53,7 @@ TEST_F(NGraphReaderTests, ConvertMulAddToScaleShift) { - + 64 @@ -164,7 +164,7 @@ TEST_F(NGraphReaderTests, ConvertMulAddToPower) { - + 1 @@ -199,7 +199,7 @@ TEST_F(NGraphReaderTests, ConvertMulAddToPower) { - + 1 @@ -318,7 +318,7 @@ TEST_F(NGraphReaderTests, ConvertMulToPower) { - + 1 @@ -432,7 +432,7 @@ TEST_F(NGraphReaderTests, ConvertMulToPower2) { - + 1 @@ -543,7 +543,7 @@ TEST_F(NGraphReaderTests, ConvertAddToPower) { - + 1 @@ -657,7 +657,7 @@ TEST_F(NGraphReaderTests, ConvertMulToScaleShift) { - + 64 @@ -765,7 +765,7 @@ TEST_F(NGraphReaderTests, ConvertAddToScaleShift) { - + 64 @@ -873,7 +873,7 @@ TEST_F(NGraphReaderTests, ConvertMulToEltwise) { - + 112 @@ -994,7 +994,7 @@ TEST_F(NGraphReaderTests, ConvertAddToEltwise) { - + 112 @@ -1115,7 +1115,7 @@ TEST_F(NGraphReaderTests, ReadAddNoBroadcastNetwork) { - + 1 @@ -1244,7 +1244,7 @@ TEST_F(NGraphReaderTests, ReadMultiplyNoBroadcastNetwork) { - + 1 @@ -1373,7 +1373,7 @@ TEST_F(NGraphReaderTests, RemoveAdd) { - + 1 @@ -1502,7 +1502,7 @@ TEST_F(NGraphReaderTests, RemoveMulAdd) { - + 1 @@ -1537,7 +1537,7 @@ TEST_F(NGraphReaderTests, RemoveMulAdd) { - + 1 @@ -1692,7 +1692,7 @@ TEST_F(NGraphReaderTests, RemoveAdd2) { - + 1 @@ -1822,7 +1822,7 @@ TEST_F(NGraphReaderTests, RemoveAdd3) { - + 1 @@ -1855,7 +1855,7 @@ TEST_F(NGraphReaderTests, RemoveAdd3) { - + 1 @@ -2020,7 +2020,7 @@ TEST_F(NGraphReaderTests, ConvertAddToEltwise2) { - + 1 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/logical_and_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/logical_and_tests.cpp index d98a32cdb70..cd16442dc32 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/logical_and_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/logical_and_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadLogicalAndNetwork) { - + 1 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/logical_or_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/logical_or_tests.cpp index 7af31e5fa74..5e397049727 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/logical_or_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/logical_or_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadLogicalOrNetwork) { - + 1 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/logical_xor_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/logical_xor_tests.cpp index 44a55e8c49b..8aab79e5208 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/logical_xor_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/logical_xor_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadLogicalXorNetwork) { - + 1 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/lrn_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/lrn_tests.cpp index c0f1778910d..5495c790774 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/lrn_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/lrn_tests.cpp @@ -15,7 +15,7 @@ TEST_F(NGraphReaderTests, ReadLrnNetwork) { .getLayer(); auto data_layer = ir_builder_v10 - .AddLayer("data1", "Const", {{"size", "16"}}) + .AddLayer("data1", "Const", {{"element_type", "i64"}, {"offset", "0"}, {"size", "16"}, {"shape", "2"}}) .AddOutPort(Precision::ePrecision::I64, {2}) .getLayer(); @@ -75,7 +75,7 @@ TEST_F(NGraphReaderTests, ReadLrnNetwork2) { .getLayer(); auto data_layer = ir_builder_v10 - .AddLayer("data1", "Const", {{"size", "8"}}) + .AddLayer("data1", "Const", {{"element_type", "i64"}, {"offset", "0"}, {"size", "8"}, {"shape", "1"}}) .AddOutPort(Precision::ePrecision::I64, {1}) .getLayer(); diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/matmul_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/matmul_tests.cpp index cd1de3504ad..37bc3bfc303 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/matmul_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/matmul_tests.cpp @@ -18,7 +18,7 @@ TEST_F(NGraphReaderTests, ReadMatMulNetwork1) { - + 2048 @@ -112,7 +112,7 @@ TEST_F(NGraphReaderTests, ReadMatMulNetwork2) { - + 1000 @@ -207,7 +207,7 @@ TEST_F(NGraphReaderTests, ReadMatMulNetwork3) { - + 1000 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/maximum_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/maximum_tests.cpp index bdda4201963..12d83c048ac 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/maximum_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/maximum_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, ReadMaximumNetwork) { - + 1 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/non_max_suppression_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/non_max_suppression_tests.cpp index 884e7a4e635..6be17382380 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/non_max_suppression_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/non_max_suppression_tests.cpp @@ -48,25 +48,25 @@ TEST_F(NGraphReaderTests, ReadNonMaxSuppression5) { - + - + - + - + diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/one_hot_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/one_hot_tests.cpp index d9c8ce84384..b184ff24211 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/one_hot_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/one_hot_tests.cpp @@ -19,19 +19,19 @@ TEST_F(NGraphReaderTests, ReadOneHotFP32) { - + - + - + @@ -139,19 +139,19 @@ TEST_F(NGraphReaderTests, DISABLED_ReadOneHotINT16) { - + - + - + diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/pad_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/pad_tests.cpp index 35da67632ff..731b1e09931 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/pad_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/pad_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, ReadPadNoPadValue) { - + 4 @@ -28,7 +28,7 @@ TEST_F(NGraphReaderTests, ReadPadNoPadValue) { - + 4 @@ -148,7 +148,7 @@ TEST_F(NGraphReaderTests, ReadPadWithPadValue) { - + 4 @@ -156,7 +156,7 @@ TEST_F(NGraphReaderTests, ReadPadWithPadValue) { - + 4 @@ -164,7 +164,7 @@ TEST_F(NGraphReaderTests, ReadPadWithPadValue) { - + diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/pow_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/pow_tests.cpp index e1da5b57eda..aa7a9b3e41f 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/pow_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/pow_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, ReadPowNetwork) { - + 1 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/prelu_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/prelu_tests.cpp index 6f127ab7a9e..98a7ec9e41f 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/prelu_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/prelu_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, ReadPReLUNetwork) { - + 64 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/prior_box_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/prior_box_tests.cpp index ff417bf3860..c05663cf7de 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/prior_box_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/prior_box_tests.cpp @@ -50,7 +50,7 @@ TEST_F(NGraphReaderTests, ReadPriorBoxClusteredNetwork) { - + 1 @@ -58,7 +58,7 @@ TEST_F(NGraphReaderTests, ReadPriorBoxClusteredNetwork) { - + 1 @@ -66,7 +66,7 @@ TEST_F(NGraphReaderTests, ReadPriorBoxClusteredNetwork) { - + 1 @@ -151,7 +151,7 @@ TEST_F(NGraphReaderTests, ReadPriorBoxClusteredNetwork) { - + 1 @@ -311,7 +311,7 @@ TEST_F(NGraphReaderTests, ReadPriorBoxNetwork) { - + 1 @@ -319,7 +319,7 @@ TEST_F(NGraphReaderTests, ReadPriorBoxNetwork) { - + 1 @@ -327,7 +327,7 @@ TEST_F(NGraphReaderTests, ReadPriorBoxNetwork) { - + 1 @@ -411,7 +411,7 @@ TEST_F(NGraphReaderTests, ReadPriorBoxNetwork) { - + 1 @@ -581,7 +581,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadPriorBoxClusteredNetwork) { - + 1 @@ -589,7 +589,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadPriorBoxClusteredNetwork) { - + 1 @@ -597,7 +597,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadPriorBoxClusteredNetwork) { - + 1 @@ -682,7 +682,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadPriorBoxClusteredNetwork) { - + 1 @@ -920,7 +920,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadPriorBoxNetwork) { - + 1 @@ -928,7 +928,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadPriorBoxNetwork) { - + 1 @@ -936,7 +936,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadPriorBoxNetwork) { - + 1 @@ -1020,7 +1020,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadPriorBoxNetwork) { - + 1 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/proposal_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/proposal_tests.cpp index 8eb6e74b99b..54b96480ae6 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/proposal_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/proposal_tests.cpp @@ -32,7 +32,7 @@ TEST_F(NGraphReaderTests, ReadProposalNetwork) { - + 3 @@ -183,7 +183,7 @@ TEST_F(NGraphReaderTests, ReadProposalNetwork_2) { - + 4 @@ -334,7 +334,7 @@ TEST_F(NGraphReaderTests, ReadExtensionProposalNetwork) { - + 3 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/range_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/range_tests.cpp index b07876fcaeb..f47c492f262 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/range_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/range_tests.cpp @@ -19,21 +19,21 @@ TEST_F(NGraphReaderTests, ReadRangeNetwork) { - + - + - + diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/reduce_logical_and_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/reduce_logical_and_tests.cpp index 193d88f51c0..a5993c29382 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/reduce_logical_and_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/reduce_logical_and_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadReduceLogicalAndNetwork) { - + 1 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/reduce_logical_or_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/reduce_logical_or_tests.cpp index 65e7b86b2ca..e480a62153f 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/reduce_logical_or_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/reduce_logical_or_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadReduceLogicalOrNetwork) { - + 1 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/reduce_to_pooling_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/reduce_to_pooling_tests.cpp index e382ef3c05d..870e2859a71 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/reduce_to_pooling_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/reduce_to_pooling_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, ReduceMeanToAvgPool) { - + 2 @@ -129,7 +129,7 @@ TEST_F(NGraphReaderTests, ReduceMeanToAvgPoolKeepDimsFalse) { - + 1 @@ -268,7 +268,7 @@ TEST_F(NGraphReaderTests, ReduceMeanToAvgPoolNonSpatial) { - + 1 @@ -444,7 +444,7 @@ TEST_F(NGraphReaderTests, ReduceMeanToAvgPoolNonSpatialHard) { - + 2 @@ -588,7 +588,7 @@ TEST_F(NGraphReaderTests, ReduceMeanToMaxPool) { - + 2 @@ -698,7 +698,7 @@ TEST_F(NGraphReaderTests, ReduceMeanToMaxPoolKeepDimsFalse) { - + 1 @@ -837,7 +837,7 @@ TEST_F(NGraphReaderTests, ReduceMeanToMaxPoolNonSpatial) { - + 1 @@ -1013,7 +1013,7 @@ TEST_F(NGraphReaderTests, ReduceSumToAvgPool) { - + 2 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/reshape_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/reshape_tests.cpp index c9a23db4cab..305071f0b84 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/reshape_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/reshape_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, ReadReshapeNetwork) { - + 2 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/reverse_sequence_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/reverse_sequence_tests.cpp index 42fd370b3d5..e7360b59b8a 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/reverse_sequence_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/reverse_sequence_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, ReadReverseSequenceNetwork) { - + 3 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/selu_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/selu_tests.cpp index 881fc9c8d47..dd1923b0a5a 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/selu_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/selu_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, ReadSeluNetwork) { - + 1 @@ -28,7 +28,7 @@ TEST_F(NGraphReaderTests, ReadSeluNetwork) { - + 1 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/split_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/split_tests.cpp index 21eb1d2b14d..14cb04c118c 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/split_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/split_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, ReadSplitNetwork) { - + @@ -147,7 +147,7 @@ TEST_F(NGraphReaderTests, ReadSplitNetwork2) { - + @@ -381,13 +381,13 @@ TEST_F(NGraphReaderTests, ReadVariadicSplitNetwork) { - + - + 2 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/squared_difference_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/squared_difference_tests.cpp index 55021ce465f..f5158596570 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/squared_difference_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/squared_difference_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, ReadSquaredDifferenceNetwork) { - + 1 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/squeeze_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/squeeze_tests.cpp index 6443201d250..109a7fa88f4 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/squeeze_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/squeeze_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, ReadSqueeze) { - + 1 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/strided_slice_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/strided_slice_tests.cpp index 38691af95a5..c94d8de05ed 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/strided_slice_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/strided_slice_tests.cpp @@ -24,7 +24,7 @@ TEST_F(NGraphReaderTests, ConvertStridedSliceToCrop) { - + 4 @@ -32,7 +32,7 @@ TEST_F(NGraphReaderTests, ConvertStridedSliceToCrop) { - + 4 @@ -40,7 +40,7 @@ TEST_F(NGraphReaderTests, ConvertStridedSliceToCrop) { - + 4 @@ -191,7 +191,7 @@ TEST_F(NGraphReaderTests, DISABLED_ConvertStridedSliceToCropMultipleMasks) { - + 6 @@ -199,7 +199,7 @@ TEST_F(NGraphReaderTests, DISABLED_ConvertStridedSliceToCropMultipleMasks) { - + 6 @@ -207,7 +207,7 @@ TEST_F(NGraphReaderTests, DISABLED_ConvertStridedSliceToCropMultipleMasks) { - + 6 @@ -447,7 +447,7 @@ TEST_F(NGraphReaderTests, DISABLED_ConvertStridedSliceToCropMultipleMasks_2) { - + 8 @@ -455,7 +455,7 @@ TEST_F(NGraphReaderTests, DISABLED_ConvertStridedSliceToCropMultipleMasks_2) { - + 8 @@ -463,7 +463,7 @@ TEST_F(NGraphReaderTests, DISABLED_ConvertStridedSliceToCropMultipleMasks_2) { - + 8 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/ti.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/ti.cpp index f2e4193a4d1..59d04d6a5dc 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/ti.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/ti.cpp @@ -82,7 +82,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_opset1) { - + 2 @@ -127,7 +127,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_opset1) { - + 1024 @@ -136,7 +136,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_opset1) { - + 1024 @@ -145,7 +145,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_opset1) { - + 1024 @@ -207,7 +207,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_opset1) { - + 3 @@ -545,7 +545,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_resnet_opset1) { - + 2 @@ -590,7 +590,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_resnet_opset1) { - + 2048 @@ -599,7 +599,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_resnet_opset1) { - + 2048 @@ -608,7 +608,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_resnet_opset1) { - + 2048 @@ -670,7 +670,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_resnet_opset1) { - + 3 @@ -1026,7 +1026,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_negative_stride_opset1) { - + 2 @@ -1071,7 +1071,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_negative_stride_opset1) { - + 1024 @@ -1080,7 +1080,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_negative_stride_opset1) { - + 1024 @@ -1089,7 +1089,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_negative_stride_opset1) { - + 1024 @@ -1151,7 +1151,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_negative_stride_opset1) { - + 3 @@ -1479,7 +1479,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_opset4) { - + 2 @@ -1524,7 +1524,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_opset4) { - + 1024 @@ -1533,7 +1533,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_opset4) { - + 1024 @@ -1542,7 +1542,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_opset4) { - + 1024 @@ -1604,7 +1604,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_opset4) { - + 3 @@ -1942,7 +1942,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_resnet_opset4) { - + 2 @@ -1987,7 +1987,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_resnet_opset4) { - + 2048 @@ -1996,7 +1996,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_resnet_opset4) { - + 2048 @@ -2005,7 +2005,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_resnet_opset4) { - + 2048 @@ -2067,7 +2067,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_resnet_opset4) { - + 3 @@ -2423,7 +2423,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_negative_stride_opset4) { - + 2 @@ -2468,7 +2468,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_negative_stride_opset4) { - + 1024 @@ -2477,7 +2477,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_negative_stride_opset4) { - + 1024 @@ -2486,7 +2486,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_negative_stride_opset4) { - + 1024 @@ -2548,7 +2548,7 @@ TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_negative_stride_opset4) { - + 3 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/tile_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/tile_tests.cpp index 16874d5e7f3..4a197c7e862 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/tile_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/tile_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, ReadTileNetwork) { - + 4 @@ -130,7 +130,7 @@ TEST_F(NGraphReaderTests, ReadTileNetwork2) { - + 4 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/topK_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/topK_tests.cpp index a2d3023e687..529293486d0 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/topK_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/topK_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadTopKNetwork) { - + @@ -146,7 +146,7 @@ TEST_F(NGraphReaderTests, DISABLED_ReadTopKNetwork) { - + 1 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/transpose_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/transpose_tests.cpp index 6495bea97e3..fcc0388cd99 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/transpose_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/transpose_tests.cpp @@ -20,7 +20,7 @@ TEST_F(NGraphReaderTests, ReadTransposeNetwork) { - + 4 diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/unsqueeze_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/unsqueeze_tests.cpp index b47ee89e24f..85b6363870b 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/unsqueeze_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/unsqueeze_tests.cpp @@ -19,7 +19,7 @@ TEST_F(NGraphReaderTests, ReadUnsqueeze) { - + 1 diff --git a/inference-engine/tests/ie_test_utils/functional_test_utils/test_model/test_model.cpp b/inference-engine/tests/ie_test_utils/functional_test_utils/test_model/test_model.cpp index cd7a9c0a943..3adca88c832 100644 --- a/inference-engine/tests/ie_test_utils/functional_test_utils/test_model/test_model.cpp +++ b/inference-engine/tests/ie_test_utils/functional_test_utils/test_model/test_model.cpp @@ -96,12 +96,20 @@ void generateTestModel(const std::string &modelPath, getCreatorLayer(conv1OutData) = conv1LayerPtr; conv1LayerPtr->outData[0] = conv1OutData; + shapeStr.str(""); + InferenceEngine::SizeVector constShape {conv1Params.out_c, inputDims[1], conv1Params.kernel[0], conv1Params.kernel[1]}; + std::copy(constShape.begin(), constShape.end() - 1, std::ostream_iterator(shapeStr, ",")); + shapeStr << constShape.back(); + auto conv1ParamConstLayerXML = ir_builder_v10 .AddLayer("Conv1_Param_Const", "Const", {{"size", std::to_string(CommonTestUtils::getConvWeightsSize( inputDims, conv1Params, - netPrc.name()))}}) + netPrc.name()))}, + {"offset", "0"}, + {"element_type", FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrc).get_type_name()}, + {"shape", shapeStr.str()}}) .AddOutPort(netPrc, {conv1Params.out_c, inputDims[1], conv1Params.kernel[0], conv1Params.kernel[1]}) .getLayer(); @@ -166,9 +174,13 @@ void generateTestModel(const std::string &modelPath, InferenceEngine::Layout::NCHW}); getCreatorLayer(lrn1OutData) = lrn1LayerPtr; lrn1LayerPtr->outData[0] = lrn1OutData; + size_t offset = CommonTestUtils::getConvWeightsSize(inputDims, conv1Params, netPrc.name()); auto lrn1ParamConstLayerXML = ir_builder_v10 - .AddLayer("Lrn1_Param_Const", "Const", {{"size", "8"}}) + .AddLayer("Lrn1_Param_Const", "Const", {{"size", "8"}, + {"element_type", "i64"}, + {"shape", "1"}, + {"offset", std::to_string(offset)}}) .AddOutPort(InferenceEngine::Precision::I64, {1}) .getLayer(); @@ -266,8 +278,13 @@ void generateTestModel(const std::string &modelPath, split1LayerPtr->outData[0] = split1OutData0; split1LayerPtr->outData[1] = split1OutData1; + offset = offset + 8; + auto split1ParamConstLayerXML = ir_builder_v10 - .AddLayer("Split1_Param_Const", "Const", {{"size", "8"}}) + .AddLayer("Split1_Param_Const", "Const", {{"size", "8"}, + {"element_type", "i64"}, + {"shape", ""}, + {"offset", std::to_string(offset)}}) .AddOutPort(InferenceEngine::Precision::I64, {}) .getLayer(); @@ -315,12 +332,21 @@ void generateTestModel(const std::string &modelPath, getCreatorLayer(conv2OutData) = conv2LayerPtr; conv2LayerPtr->outData[0] = conv2OutData; + shapeStr.str(""); + InferenceEngine::SizeVector conv2ConstShape {conv2Params.out_c, split1OutShape[1], conv2Params.kernel[0], conv2Params.kernel[1]}; + std::copy(conv2ConstShape.begin(), conv2ConstShape.end() - 1, std::ostream_iterator(shapeStr, ",")); + shapeStr << conv2ConstShape.back(); + offset = offset + 8; + auto conv2ParamConstLayerXML = ir_builder_v10 .AddLayer("Conv2_Param_Const", "Const", {{"size", std::to_string(CommonTestUtils::getConvWeightsSize( split1OutShape, conv2Params, - netPrc.name()))}}) + netPrc.name()))}, + {"offset", std::to_string(offset)}, + {"element_type", FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrc).get_type_name()}, + {"shape", shapeStr.str()}}) .AddOutPort(netPrc, {conv2Params.out_c, split1OutShape[1], conv2Params.kernel[0], conv2Params.kernel[1]}) .getLayer(); @@ -372,12 +398,21 @@ void generateTestModel(const std::string &modelPath, getCreatorLayer(conv3OutData) = conv3LayerPtr; conv3LayerPtr->outData[0] = conv3OutData; + shapeStr.str(""); + InferenceEngine::SizeVector conv3ConstShape {conv3Params.out_c, split1OutShape[1], conv3Params.kernel[0], conv3Params.kernel[1]}; + std::copy(conv3ConstShape.begin(), conv3ConstShape.end() - 1, std::ostream_iterator(shapeStr, ",")); + shapeStr << conv3ConstShape.back(); + offset = offset + CommonTestUtils::getConvWeightsSize(split1OutShape, conv2Params, netPrc.name()); + auto conv3ParamConstLayerXML = ir_builder_v10 .AddLayer("Conv3_Param_Const", "Const", {{"size", std::to_string(CommonTestUtils::getConvWeightsSize( split1OutShape, conv3Params, - netPrc.name()))}}) + netPrc.name()))}, + {"offset", std::to_string(offset)}, + {"element_type", FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrc).get_type_name()}, + {"shape", shapeStr.str()}}) .AddOutPort(netPrc, {conv3Params.out_c, split1OutShape[1], conv3Params.kernel[0], conv3Params.kernel[1]}) .getLayer(); diff --git a/inference-engine/tests_deprecated/functional/mkldnn/network_tests/ngraph_network_test.cpp b/inference-engine/tests_deprecated/functional/mkldnn/network_tests/ngraph_network_test.cpp index 21f964affe9..372de68f9c4 100644 --- a/inference-engine/tests_deprecated/functional/mkldnn/network_tests/ngraph_network_test.cpp +++ b/inference-engine/tests_deprecated/functional/mkldnn/network_tests/ngraph_network_test.cpp @@ -139,7 +139,7 @@ TEST_F(smoke_NGraphNetworkTest, reshapeLoadTest) { - + 20 @@ -175,7 +175,7 @@ TEST_F(smoke_NGraphNetworkTest, reshapeLoadTest) { - + 1 @@ -229,7 +229,7 @@ TEST_F(smoke_NGraphNetworkTest, reshapeLoadTest) { - + 50 @@ -265,7 +265,7 @@ TEST_F(smoke_NGraphNetworkTest, reshapeLoadTest) { - + 1 diff --git a/inference-engine/tests_deprecated/functional/vpu/common/layers/myriad_layers_topk_test.hpp b/inference-engine/tests_deprecated/functional/vpu/common/layers/myriad_layers_topk_test.hpp index 63f363ceff5..e4d0020ef5d 100644 --- a/inference-engine/tests_deprecated/functional/vpu/common/layers/myriad_layers_topk_test.hpp +++ b/inference-engine/tests_deprecated/functional/vpu/common/layers/myriad_layers_topk_test.hpp @@ -189,7 +189,7 @@ protected: - + @@ -251,7 +251,7 @@ protected: REPLACE_WITH_STR(model, "__INDEX_PRECISION__", indexPrecision.name()); REPLACE_WITH_STR(model, "__INPUT_DIMS__", inputDimsStr); REPLACE_WITH_NUM_VECTOR(model, "__INPUT_DIMS_SHAPE__", inputDims); - REPLACE_WITH_STR(model, "__K_DIMS_SHAPE__", "1"); + REPLACE_WITH_STR(model, "__K_DIMS_SHAPE__", ""); REPLACE_WITH_NUM(model, "__K_SIZE__", kSize); REPLACE_WITH_STR(model, "__OUTPUT_DIMS__", outputDimsStr); REPLACE_WITH_NUM(model, "__AXIS__", axis); diff --git a/inference-engine/tests_deprecated/functional/vpu/vpu_base/vpu_ir_dumper.cpp b/inference-engine/tests_deprecated/functional/vpu/vpu_base/vpu_ir_dumper.cpp index fbb70699431..1e0529bcac7 100644 --- a/inference-engine/tests_deprecated/functional/vpu/vpu_base/vpu_ir_dumper.cpp +++ b/inference-engine/tests_deprecated/functional/vpu/vpu_base/vpu_ir_dumper.cpp @@ -11,6 +11,7 @@ namespace { switch (precision) { case InferenceEngine::Precision::FP16: return "f16"; case InferenceEngine::Precision::FP32: return "f32"; + case InferenceEngine::Precision::I64: return "i64"; default: break; } @@ -227,7 +228,9 @@ IRXmlNode IRDumperLayer::dump() const { if (!_weights.empty()) { IRXmlNode dataNode {"data", { {"offset", std::to_string(_weights._dataOffset)}, - {"size", std::to_string(_weights.size())}}, {}, {}}; + {"size", std::to_string(_weights.size())}, + {"element_type", paramterPresitionToString(_weights._precision)}, + {"shape", InferenceEngine::details::joinVec(_outDesc[0])}}, {}, {}}; layer.children.push_back(std::move(dataNode)); } else if (_parameterPrecision != InferenceEngine::Precision::UNSPECIFIED) {