Skip to content
Snippets Groups Projects
Commit 7ea5c9b4 authored by Grégoire Kubler's avatar Grégoire Kubler Committed by Maxence Naud
Browse files

fix : corrected tests + minor refactors & missing include

parent b8b44e31
No related branches found
No related tags found
2 merge requests!50version 0.2.0,!42feat/operator_globalAveragePooling
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
#ifndef AIDGE_CPU_OPERATOR_FCIMPL_FORWARD_KERNEL_H_ #ifndef AIDGE_CPU_OPERATOR_FCIMPL_FORWARD_KERNEL_H_
#define AIDGE_CPU_OPERATOR_FCIMPL_FORWARD_KERNEL_H_ #define AIDGE_CPU_OPERATOR_FCIMPL_FORWARD_KERNEL_H_
#include "aidge/utils/Registrar.hpp"
#include <algorithm> #include <algorithm>
#include "aidge/backend/cpu/operator/FCImpl.hpp" #include "aidge/backend/cpu/operator/FCImpl.hpp"
#include "aidge/utils/Registrar.hpp"
namespace Aidge { namespace Aidge {
// template <class I, class W, class B, class O> // template <class I, class W, class B, class O>
......
...@@ -29,12 +29,9 @@ template <class I, class O> ...@@ -29,12 +29,9 @@ template <class I, class O>
void GlobalAveragePoolingImpl_cpu_forward_kernel( void GlobalAveragePoolingImpl_cpu_forward_kernel(
const std::vector<DimSize_t> &dims, const void *input_, void *output_) { const std::vector<DimSize_t> &dims, const void *input_, void *output_) {
// error checking // error checking
if (dims.size() < 3) { AIDGE_ASSERT(dims.size() >= 3,"GlobalAveragePool needs at least a 3 dimensions "
AIDGE_THROW_OR_ABORT(std::runtime_error, "input, number of input dim : {}",
"GlobalAveragePool needs at least a 3 dimensions " dims.size());
"input, number of input dim : %lu",
dims.size());
}
// computation // computation
const I *input = static_cast<const I *>(input_); const I *input = static_cast<const I *>(input_);
......
...@@ -92,15 +92,15 @@ TEST_CASE("[cpu/operator] GlobalAveragePooling", ...@@ -92,15 +92,15 @@ TEST_CASE("[cpu/operator] GlobalAveragePooling",
std::multiplies<std::size_t>()); std::multiplies<std::size_t>());
float *array0 = new float[nb_elements]; float *array0 = new float[nb_elements];
float *result = new float[nb_elements];
for (std::size_t i = 0; i < nb_elements; ++i) { for (std::size_t i = 0; i < nb_elements; ++i) {
array0[i] = valueDist(gen); array0[i] = valueDist(gen);
result[i] += array0[i] / nb_elements;
} }
delete[] array0; // input0
delete[] result; T0->resize(dims);
T0->getImpl()->setRawPtr(array0, nb_elements);
REQUIRE_THROWS(globAvgPool->forward()); REQUIRE_THROWS(globAvgPool->forward());
delete[] array0;
} }
SECTION("3+Dim") { SECTION("3+Dim") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment