std::shared_ptr<GNAPlugin> plg;
public:
- GNAExecutableNetwork(const std::string &aotFileName, std::shared_ptr<GNAPlugin> plg)
- : plg(plg) {
- plg->ImportNetwork(aotFileName);
- _networkInputs = plg->GetInputs();
- _networkOutputs = plg->GetOutputs();
- }
+ GNAExecutableNetwork(const std::string& aotFileName, std::shared_ptr<GNAPlugin> plg)
+ : plg(plg) {
+ std::fstream inputStream(aotFileName, std::ios_base::in | std::ios_base::binary);
+ if (inputStream.fail()) {
+ THROW_GNA_EXCEPTION << "Cannot open file to import model: " << aotFileName;
+ }
+
+ plg->ImportNetwork(inputStream);
+ _networkInputs = plg->GetInputs();
+ _networkOutputs = plg->GetOutputs();
+ }
GNAExecutableNetwork(std::istream& networkModel, std::shared_ptr<GNAPlugin> plg)
: plg(plg) {
plg->LoadNetwork(network);
}
- GNAExecutableNetwork(const std::string &aotFileName, const std::map<std::string, std::string> &config)
+ GNAExecutableNetwork(const std::string& aotFileName, const std::map<std::string, std::string>& config)
: GNAExecutableNetwork(aotFileName, std::make_shared<GNAPlugin>(config)) {
}
_pluginName = pluginName;
}
-InferenceEngine::IExecutableNetwork::Ptr GNAPlugin::ImportNetwork(const std::string &modelFileName) {
- // no need to return anything dueto weird design of internal base classes
- std::fstream inputStream(modelFileName, ios_base::in | ios_base::binary);
- if (inputStream.fail()) {
- THROW_GNA_EXCEPTION << "Cannot open file to import model: " << modelFileName;
- }
-
- return ImportNetwork(inputStream);
-}
-
InferenceEngine::IExecutableNetwork::Ptr GNAPlugin::ImportNetwork(std::istream& networkModel) {
auto header = GNAModelSerial::ReadHeader(networkModel);
THROW_GNA_EXCEPTION << "Not implemented";
}
- InferenceEngine::IExecutableNetwork::Ptr ImportNetwork(const std::string &modelFileName);
InferenceEngine::IExecutableNetwork::Ptr ImportNetwork(std::istream& networkModel);
/**
defaultConfig.UpdateFromMap(config);
}
- InferenceEngine::IExecutableNetwork::Ptr ImportNetwork(
+ InferenceEngine::IExecutableNetwork::Ptr ImportNetwork(
const std::string &modelFileName,
const std::map<std::string, std::string> &config) override {
Config updated_config(defaultConfig);
updated_config.UpdateFromMap(config);
auto plg = std::make_shared<GNAPlugin>(updated_config.key_config_map);
plgPtr = plg;
+
return make_executable_network(std::make_shared<GNAExecutableNetwork>(modelFileName, plg));
}
};
auto loadNetworkFromAOT = [&] () {
- auto sp = plugin.ImportNetwork(_env.importedModelFileName);
+ std::fstream inputStream(_env.importedModelFileName, std::ios_base::in | std::ios_base::binary);
+ if (inputStream.fail()) {
+ THROW_GNA_EXCEPTION << "Cannot open file to import model: " << _env.importedModelFileName;
+ }
+
+ auto sp = plugin.ImportNetwork(inputStream);
inputsInfo = plugin.GetInputs();
outputsInfo = plugin.GetOutputs();
};
};
auto loadNetworkFromAOT = [&]() {
- plugin->ImportNetwork(_env.importedModelFileName);
+ std::fstream inputStream(_env.importedModelFileName, std::ios_base::in | std::ios_base::binary);
+ if (inputStream.fail()) {
+ THROW_GNA_EXCEPTION << "Cannot open file to import model: " << _env.importedModelFileName;
+ }
+
+ plugin->ImportNetwork(inputStream);
};
auto loadNetwork = [&]() {