diff options
author | Colm Donelan <colm.donelan@arm.com> | 2023-06-22 10:19:17 +0100 |
---|---|---|
committer | Colm Donelan <colm.donelan@arm.com> | 2023-06-30 14:20:56 +0100 |
commit | 0dfb2658ce521571aa0f9e859f813c60fda9d8d6 (patch) | |
tree | ef4605cebb29c6754da8dfea0decd4250288e2a5 /src/armnnTfLiteParser/TfLiteParser.cpp | |
parent | 16e27cf81424dcad05d129f9ba368a8c446cd25f (diff) | |
download | armnn-0dfb2658ce521571aa0f9e859f813c60fda9d8d6.tar.gz |
IVGCVSW-7666 Add a FileComparisonExecutor to ExecuteNetwork.
* Implement the "-C" command line option of executenetwork.
* Add a FileComparisonExecutorFile which will read tensors from
a previously written text file and compare them to the execution
output.
Signed-off-by: Colm Donelan <colm.donelan@arm.com>
Change-Id: I8380fd263028af13d65a67fb6afd89626d1b07b8
Diffstat (limited to 'src/armnnTfLiteParser/TfLiteParser.cpp')
-rw-r--r-- | src/armnnTfLiteParser/TfLiteParser.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/armnnTfLiteParser/TfLiteParser.cpp b/src/armnnTfLiteParser/TfLiteParser.cpp index 199a853918..1c5b4fc9f0 100644 --- a/src/armnnTfLiteParser/TfLiteParser.cpp +++ b/src/armnnTfLiteParser/TfLiteParser.cpp @@ -4876,9 +4876,15 @@ TfLiteParserImpl::ModelPtr TfLiteParserImpl::LoadModelFromFile(const char* fileN std::stringstream msg; msg << "Cannot find the file (" << fileName << ") errorCode: " << errorCode << " " << CHECK_LOCATION().AsString(); - throw FileNotFoundException(msg.str()); } + if (!fs::is_regular_file(pathToFile)) + { + // Exclude non regular files. + throw InvalidArgumentException(fmt::format("File \"{}\" is not a regular file and cannot be loaded.", + pathToFile.c_str())); + } + std::ifstream file(fileName, std::ios::binary); std::string fileContent((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>()); return LoadModelFromBinary(reinterpret_cast<const uint8_t *>(fileContent.c_str()), |