From 3d51c8f0d7e3bb07ff4799c2d74df6435d95fe4c Mon Sep 17 00:00:00 2001 From: Oleksii Lubynets Date: Wed, 27 May 2026 22:54:00 +0200 Subject: [PATCH] check for numInputNodes == numCachedIndices in init() --- Tools/ML/MlResponse.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Tools/ML/MlResponse.h b/Tools/ML/MlResponse.h index 75da1b8decb..32678222256 100644 --- a/Tools/ML/MlResponse.h +++ b/Tools/ML/MlResponse.h @@ -151,8 +151,13 @@ class MlResponse void init(bool enableOptimizations = false, int threads = 0) { uint8_t counterModel{0}; + const int numCachedIndices = static_cast(mCachedIndices.size()); for (const auto& path : mPaths) { mModels[counterModel].initModel(path, enableOptimizations, threads); + const int numInputNodes = mModels[counterModel].getNumInputNodes(); + if (numInputNodes != numCachedIndices) { + LOG(fatal) << "Number of input nodes in the model " << path << " is different from the number of input features indices (" << numInputNodes << " vs " << numCachedIndices << ")"; + } ++counterModel; } }