From 0d7336ca789afffb54290e6dc1b906eb55a2d981 Mon Sep 17 00:00:00 2001
From: NAUD Maxence <maxence.naud@cea.fr>
Date: Thu, 12 Oct 2023 12:23:15 +0000
Subject: [PATCH] [Fix] assertion for slices with at least one dim the same
 size as input dim

---
 include/aidge/operator/Slice.hpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/aidge/operator/Slice.hpp b/include/aidge/operator/Slice.hpp
index 839d873a0..6b1077c8d 100644
--- a/include/aidge/operator/Slice.hpp
+++ b/include/aidge/operator/Slice.hpp
@@ -102,7 +102,7 @@ public:
             // xxooo               xxxoo
             std::vector<std::size_t> beginningCoords = mInput->getCoord(this->template getAttr<SliceAttr::Beginning>());
             for (std::size_t i = 0; i < DIM; ++i) {
-                if (beginningCoords[i] + this->template getAttr<SliceAttr::SliceDims>()[i] >= mInput->dims()[i]) {
+                if (beginningCoords[i] + this->template getAttr<SliceAttr::SliceDims>()[i] > mInput->dims()[i]) {
                     printf("ROI of Slice operator out of bounds");
                     exit(-1);
                 } else {
@@ -164,7 +164,7 @@ public:
     inline IOIndex_t nbOutputs() const noexcept override final { return 1; }
 };
 
-template <DimIdx_t DIM>
+template <std::size_t DIM>
 inline std::shared_ptr<Node> Slice(std::size_t beginningPos, std::array<DimSize_t, DIM> sliceDims,
                                    const std::string &name = "") {
     // FIXME: properly handle default w&b initialization in every cases
-- 
GitLab