From 5bc725397104cf1ea91539e837bbf19d7ecc86dd Mon Sep 17 00:00:00 2001 From: NAUD Maxence <maxence.naud@cea.fr> Date: Thu, 18 Apr 2024 14:17:51 +0000 Subject: [PATCH] Add asserts in Conv::forwardDims() member function --- include/aidge/operator/Conv.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/aidge/operator/Conv.hpp b/include/aidge/operator/Conv.hpp index d03bcda4e..f0c6c12d7 100644 --- a/include/aidge/operator/Conv.hpp +++ b/include/aidge/operator/Conv.hpp @@ -117,6 +117,17 @@ public: } associated &= !(getInput(i)->empty()); } + AIDGE_ASSERT((getInput(0)->nbDims() == (DIM+2)) && + (getInput(0)->template dims<DIM+2>()[1] == this->template getAttr<ConvAttr::InChannels>()), + "Wrong input size for Conv operator."); + AIDGE_ASSERT((getInput(1)->nbDims() == (DIM+2)) && + (getInput(1)->template dims<DIM+2>()[1] == this->template getAttr<ConvAttr::InChannels>()) && + (getInput(1)->template dims<DIM+2>()[0] == this->template getAttr<ConvAttr::OutChannels>()), + "Wrong weight size for Conv operator."); + if(!this->template getAttr<ConvAttr::NoBias>()) + AIDGE_ASSERT((getInput(2)->nbDims() == (1)) && + (getInput(2)->template dims<1>()[0] == this->template getAttr<ConvAttr::OutChannels>()), + "Wrong bias size for Conv operator."); if (associated) { std::array<DimSize_t, DIM + 2> outputDims{}; const std::array<DimSize_t, DIM + 2> inputDims(getInput(0)->template dims<DIM+2>()); -- GitLab