Fix thread safety of softmax prediction. (#7104)

This commit is contained in:
Jiaming Yuan
2021-07-16 02:06:55 +08:00
committed by GitHub
parent 2801d69fb7
commit abec3dbf6d
6 changed files with 20 additions and 23 deletions

View File

@@ -68,7 +68,7 @@ class HingeObj : public ObjFunction {
out_gpair, &preds, &info.labels_, &info.weights_);
}
void PredTransform(HostDeviceVector<bst_float> *io_preds) override {
void PredTransform(HostDeviceVector<bst_float> *io_preds) const override {
common::Transform<>::Init(
[] XGBOOST_DEVICE(size_t _idx, common::Span<bst_float> _preds) {
_preds[_idx] = _preds[_idx] > 0.0 ? 1.0 : 0.0;