From e941e9fec593c352d5c7f315713e9c3f99dc0b2c Mon Sep 17 00:00:00 2001 From: NAUD Maxence <maxence.naud@cea.fr> Date: Thu, 8 Feb 2024 17:45:41 +0000 Subject: [PATCH] [Fix] set axis conversion to positive values in 'computeOutputDims()' --- include/aidge/operator/ReduceMean.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/aidge/operator/ReduceMean.hpp b/include/aidge/operator/ReduceMean.hpp index df8cc2296..5f07cddfa 100644 --- a/include/aidge/operator/ReduceMean.hpp +++ b/include/aidge/operator/ReduceMean.hpp @@ -79,12 +79,12 @@ class ReduceMean_Op : public OperatorTensor, if (val < 0) val+=static_cast<std::int32_t>(getInput(0)->nbDims()); }); - std::sort(axes.cbegin(), axes.cend()); + std::sort(axes.begin(), axes.end()); // build output dimensions std::vector<DimSize_t> outDims = getInput(0)->dims(); if (this->template getAttr<ReduceMeanAttr::KeepDims>()) { - std::for_each(axes.begin(), axes.end(), [&] (const std::int32_t& val) { outDims[val] = 1; }); + std::for_each(axes.begin(), axes.end(), [&outDims] (const std::int32_t& val) { outDims[val] = 1; }); } else { for (auto it = axes.crbegin(); it != axes.crend(); ++it) -- GitLab