From eaa8ff98debc78b44e6bbef3bf092c046a2723d0 Mon Sep 17 00:00:00 2001
From: hrouis <houssemeddine.rouis92@gmail.com>
Date: Mon, 10 Feb 2025 15:53:32 +0100
Subject: [PATCH] support 2D bias in FC

---
 src/operator/FC.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/operator/FC.cpp b/src/operator/FC.cpp
index dd1d0577e..26752a359 100644
--- a/src/operator/FC.cpp
+++ b/src/operator/FC.cpp
@@ -62,8 +62,13 @@ bool Aidge::FC_Op::forwardDims(bool /*allowDataDependency*/) {
         }
         // check optional bias
         if(getInput(2))
-            AIDGE_ASSERT((getInput(2)->nbDims() == 1) &&
-                    (getInput(2)->template dims<1>()[0] == outChannels),
+            AIDGE_ASSERT((((getInput(2)->nbDims() == 1) &&
+                    (getInput(2)->template dims<1>()[0] == outChannels)) ||
+                    ((getInput(2)->nbDims() == 2)&&
+                     (getInput(0)->nbDims() == 2)&&
+                     (getInput(2)->template dims<2>()[0] == getInput(0)->template dims<2>()[0])&&
+                     (getInput(2)->template dims<2>()[1] == outChannels)
+                     )),
                     "Wrong bias size for FC operator.");
         // <batch, OutChannels>
         mOutputs[0]->resize({getInput(0)->dims()[0], outChannels});
-- 
GitLab