From 1a834b2b85056644aa827aeb5d4e19b681b3d995 Mon Sep 17 00:00:00 2001 From: Jiaming Yuan Date: Thu, 5 Jan 2023 23:16:10 +0800 Subject: [PATCH] Fix linalg iterator. (#8603) (#8639) --- src/common/linalg_op.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/linalg_op.h b/src/common/linalg_op.h index efb9cf300..26cb405f5 100644 --- a/src/common/linalg_op.h +++ b/src/common/linalg_op.h @@ -62,7 +62,7 @@ void ElementWiseKernel(GenericParameter const* ctx, linalg::TensorView t, #endif // !defined(XGBOOST_USE_CUDA) template -auto cbegin(TensorView v) { // NOLINT +auto cbegin(TensorView const& v) { // NOLINT auto it = common::MakeIndexTransformIter([&](size_t i) -> std::remove_cv_t const& { return linalg::detail::Apply(v, linalg::UnravelIndex(i, v.Shape())); }); @@ -70,19 +70,19 @@ auto cbegin(TensorView v) { // NOLINT } template -auto cend(TensorView v) { // NOLINT +auto cend(TensorView const& v) { // NOLINT return cbegin(v) + v.Size(); } template -auto begin(TensorView v) { // NOLINT +auto begin(TensorView& v) { // NOLINT auto it = common::MakeIndexTransformIter( [&](size_t i) -> T& { return linalg::detail::Apply(v, linalg::UnravelIndex(i, v.Shape())); }); return it; } template -auto end(TensorView v) { // NOLINT +auto end(TensorView& v) { // NOLINT return begin(v) + v.Size(); } } // namespace linalg