Skip to content

Commit

Permalink
add pred_leaf to reshape if condition
Browse files Browse the repository at this point in the history
  • Loading branch information
RektPunk committed Dec 14, 2024
1 parent b33a12e commit 4c627cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python-package/lightgbm/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,7 @@ def predict(
if pred_leaf:
preds = preds.astype(np.int32)
is_sparse = isinstance(preds, (list, scipy.sparse.spmatrix))
if not is_sparse and preds.size != nrow:
if not is_sparse and preds.size != nrow or pred_leaf:
if preds.size % nrow == 0:
preds = preds.reshape(nrow, -1)
else:
Expand Down

0 comments on commit 4c627cb

Please sign in to comment.