Skip to content

Commit

Permalink
fix the negative dimension error in python predict
Browse files Browse the repository at this point in the history
  • Loading branch information
guolinke committed Aug 23, 2018
1 parent 941068e commit 542c34d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/c_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class Booster {
OMP_LOOP_EX_END();
}
OMP_THROW_EX();
*out_len = nrow * num_pred_in_one_row;
*out_len = num_pred_in_one_row * nrow;
}

void Predict(int num_iteration, int predict_type, const char* data_filename,
Expand Down Expand Up @@ -1088,8 +1088,8 @@ int LGBM_BoosterCalcNumPredict(BoosterHandle handle,
int64_t* out_len) {
API_BEGIN();
Booster* ref_booster = reinterpret_cast<Booster*>(handle);
*out_len = static_cast<int64_t>(num_row * ref_booster->GetBoosting()->NumPredictOneRow(
num_iteration, predict_type == C_API_PREDICT_LEAF_INDEX, predict_type == C_API_PREDICT_CONTRIB));
*out_len = static_cast<int64_t>(num_row) * ref_booster->GetBoosting()->NumPredictOneRow(
num_iteration, predict_type == C_API_PREDICT_LEAF_INDEX, predict_type == C_API_PREDICT_CONTRIB);
API_END();
}

Expand Down

0 comments on commit 542c34d

Please sign in to comment.