diff --git a/include/aidge/backend/cpu/operator/GatherImpl_forward_kernels.hpp b/include/aidge/backend/cpu/operator/GatherImpl_forward_kernels.hpp index 591985e88ef337f69d79463935ea0d2d258f49e3..1373c8a64d37258a4cc112dfe5a23c1589587ccc 100644 --- a/include/aidge/backend/cpu/operator/GatherImpl_forward_kernels.hpp +++ b/include/aidge/backend/cpu/operator/GatherImpl_forward_kernels.hpp @@ -27,7 +27,9 @@ void GatherImpl_cpu_forward_kernel(const typename Gather_Op::Attrs& attrs, const const I* input = static_cast<const I*>(input_); O* output = static_cast<O*>(output_); - std::size_t axisIdx = std::get<2>(attrs)>=0 ? std::get<2>(attrs) : static_cast<std::size_t>(std::get<2>(attrs)) + inputDims.size(); + const std::size_t axisIdx = std::get<2>(attrs)>=0 ? + std::get<2>(attrs) : + static_cast<std::size_t>(std::get<2>(attrs)) + inputDims.size(); std::size_t postAxisElems = 1; for (std::size_t i = axisIdx + 1; i < inputDims.size(); ++i) { @@ -38,12 +40,12 @@ void GatherImpl_cpu_forward_kernel(const typename Gather_Op::Attrs& attrs, const preAxisElems *= inputDims[i]; } - std::vector<std::int64_t> indices = std::get<0>(attrs); + const std::vector<std::int64_t> indices = std::get<0>(attrs); for (std::size_t i=0; i<preAxisElems; ++i) { for(std::size_t j=0; j<indices.size(); ++j) { - std::size_t idx = indices[j] >= 0 ? indices[j] : indices[j] + inputDims[axisIdx]; + const std::size_t idx = indices[j] >= 0 ? indices[j] : indices[j] + inputDims[axisIdx]; const I* startPtr = std::next(input, i * postAxisElems * inputDims[axisIdx] + idx * postAxisElems); std::copy_n(startPtr, postAxisElems, output); output += postAxisElems; diff --git a/include/aidge/backend/cpu/operator/ReduceMeanImpl_forward_kernels.hpp b/include/aidge/backend/cpu/operator/ReduceMeanImpl_forward_kernels.hpp index cc9a0a7df98f8ab6a185a3aecc650d78f04e14a6..810f8457db3d3b6e01c915945d63d082acd451fd 100644 --- a/include/aidge/backend/cpu/operator/ReduceMeanImpl_forward_kernels.hpp +++ b/include/aidge/backend/cpu/operator/ReduceMeanImpl_forward_kernels.hpp @@ -30,7 +30,7 @@ void ReduceMeanImpl_cpu_forward_kernel(const typename ReduceMean_Op<DIM>::Attrs& const I* input = static_cast<const I*>(input_); O* output = static_cast<O*>(output_); - DimSize_t keepDims = std::get<1>(attrs); + const DimSize_t keepDims = std::get<1>(attrs); // Calculate the total number of elements in the input array size_t totalElements = 1; for (size_t dimSize : inputDims) {