#include <ie_memcpy.h>
+#include <typeinfo>
#include <unordered_set>
#include <algorithm>
#include <deque>
#include <ngraph/opsets/opset3.hpp>
#include <ngraph/variant.hpp>
+#include <cpp/ie_cnn_network.h>
+#include "ie_blob_stream.hpp"
#include "cnn_network_impl.hpp"
#include "details/caseless.hpp"
#include "details/ie_cnn_network_tools.h"
#include "generic_ie.hpp"
#include "precision_utils.h"
#include "blob_factory.hpp"
+#include "ie_cnn_net_reader_impl.h"
using namespace InferenceEngine;
using namespace XMLParseUtils;
IRParser::IRParser(size_t version): IRParser(version, {}) {}
IRParser::IRParser(size_t version, const std::vector<InferenceEngine::IExtensionPtr>& exts) {
+ if (version < 10) {
+ parser = std::make_shared<CNNParser>();
+ return;
+ }
switch (version) {
case 10:
parser = std::make_shared<V10Parser>(exts);
}
}
-std::shared_ptr<ngraph::Function> IRParser::parse(const pugi::xml_node& root, const Blob::CPtr& weights) {
- return parser->parse(root, weights);
+std::shared_ptr<ICNNNetwork> IRParser::parse(const pugi::xml_node& root, std::istream& binStream) {
+ return parser->parse(root, binStream);
+}
+
+/**
+ * Hold original blob in order to avoid situations when original blob is allocated on stack
+ */
+class WeightsHolderBlob : public TBlob<uint8_t> {
+ Blob::CPtr originBlob;
+
+public:
+ explicit WeightsHolderBlob(const Blob::CPtr& weights) :
+ TBlob<uint8_t>(weights->getTensorDesc(),
+ weights->cbuffer().as<uint8_t*>()),
+ originBlob(weights) { }
+};
+
+std::shared_ptr<ICNNNetwork> CNNParser::parse(const pugi::xml_node& root, std::istream& binStream) {
+ auto getBlobStream = [](std::istream& binStream) {
+ details::BlobStream* blobStream = dynamic_cast<details::BlobStream*>(&binStream);
+ if (blobStream == nullptr) {
+ details::BlobStream helper({});
+ std::string typeStream = typeid(binStream).name();
+ std::string typeBlobStream = typeid(helper).name();
+ if (typeStream == typeBlobStream)
+ blobStream = static_cast<details::BlobStream*>(&binStream);
+ }
+ return blobStream;
+ };
+ details::CNNNetReaderImpl reader(std::make_shared<details::V2FormatParserCreator>());
+ ResponseDesc resp;
+ StatusCode ret = reader.ReadNetwork(root, &resp);
+ if (ret != OK)
+ THROW_IE_EXCEPTION << resp.msg;
+ TBlob<uint8_t>::Ptr weightsPtr;
+
+ // Try to get BlobStream to work with original blob
+ details::BlobStream* blobStream = getBlobStream(binStream);
+ if (blobStream != nullptr) {
+ weightsPtr = std::make_shared<WeightsHolderBlob>(blobStream->getBlob());
+ } else {
+ // Allocate a blob for weights
+ binStream.seekg(0, std::ios::end);
+ size_t length = binStream.tellg();
+ weightsPtr = std::make_shared<TBlob<uint8_t>>(TensorDesc(Precision::U8, {length}, Layout::C));
+ weightsPtr->allocate();
+ char* data = weightsPtr->buffer().as<char*>();
+ binStream.seekg(0, std::ios::beg);
+ binStream.read(data, length);
+ }
+ ret = reader.SetWeights(weightsPtr, &resp);
+ if (ret != OK)
+ THROW_IE_EXCEPTION << resp.msg;
+ return reader.getNetwork();
}
V10Parser::V10Parser(const std::vector<IExtensionPtr>& exts) {
}
}
-std::shared_ptr<ngraph::Function> V10Parser::parse(const pugi::xml_node& root, const Blob::CPtr& weights) {
+std::shared_ptr<ICNNNetwork> V10Parser::parse(const pugi::xml_node& root, std::istream& binStream) {
using node_params = struct {
pugi::xml_node xml;
GenericLayerParams params;
input_node->output(p_output.getRealOutputPortId(e.fromPortId));
}
- auto node = createNode(inputs, p.xml, weights, p.params);
+ auto node = createNode(inputs, p.xml, binStream, p.params);
id_to_node[layer_id] = node;
// Check that output shape after nGraph node validation the same as in IR
result_nodes[0]->add_control_dependency(assign);
}
}
- return function;
+ return CNNNetwork(function);
}
V10Parser::GenericLayerParams V10Parser::parseGenericParams(const pugi::xml_node& node) {
}
std::shared_ptr<ngraph::Node> V10Parser::createNode(const std::vector<ngraph::Output<ngraph::Node>>& inputs,
- const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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"),
useCreator |= opset.contains_type(creator->getNodeType()) || !opset.contains_type(params.type);
}
if (useCreator)
- ngraphNode = creator->createLayer(inputs, node, weights, params);
+ ngraphNode = creator->createLayer(inputs, node, binStream, params);
break;
}
}
auto blobs = node.child("blobs");
if (!blobs.empty()) {
+ binStream.seekg(0, std::ios::end);
+ std::streampos length = binStream.tellg();
+
for (pugi::xml_node blob = blobs.first_child(); !blob.empty(); blob = blob.next_sibling()) {
size_t size = GetUInt64Attr(blob, "size", 0);
uint64_t offset = GetUInt64Attr(blob, "offset", 0);
if (!preStr.empty())
precision = Precision::FromStr(preStr);
if (!size) continue;
- if (!weights || weights->cbuffer() == nullptr)
+ 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 (weights->byteSize() < offset + size)
+ if (length < offset + size)
THROW_IE_EXCEPTION << "Cannot create " << params.type << " layer with name: " << params.name
<< ". Layer has incorrect weights!";
- const uint8_t* data = weights->cbuffer().as<uint8_t*>() + offset;
Blob::Ptr wBlob = make_blob_with_precision(TensorDesc(precision, {size / precision.size()}, Layout::C));
wBlob->allocate();
- ie_memcpy(wBlob->buffer().as<uint8_t*>(), size, data, size);
+ char* data = wBlob->buffer().as<char*>();
+ binStream.seekg(offset, std::ios::beg);
+ binStream.read(data, size);
+
Blob::CPtr cBlob = wBlob;
parameters[blob.name()] = wBlob;
}
// DetectionOutput layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::DetectionOutput>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
pugi::xml_node dn = node.child("data");
// TensorIterator layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::TensorIterator>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
auto tensor_iterator = std::make_shared<ngraph::op::TensorIterator>();
tensor_iterator->set_friendly_name(GetStrAttr(node, "name"));
// Create ngraph::Function, convert it to ngraph::BodyLambda and set it as TensorIterator body
IRParser parser(10);
- auto ngraph_function = parser.parse(node.child("body"), weights);
+ auto ngraph_function = parser.parse(node.child("body"), binStream)->getFunction();
auto parameter_nodes = ngraph_function->get_parameters();
auto result_nodes = ngraph_function->get_results();
// Disabled reshape for generic operations in the TI body
// PriorBoxClustered layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::PriorBoxClustered>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// Proposal layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Proposal>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
checkParameters(inputs, layerParsePrms, 3);
pugi::xml_node dn = node.child("data");
// PriorBox layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::PriorBox>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// ShapeOf layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::ShapeOf>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
checkParameters(inputs, layerParsePrms, 5);
pugi::xml_node dn = node.child("data");
// ReverseSequence layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::ReverseSequence>::createLayer(const ngraph::OutputVector & inputs, const pugi::xml_node& node,
- const Blob::CPtr& weights,
+ std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
checkParameters(inputs, layerParsePrms, 2);
pugi::xml_node dn = node.child("data");
// Covnert layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Convert>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// LSTMCell layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::LSTMCell>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
checkParameters(inputs, layerParsePrms, 6);
pugi::xml_node dn = node.child("data");
// BatchNormInference layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::BatchNormInference>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
checkParameters(inputs, layerParsePrms, 5);
pugi::xml_node dn = node.child("data");
// CTCGreedyDecoder layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::CTCGreedyDecoder>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// TopK layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::TopK>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// Pad layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Pad>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
pugi::xml_node dn = node.child("data");
// SquaredDifference layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::SquaredDifference>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::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, const Blob::CPtr& weights,
+ 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(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::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, const Blob::CPtr& weights,
+ 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(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::LessEqual>(inputs[0], inputs[1]);
// Equal layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Equal>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::Equal>(inputs[0], inputs[1]);
// NotEqual layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::NotEqual>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::NotEqual>(inputs[0], inputs[1]);
// FloorMod layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::FloorMod>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::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, const Blob::CPtr& weights,
+ 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(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// Log layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Log>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// Clamp layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Clamp>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// VariadicSplit layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::VariadicSplit>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::VariadicSplit>(inputs[0], inputs[1], inputs[2]);
// Split layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Split>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
pugi::xml_node dn = node.child("data");
// Sigmoid layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Sigmoid>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// SpaceToDepth layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::SpaceToDepth>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// DepthToSpace layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::DepthToSpace>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// SeLU layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v0::Selu>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::v0::Selu>(inputs[0], inputs[1], inputs[2]);
// PReLU layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::PRelu>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::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, const Blob::CPtr& weights,
+ 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(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::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, const Blob::CPtr& weights,
+ 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, const Blob::CPtr& weights,
+ 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(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::Tanh>(inputs[0]);
// Result layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Result>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::Result>(inputs[0]);
// Tile layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Tile>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::Tile>(inputs[0], inputs[1]);
// StridedSlice layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::StridedSlice>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
pugi::xml_node dn = node.child("data");
// Reshape layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Reshape>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
checkParameters(inputs, layerParsePrms, 2);
// Squeeze layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Squeeze>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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, const Blob::CPtr& weights,
+ 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]);
// Interpolate layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Interpolate>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
checkParameters(inputs, layerParsePrms, 2);
// Abs layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Abs>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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, const Blob::CPtr& weights,
+ 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(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::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, const Blob::CPtr& weights,
+ 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, const Blob::CPtr& weights,
+ 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(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::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, const Blob::CPtr& weights,
+ 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(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
if (inputs.size() == 2) {
return std::make_shared<ngraph::op::v1::Broadcast>(inputs[0], inputs[1]);
// Constant layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Constant>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
checkParameters(inputs, layerParsePrms, 0);
pugi::xml_node dn = node.child("data");
size_t offset = GetUInt64Attr(dn, "offset");
size_t size = GetUInt64Attr(dn, "size");
- if (!weights || weights->cbuffer() == nullptr)
+ binStream.seekg(0, std::ios::end);
+ std::streampos length = binStream.tellg();
+ 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 (weights->byteSize() < offset + size)
+ if (length < offset + size)
THROW_IE_EXCEPTION << "Cannot create " << getType() << " layer with name: " << layerParsePrms.name
<< ". Layer has incorrect weights!";
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!";
- const void * data = (weights->cbuffer().as<uint8_t *>() + offset);
-
- return std::make_shared<ngraph::op::Constant>(port.precision, shape, data);
+ auto constant = std::make_shared<ngraph::op::Constant>(port.precision, shape);
+ char* data = const_cast<char*>(reinterpret_cast<const char*>(constant->get_data_ptr()));
+ binStream.seekg(offset, std::ios::beg);
+ binStream.read(data, size);
+ return constant;
}
// Power layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Power>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::Power>(inputs[0], inputs[1]);
// MatMul layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::MatMul>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// Softmax layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Softmax>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// Sqrt layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Sqrt>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// ReorgYolo layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::ReorgYolo>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// ReduceMin layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::ReduceMin>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// ReduceMax layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::ReduceMax>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// ReduceMean layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::ReduceMean>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// ReduceProd layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::ReduceProd>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// ReduceSum layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::ReduceSum>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// Transpose layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Transpose>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// Convolution layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Convolution>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// GroupConvolution layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::GroupConvolution>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// DeformableConvolution layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::DeformableConvolution>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
checkParameters(inputs, layerParsePrms, 3);
pugi::xml_node dn = node.child("data");
// ConvolutionBackpropData layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::ConvolutionBackpropData>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
pugi::xml_node dn = node.child("data");
// GroupConvolutionBackpropData layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::GroupConvolutionBackpropData>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
pugi::xml_node dn = node.child("data");
// AvgPool layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::AvgPool>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// MaxPool layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::MaxPool>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// ROIPooling layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::ROIPooling>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// PSROIPooling layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::PSROIPooling>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::DeformablePSROIPooling>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
pugi::xml_node dn = node.child("data");
// Concat layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Concat>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// Gather layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::Gather>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::Gather>(inputs[0], inputs[1], inputs[2]);
// GatherTree layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::GatherTree>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
checkParameters(inputs, layerParsePrms, 4);
return std::make_shared<ngraph::op::v1::GatherTree>(inputs[0], inputs[1], inputs[2], inputs[3]);
// OneHot layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::OneHot>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
checkParameters(inputs, layerParsePrms, 4);
// NormalizeL2 layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::NormalizeL2>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// Erf layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::Erf>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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, const Blob::CPtr& weights,
+ 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, const Blob::CPtr& weights,
+ 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, const Blob::CPtr& weights,
+ 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, const Blob::CPtr& weights,
+ 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, const Blob::CPtr& weights,
+ 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, const Blob::CPtr& weights,
+ 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, const Blob::CPtr& weights,
+ 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, const Blob::CPtr& weights,
+ 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, const Blob::CPtr& weights,
+ 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, const Blob::CPtr& weights,
+ 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, const Blob::CPtr& weights,
+ 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(
- const ngraph::OutputVector & inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::HardSigmoid>(inputs[0], inputs[1], inputs[2]);
// GRN layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::GRN>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// LogicalAnd layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::LogicalAnd>::createLayer(
- const ngraph::OutputVector & inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::LogicalAnd>(inputs[0], inputs[1]);
// LogicalOr layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::LogicalOr>::createLayer(
- const ngraph::OutputVector & inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::LogicalOr>(inputs[0], inputs[1]);
// LogicalXor layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::LogicalXor>::createLayer(
- const ngraph::OutputVector & inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::LogicalXor>(inputs[0], inputs[1]);
// LogicalNot layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::LogicalNot>::createLayer(
- const ngraph::OutputVector & inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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::v1::LogicalNot>(inputs[0]);
// ReduceLogicalAnd layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::ReduceLogicalAnd>::createLayer(
- const ngraph::OutputVector & inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// ReduceLogicalOr layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::ReduceLogicalOr>::createLayer(
- const ngraph::OutputVector & inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ 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");
// NonMaxSuppression layer
template <>
std::shared_ptr<ngraph::Node> V10Parser::LayerCreator<ngraph::op::v1::NonMaxSuppression>::createLayer(
- const ngraph::OutputVector& inputs, const pugi::xml_node& node, const Blob::CPtr& weights,
+ const ngraph::OutputVector& inputs, const pugi::xml_node& node, std::istream& binStream,
const GenericLayerParams& layerParsePrms) {
pugi::xml_node dn = node.child("data");