Align device id in predict transform with predictor. (#6662)
This commit is contained in:
@@ -108,7 +108,7 @@ class AFTObj : public ObjFunction {
|
||||
[] XGBOOST_DEVICE(size_t _idx, common::Span<bst_float> _preds) {
|
||||
_preds[_idx] = exp(_preds[_idx]);
|
||||
}, common::Range{0, static_cast<int64_t>(io_preds->Size())},
|
||||
tparam_->gpu_id)
|
||||
io_preds->DeviceIdx())
|
||||
.Eval(io_preds);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ class HingeObj : public ObjFunction {
|
||||
_preds[_idx] = _preds[_idx] > 0.0 ? 1.0 : 0.0;
|
||||
},
|
||||
common::Range{0, static_cast<int64_t>(io_preds->Size()), 1},
|
||||
tparam_->gpu_id)
|
||||
io_preds->DeviceIdx())
|
||||
.Eval(io_preds);
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ class SoftmaxMultiClassObj : public ObjFunction {
|
||||
const auto ndata = static_cast<int64_t>(io_preds->Size() / nclass);
|
||||
max_preds_.Resize(ndata);
|
||||
|
||||
auto device = tparam_->gpu_id;
|
||||
auto device = io_preds->DeviceIdx();
|
||||
if (prob) {
|
||||
common::Transform<>::Init(
|
||||
[=] XGBOOST_DEVICE(size_t _idx, common::Span<bst_float> _preds) {
|
||||
|
||||
@@ -113,7 +113,7 @@ class RegLossObj : public ObjFunction {
|
||||
[] XGBOOST_DEVICE(size_t _idx, common::Span<float> _preds) {
|
||||
_preds[_idx] = Loss::PredTransform(_preds[_idx]);
|
||||
}, common::Range{0, static_cast<int64_t>(io_preds->Size())},
|
||||
tparam_->gpu_id)
|
||||
io_preds->DeviceIdx())
|
||||
.Eval(io_preds);
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ class PoissonRegression : public ObjFunction {
|
||||
_preds[_idx] = expf(_preds[_idx]);
|
||||
},
|
||||
common::Range{0, static_cast<int64_t>(io_preds->Size())},
|
||||
tparam_->gpu_id)
|
||||
io_preds->DeviceIdx())
|
||||
.Eval(io_preds);
|
||||
}
|
||||
void EvalTransform(HostDeviceVector<bst_float> *io_preds) override {
|
||||
@@ -426,7 +426,7 @@ class GammaRegression : public ObjFunction {
|
||||
_preds[_idx] = expf(_preds[_idx]);
|
||||
},
|
||||
common::Range{0, static_cast<int64_t>(io_preds->Size())},
|
||||
tparam_->gpu_id)
|
||||
io_preds->DeviceIdx())
|
||||
.Eval(io_preds);
|
||||
}
|
||||
void EvalTransform(HostDeviceVector<bst_float> *io_preds) override {
|
||||
@@ -529,7 +529,7 @@ class TweedieRegression : public ObjFunction {
|
||||
_preds[_idx] = expf(_preds[_idx]);
|
||||
},
|
||||
common::Range{0, static_cast<int64_t>(io_preds->Size())},
|
||||
tparam_->gpu_id)
|
||||
io_preds->DeviceIdx())
|
||||
.Eval(io_preds);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user