aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDerek Lamberti <derek.lamberti@arm.com>2019-02-18 16:36:57 +0000
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-02-19 17:07:12 +0000
commit2b183fb359774cbac5d628579ec2b4a7b6b41def (patch)
tree764f4ee3293bc419ee204b1685d17bb59df410ac /tests
parent263829c2163d79a28f98f24f9dd1e52e1c3cbbef (diff)
downloadarmnn-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')
-rw-r--r--tests/InferenceModel.hpp16
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);