diff options
author | Derek Lamberti <derek.lamberti@arm.com> | 2019-02-18 16:36:57 +0000 |
---|---|---|
committer | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-02-19 17:07:12 +0000 |
commit | 2b183fb359774cbac5d628579ec2b4a7b6b41def (patch) | |
tree | 764f4ee3293bc419ee204b1685d17bb59df410ac /tests/InferenceModel.hpp | |
parent | 263829c2163d79a28f98f24f9dd1e52e1c3cbbef (diff) | |
download | armnn-2b183fb359774cbac5d628579ec2b4a7b6b41def.tar.gz |
IVGCVSW-2736 Deserialize using istream instead of filename
Change-Id: I5656b23d9783e7f953e677001d16e41eedeb42b2
Signed-off-by: Derek Lamberti <derek.lamberti@arm.com>
Diffstat (limited to 'tests/InferenceModel.hpp')
-rw-r--r-- | tests/InferenceModel.hpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/InferenceModel.hpp b/tests/InferenceModel.hpp index eb3b2ccd42..4819523595 100644 --- a/tests/InferenceModel.hpp +++ b/tests/InferenceModel.hpp @@ -183,8 +183,20 @@ public: { ARMNN_SCOPED_HEAP_PROFILING("Parsing"); - const std::string& modelPath = params.m_ModelPath; - network = parser->CreateNetworkFromBinaryFile(modelPath.c_str()); + + boost::system::error_code errorCode; + boost::filesystem::path pathToFile(params.m_ModelPath); + if (!boost::filesystem::exists(pathToFile, errorCode)) + { + throw armnn::FileNotFoundException(boost::str( + boost::format("Cannot find the file (%1%) errorCode: %2% %3%") % + params.m_ModelPath % + errorCode % + CHECK_LOCATION().AsString())); + } + std::ifstream file(params.m_ModelPath, std::ios::binary); + + network = parser->CreateNetworkFromBinary(file); } unsigned int subGraphId = boost::numeric_cast<unsigned int>(params.m_SubgraphId); |