From a10e4cba4e602ae4b24b93e4325b5fc4da99b7bd Mon Sep 17 00:00:00 2001 From: Jiaming Yuan Date: Fri, 16 Dec 2022 23:05:03 +0800 Subject: [PATCH] Fix linalg iterator. (#8603) --- 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 9ae353311..f55927402 100644 --- a/src/common/linalg_op.h +++ b/src/common/linalg_op.h @@ -63,7 +63,7 @@ void ElementWiseKernel(Context const* ctx, linalg::TensorView t, Fn&& fn) #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())); }); @@ -71,19 +71,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