Skip to content
Snippets Groups Projects
Commit 4d100339 authored by Grégoire Kubler's avatar Grégoire Kubler
Browse files

fix : corrected tests + minor refactors & missing include

parent ae156dec
No related branches found
No related tags found
3 merge requests!50version 0.2.0,!47Draft: TEST_CI_FORK_DO_NOT_MERGE,!42feat/operator_globalAveragePooling
......@@ -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>
......
......@@ -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_);
......
......@@ -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") {
......
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