From 8b55e9c73216f2a22da6e2940aaf956e2b94685c Mon Sep 17 00:00:00 2001 From: fis Date: Tue, 23 Aug 2022 17:00:46 +0800 Subject: [PATCH] Empty dmatrix. --- src/objective/regression_obj.cu | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/objective/regression_obj.cu b/src/objective/regression_obj.cu index de4c32304d5b..a19ab7a649fc 100644 --- a/src/objective/regression_obj.cu +++ b/src/objective/regression_obj.cu @@ -707,6 +707,11 @@ class MeanAbsoluteError : public ObjFunction { CheckInitInputs(info); base_margin->Reshape(1); auto h_base_margin = base_margin->HostView(); + if (info.num_row_ == 0) { + h_base_margin(0) = DefaultBaseScore(); + return; + } + if (ctx_->IsCPU()) { h_base_margin(0) = common::Median(ctx_, info.labels.HostView(), common::OptionalWeights{info.weights_.ConstHostSpan()});