From aeb881c9f2cbd8369aadaa62adc88d8716e21d77 Mon Sep 17 00:00:00 2001
From: Olivier BICHLER <olivier.bichler@cea.fr>
Date: Tue, 15 Apr 2025 12:15:08 +0200
Subject: [PATCH] Fix no bias

---
 aidge_export_cpp/kernels/fullyconnected.hpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/aidge_export_cpp/kernels/fullyconnected.hpp b/aidge_export_cpp/kernels/fullyconnected.hpp
index 895ed1c..2780de2 100644
--- a/aidge_export_cpp/kernels/fullyconnected.hpp
+++ b/aidge_export_cpp/kernels/fullyconnected.hpp
@@ -30,7 +30,7 @@ void fullyconnected_forward (
     // Solution: Add a system to check dataformat
     for (int och = 0; och < NB_OUTPUTS; och++) {
 
-        Bias_T weightedSum = biases[och];
+        Bias_T weightedSum = (biases) ? biases[och] : Bias_T(0);
 
         for (int iy = 0; iy < CHANNELS_HEIGHT; ++iy) {
             for (int ix = 0; ix < CHANNELS_WIDTH; ++ix) {
@@ -48,7 +48,7 @@ Here the kernel to use with inputs in NHWC and weights in NHWC
 #pragma omp parallel for
     for (int och = 0; och < NB_OUTPUTS; och++) {
 
-        Bias_T weightedSum = biases[och];
+        Bias_T weightedSum = (biases) ? biases[och] : Bias_T(0);
 
         for (int iy = 0; iy < CHANNELS_HEIGHT; ++iy) {
             const int iPos = (CHANNELS_WIDTH * iy);
-- 
GitLab