Implement GPU predict leaf. (#6187)

This commit is contained in:
Jiaming Yuan
2020-11-11 17:33:47 +08:00
committed by GitHub
parent 7f101d1b33
commit 8a17610666
12 changed files with 252 additions and 42 deletions

View File

@@ -147,9 +147,7 @@ class GBLinear : public GradientBooster {
}
}
void PredictLeaf(DMatrix*,
std::vector<bst_float>*,
unsigned) override {
void PredictLeaf(DMatrix *, HostDeviceVector<bst_float> *, unsigned) override {
LOG(FATAL) << "gblinear does not support prediction of leaf index";
}

View File

@@ -278,10 +278,9 @@ class GBTree : public GradientBooster {
}
void PredictLeaf(DMatrix* p_fmat,
std::vector<bst_float>* out_preds,
HostDeviceVector<bst_float>* out_preds,
unsigned ntree_limit) override {
CHECK(configured_);
cpu_predictor_->PredictLeaf(p_fmat, out_preds, model_, ntree_limit);
this->GetPredictor()->PredictLeaf(p_fmat, out_preds, model_, ntree_limit);
}
void PredictContribution(DMatrix* p_fmat,