Skip to content

Commit 3d51c8f

Browse files
committed
check for numInputNodes == numCachedIndices in init()
1 parent 33bb1c0 commit 3d51c8f

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Tools/ML/MlResponse.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,13 @@ class MlResponse
151151
void init(bool enableOptimizations = false, int threads = 0)
152152
{
153153
uint8_t counterModel{0};
154+
const int numCachedIndices = static_cast<int>(mCachedIndices.size());
154155
for (const auto& path : mPaths) {
155156
mModels[counterModel].initModel(path, enableOptimizations, threads);
157+
const int numInputNodes = mModels[counterModel].getNumInputNodes();
158+
if (numInputNodes != numCachedIndices) {
159+
LOG(fatal) << "Number of input nodes in the model " << path << " is different from the number of input features indices (" << numInputNodes << " vs " << numCachedIndices << ")";
160+
}
156161
++counterModel;
157162
}
158163
}

0 commit comments

Comments
 (0)