Skip to content

Commit

Permalink
add asserts in Flatten function to find source of pointer issue
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbkoch committed Dec 25, 2024
1 parent 2f70efa commit fcb70c2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions shared/libebm/PartitionOneDimensionalBoosting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ static ErrorEbm Flatten(BoosterShell* const pBoosterShell,
pUpdateScore = aUpdateScore;

if(bMissing) {
EBM_ASSERT(2 <= cSlices); // no cuts if there was only missing bin

// always put a split on the missing bin
*pSplit = 1;
++pSplit;
Expand Down Expand Up @@ -346,6 +348,8 @@ static ErrorEbm Flatten(BoosterShell* const pBoosterShell,
} while(pGradientPairEnd != pGradientPair);
}

EBM_ASSERT(bNominal || pSplit == cSlices - 1 + pInnerTermUpdate->GetSplitPointer(iDimension));

LOG_0(Trace_Verbose, "Exited Flatten");
return Error_None;
}
Expand All @@ -372,6 +376,7 @@ static ErrorEbm Flatten(BoosterShell* const pBoosterShell,

EBM_ASSERT(!IsConvertError<UIntSplit>(iEdge));
prev = static_cast<UIntSplit>(iEdge);
EBM_ASSERT(pSplit < cSlices - 1 + pInnerTermUpdate->GetSplitPointer(iDimension));
*pSplit = prev;
++pSplit;

Expand Down

0 comments on commit fcb70c2

Please sign in to comment.