From da6331205f2c79ff572611c1f9d34b13254d2d1c Mon Sep 17 00:00:00 2001 From: hrouis <houssemeddine.rouis92@gmail.com> Date: Thu, 25 Jan 2024 15:06:00 +0100 Subject: [PATCH] add consts --- src/operator/Gather.cpp | 8 ++++---- src/operator/Slice.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/operator/Gather.cpp b/src/operator/Gather.cpp index 2bba696e9..3eafe99ef 100644 --- a/src/operator/Gather.cpp +++ b/src/operator/Gather.cpp @@ -27,12 +27,12 @@ void Aidge::Gather_Op::computeOutputDims() { } std::vector<DimSize_t> outDims = getInput(0)->dims(); - std::vector<DimSize_t> gatheredShape = this->template getAttr<GatherAttr::GatheredShape>(); + const std::vector<DimSize_t> gatheredShape = this->template getAttr<GatherAttr::GatheredShape>(); // TODO: check indices and gatheredShape - std::int64_t axisIdx = this->template getAttr<GatherAttr::Axis>() >= 0 ? - this->template getAttr<GatherAttr::Axis>() : - this->template getAttr<GatherAttr::Axis>() + outDims.size(); + const std::int64_t axisIdx = this->template getAttr<GatherAttr::Axis>() >= 0 ? + this->template getAttr<GatherAttr::Axis>() : + this->template getAttr<GatherAttr::Axis>() + outDims.size(); outDims.erase(outDims.begin() + static_cast<std::size_t>(axisIdx)); if (!gatheredShape.empty()) { diff --git a/src/operator/Slice.cpp b/src/operator/Slice.cpp index 40f74adfb..a0336c39b 100644 --- a/src/operator/Slice.cpp +++ b/src/operator/Slice.cpp @@ -30,7 +30,7 @@ void Aidge::Slice_Op::computeOutputDims() { AIDGE_THROW_OR_ABORT(std::runtime_error, "Every input should be associated with a Tensor"); } - DimSize_t nbAxes = this->template getAttr<SliceAttr::Axes>().size(); + const DimSize_t nbAxes = this->template getAttr<SliceAttr::Axes>().size(); std::vector<DimSize_t> outDims = getInput(0)->dims(); for (std::size_t i = 0; i < nbAxes; ++i) { // For each slice operation get the params and cast them to size_t -- GitLab