[dask] Fix empty partition with pandas input. (#7644)

Empty partition is different from empty dataset.  For the former case, each worker has
non-empty dask collections, but each collection might contain empty partition.
This commit is contained in:
Jiaming Yuan
2022-02-14 19:35:51 +08:00
committed by GitHub
parent 1f020a6097
commit b52c4e13b0
3 changed files with 34 additions and 12 deletions

View File

@@ -85,12 +85,9 @@ void Predictor::InitOutPredictions(const MetaInfo& info, HostDeviceVector<bst_fl
ValidateBaseMarginShape(info.base_margin_, info.num_row_, n_classes);
out_preds->Copy(*base_margin);
} else {
if (out_preds->Empty()) {
out_preds->Resize(n, model.learner_model_param->base_score);
} else {
out_preds->Resize(n);
out_preds->Fill(model.learner_model_param->base_score);
}
out_preds->Resize(n);
// cannot rely on the Resize to fill as it might skip if the size is already correct.
out_preds->Fill(model.learner_model_param->base_score);
}
}
} // namespace xgboost