/*! * Copyright (c) 2022 Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE file in the project root for * license information. */ #ifdef USE_CUDA #include #include "cuda_regression_metric.hpp" namespace LightGBM { template std::vector CUDARegressionMetricInterface::Eval(const double* score, const ObjectiveFunction* objective) const { const double* score_convert = score; if (objective != nullptr && objective->NeedConvertOutputCUDA()) { this->score_convert_buffer_.Resize(static_cast(this->num_data_) * static_cast(this->num_class_)); score_convert = objective->ConvertOutputCUDA(this->num_data_, score, this->score_convert_buffer_.RawData()); } double sum_loss = 0.0, sum_weight = 0.0; this->LaunchEvalKernel(score_convert, &sum_loss, &sum_weight); const double eval_score = this->AverageLoss(sum_loss, sum_weight); return std::vector{eval_score}; } CUDARMSEMetric::CUDARMSEMetric(const Config& config): CUDARegressionMetricInterface(config) {} CUDAL2Metric::CUDAL2Metric(const Config& config): CUDARegressionMetricInterface(config) {} } // namespace LightGBM #endif // USE_CUDA