@@ -293,6 +293,7 @@ static ErrorEbm Flatten(BoosterShell* const pBoosterShell,
293293 deltaStepMax);
294294 }
295295
296+ EBM_ASSERT (pUpdateScore < aUpdateScore + cScores * cSlices);
296297 *pUpdateScore = static_cast <FloatScore>(updateScore);
297298 ++pUpdateScore;
298299
@@ -322,6 +323,20 @@ static ErrorEbm Flatten(BoosterShell* const pBoosterShell,
322323 done:;
323324 EBM_ASSERT (cSamplesTotalDebug == cSamplesExpectedDebug);
324325
326+ EBM_ASSERT (bNominal || pUpdateScore == aUpdateScore + cScores * cSlices);
327+
328+ EBM_ASSERT (bNominal || pSplit == cSlices - 1 + pInnerTermUpdate->GetSplitPointer (iDimension));
329+
330+ #ifndef NDEBUG
331+ UIntSplit prevDebug = 0 ;
332+ for (size_t iDebug = 0 ; iDebug < cSlices - 1 ; ++iDebug) {
333+ UIntSplit curDebug = pInnerTermUpdate->GetSplitPointer (iDimension)[iDebug];
334+ EBM_ASSERT (prevDebug < curDebug);
335+ prevDebug = curDebug;
336+ }
337+ EBM_ASSERT (prevDebug < cBins);
338+ #endif
339+
325340 EBM_ASSERT (nullptr == pMissingValueTreeNode || nullptr != pMissingBin);
326341 if (nullptr != pMissingBin) {
327342 EBM_ASSERT (bMissing);
@@ -347,18 +362,6 @@ static ErrorEbm Flatten(BoosterShell* const pBoosterShell,
347362 } while (pGradientPairEnd != pGradientPair);
348363 }
349364
350- EBM_ASSERT (bNominal || pSplit == cSlices - 1 + pInnerTermUpdate->GetSplitPointer (iDimension));
351-
352- #ifndef NDEBUG
353- UIntSplit prevDebug = 0 ;
354- for (size_t iDebug = 0 ; iDebug < cSlices - 1 ; ++iDebug) {
355- UIntSplit curDebug = pInnerTermUpdate->GetSplitPointer (iDimension)[iDebug];
356- EBM_ASSERT (prevDebug < curDebug);
357- prevDebug = curDebug;
358- }
359- EBM_ASSERT (prevDebug < cBins);
360- #endif
361-
362365 LOG_0 (Trace_Verbose, " Exited Flatten" );
363366 return Error_None;
364367 }
@@ -379,6 +382,7 @@ static ErrorEbm Flatten(BoosterShell* const pBoosterShell,
379382 if (cBins == iEdge) {
380383 // This cut would isolate the missing bin, but missing already has a cut.
381384 // We still need to find the missing bin though in the tree, so continue.
385+ bDone = true ;
382386 break ;
383387 }
384388 }
0 commit comments