MCPcopy Create free account
hub / github.com/ARM-software/armnn / Execute

Method Execute

tests/ExecuteNetwork/FileComparisonExecutor.cpp:324–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

322{}
323
324std::vector<const void*> FileComparisonExecutor::Execute()
325{
326 std::string filesToCompare = this->m_Params.m_ComparisonFile;
327 if (filesToCompare.empty())
328 {
329 throw InvalidArgumentException("The file(s) to compare was not set.");
330 }
331 // filesToCompare is one or more files containing output tensors. Iterate and read in the tensors.
332 // We'll assume the string follows the same comma seperated format as write-outputs-to-file.
333 std::stringstream ss(filesToCompare);
334 std::vector<std::string> fileNames;
335 std::string errorString;
336 while (ss.good())
337 {
338 std::string substr;
339 getline(ss, substr, ',');
340 // Check the file exist.
341 if (!ghc::filesystem::exists(substr))
342 {
343 errorString += substr + " ";
344 }
345 else
346 {
347 fileNames.push_back(substr);
348 }
349 }
350 if (!errorString.empty())
351 {
352 throw FileNotFoundException("The following file(s) to compare could not be found: " + errorString);
353 }
354 // Read in the tensors into m_OutputTensorsVec
355 OutputTensors outputs;
356 std::vector<const void*> results;
357 for (auto file : fileNames)
358 {
359 Tensor t;
360 if (file.find(".npy") == std::string::npos)
361 {
362 t = ReadTensorFromFile(file);
363 }
364 else
365 {
366 t = ReadTensorFromNumpyFile(file);
367 }
368
369 outputs.push_back({ 0, Tensor(t.GetInfo(), t.GetMemoryArea()) });
370 results.push_back(t.GetMemoryArea());
371 }
372 m_OutputTensorsVec.push_back(outputs);
373 return results;
374}
375
376void FileComparisonExecutor::PrintNetworkInfo()
377{

Callers

nothing calls this directly

Calls 9

existsFunction · 0.85
ReadTensorFromFileFunction · 0.85
ReadTensorFromNumpyFileFunction · 0.85
emptyMethod · 0.80
push_backMethod · 0.80
GetMemoryAreaMethod · 0.80
TensorClass · 0.70

Tested by

no test coverage detected