diff --git a/include/aidge/backend/cpu/operator/FCImpl_forward_kernels.hpp b/include/aidge/backend/cpu/operator/FCImpl_forward_kernels.hpp index 91e2558a7ef1079cbc9fb11f78fab53ef4246149..64f3b3e18f7255b74decad5137cbb5ccd6966123 100644 --- a/include/aidge/backend/cpu/operator/FCImpl_forward_kernels.hpp +++ b/include/aidge/backend/cpu/operator/FCImpl_forward_kernels.hpp @@ -12,10 +12,10 @@ #ifndef AIDGE_CPU_OPERATOR_FCIMPL_FORWARD_KERNEL_H_ #define AIDGE_CPU_OPERATOR_FCIMPL_FORWARD_KERNEL_H_ -#include "aidge/utils/Registrar.hpp" #include <algorithm> #include "aidge/backend/cpu/operator/FCImpl.hpp" +#include "aidge/utils/Registrar.hpp" namespace Aidge { // template <class I, class W, class B, class O> diff --git a/include/aidge/backend/cpu/operator/GlobalAveragePoolingImpl_forward_kernels.hpp b/include/aidge/backend/cpu/operator/GlobalAveragePoolingImpl_forward_kernels.hpp index f50d558c4de2bfa80eaa3a767653bea7ddd0d045..5ea9b95822a0019de849bbf279c6dda8e01c5750 100644 --- a/include/aidge/backend/cpu/operator/GlobalAveragePoolingImpl_forward_kernels.hpp +++ b/include/aidge/backend/cpu/operator/GlobalAveragePoolingImpl_forward_kernels.hpp @@ -29,12 +29,9 @@ template <class I, class O> void GlobalAveragePoolingImpl_cpu_forward_kernel( const std::vector<DimSize_t> &dims, const void *input_, void *output_) { // error checking - if (dims.size() < 3) { - AIDGE_THROW_OR_ABORT(std::runtime_error, - "GlobalAveragePool needs at least a 3 dimensions " - "input, number of input dim : %lu", - dims.size()); - } + AIDGE_ASSERT(dims.size() >= 3,"GlobalAveragePool needs at least a 3 dimensions " + "input, number of input dim : {}", + dims.size()); // computation const I *input = static_cast<const I *>(input_); diff --git a/unit_tests/operator/Test_GlobalAveragePoolingImpl.cpp b/unit_tests/operator/Test_GlobalAveragePoolingImpl.cpp index f494cd9cb8b843bdcda7361503015d4ab7595d1c..1b199978262d17c83458e44ae47c08e6758fce49 100644 --- a/unit_tests/operator/Test_GlobalAveragePoolingImpl.cpp +++ b/unit_tests/operator/Test_GlobalAveragePoolingImpl.cpp @@ -92,15 +92,15 @@ TEST_CASE("[cpu/operator] GlobalAveragePooling", std::multiplies<std::size_t>()); float *array0 = new float[nb_elements]; - float *result = new float[nb_elements]; - for (std::size_t i = 0; i < nb_elements; ++i) { array0[i] = valueDist(gen); - result[i] += array0[i] / nb_elements; } - delete[] array0; - delete[] result; + // input0 + T0->resize(dims); + T0->getImpl()->setRawPtr(array0, nb_elements); + REQUIRE_THROWS(globAvgPool->forward()); + delete[] array0; } SECTION("3+Dim") {