diff --git a/Control/AthenaExamples/AthExOnnxRuntime/src/EvaluateModelWithAthInfer.cxx b/Control/AthenaExamples/AthExOnnxRuntime/src/EvaluateModelWithAthInfer.cxx index 69bb75607a587402d3017923ac31c104c8fcfc39..fdbede393de2fee0595a4a7574e5add2a46d25c2 100644 --- a/Control/AthenaExamples/AthExOnnxRuntime/src/EvaluateModelWithAthInfer.cxx +++ b/Control/AthenaExamples/AthExOnnxRuntime/src/EvaluateModelWithAthInfer.cxx @@ -55,7 +55,7 @@ StatusCode EvaluateModelWithAthInfer::execute( [[maybe_unused]] const EventConte ATH_MSG_DEBUG("Label for the input test data: "); for(int ibatch = 0; ibatch < m_batchSize; ibatch++){ float max = -999; - int max_index; + int max_index{-1}; for (int i = 0; i < 10; i++){ ATH_MSG_DEBUG("Score for class "<< i <<" = "<<outputScores[i] << " in batch " << ibatch); int index = i + ibatch * 10; @@ -64,6 +64,10 @@ StatusCode EvaluateModelWithAthInfer::execute( [[maybe_unused]] const EventConte max_index = index; } } + if (max_index<0){ + ATH_MSG_ERROR("No maximum found in EvaluateModelWithAthInfer::execute"); + return StatusCode::FAILURE; + } ATH_MSG_DEBUG("Class: "<<max_index<<" has the highest score: "<<outputScores[max_index] << " in batch " << ibatch); } diff --git a/Control/AthenaExamples/AthExOnnxRuntime/src/EvaluateModelWithAthInfer.h b/Control/AthenaExamples/AthExOnnxRuntime/src/EvaluateModelWithAthInfer.h index 769a4324ee9960229d7c819ebc177b2f1ed6e8e9..97577f5e2b950d66df2f8b6d1512cf1c9065de78 100644 --- a/Control/AthenaExamples/AthExOnnxRuntime/src/EvaluateModelWithAthInfer.h +++ b/Control/AthenaExamples/AthExOnnxRuntime/src/EvaluateModelWithAthInfer.h @@ -14,7 +14,6 @@ #include <onnxruntime_cxx_api.h> // System include(s). -#include <memory> #include <string> #include <vector>