diff --git a/include/aidge/backend/cpu/operator/ConvDepthWiseImpl_forward_kernels.hpp b/include/aidge/backend/cpu/operator/ConvDepthWiseImpl_forward_kernels.hpp index 95a1aaeccbe728eb2bb957913a5b79f4b8a9548b..801bd315f9e5058ffade574fc92179b1e3c513e4 100644 --- a/include/aidge/backend/cpu/operator/ConvDepthWiseImpl_forward_kernels.hpp +++ b/include/aidge/backend/cpu/operator/ConvDepthWiseImpl_forward_kernels.hpp @@ -64,7 +64,7 @@ void ConvDepthWiseImpl2D_cpu_forward_kernel(const ConvDepthWise_Op<2>::Attrs &at for (std::size_t batch = 0; batch < dims[0]; ++batch) { for (std::size_t ch = 0; ch < std::get<2>(attrs); ++ch) { const std::size_t oIndex = (ch + batch*std::get<2>(attrs)) * oxSize * oySize; - B biasVal = (biases != nullptr) ? biases[ch] : B(0); + B biasVal = ((!std::get<4>(attrs)) && biases != nullptr) ? biases[ch] : B(0); std::fill(output + oIndex, output+(oIndex+oxSize*oySize), biasVal); const std::size_t iIndex = (ch + batch*dims[1]) * dims[2] * dims[3]; const std::size_t wIndex = ch * std::get<3>(attrs)[0] * std::get<3>(attrs)[1]; diff --git a/include/aidge/backend/cpu/operator/ConvImpl_forward_kernels.hpp b/include/aidge/backend/cpu/operator/ConvImpl_forward_kernels.hpp index 83607f280f53e5e477db7d8bbbbd1634dd9c584d..00d34f6596780f42aa5864058ea543f046f8edb1 100644 --- a/include/aidge/backend/cpu/operator/ConvImpl_forward_kernels.hpp +++ b/include/aidge/backend/cpu/operator/ConvImpl_forward_kernels.hpp @@ -106,7 +106,8 @@ void ConvImpl2D_cpu_forward_kernel(const Conv_Op<2>::Attrs &attrs, const std::ar for (std::size_t batch = 0; batch < dims[0]; ++batch) { for (std::size_t outCh = 0; outCh < std::get<3>(attrs); ++outCh) { const std::size_t oIndex = (outCh + batch*std::get<3>(attrs)) * oxSize * oySize; - B biasVal = (biases != nullptr) ? biases[outCh] : B(0); + // If NoBias or bias = nullptr, set B(0) + B biasVal = ((!std::get<5>(attrs)) && biases != nullptr) ? biases[outCh] : B(0); std::fill(output + oIndex, output+(oIndex+oxSize*oySize), biasVal); for (std::size_t inCh = 0; inCh < dims[1]; ++inCh) { const std::size_t iIndex = (inCh + batch*dims[1]) * dims[2] * dims[3];