From 6fb4e868430df2d59bc02c699b32bc93f48de830 Mon Sep 17 00:00:00 2001 From: fis Date: Wed, 20 May 2020 15:53:53 +0800 Subject: [PATCH] Resolve. --- src/tree/param.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tree/param.h b/src/tree/param.h index 0831cc0db619..82eba52bb1a6 100644 --- a/src/tree/param.h +++ b/src/tree/param.h @@ -272,7 +272,7 @@ XGBOOST_DEVICE inline T CalcGainGivenWeight(const TrainingParams &p, // calculate the cost of loss function template -XGBOOST_DEVICE inline T CalcGain(const TrainingParams &p, T sum_grad, T sum_hess) { +XGBOOST_DEVICE inline T CalcGain(const TrainingParams &p, T const& sum_grad, T const& sum_hess) { if (sum_hess < p.min_child_weight) { return T(0.0); } @@ -295,8 +295,8 @@ XGBOOST_DEVICE inline T CalcGain(const TrainingParams &p, T sum_grad, T sum_hess } template -XGBOOST_DEVICE inline T CalcGain(const TrainingParams &p, StatT stat) { + typename StatT, typename T = typename std::remove_reference< decltype(StatT().GetHess()) >::type> +XGBOOST_DEVICE inline T CalcGain(const TrainingParams &p, StatT const& stat) { return CalcGain(p, stat.GetGrad(), stat.GetHess()); }