diff --git a/aidge_export_cpp/static/utils.hpp b/aidge_export_cpp/static/utils.hpp index e3776a37adaae1f87675f61f07e24af0cb30a0b2..77d9891c163a4f327868ea4fa61a78c3991839dc 100644 --- a/aidge_export_cpp/static/utils.hpp +++ b/aidge_export_cpp/static/utils.hpp @@ -144,8 +144,7 @@ inline void saveOutputs( #if AIDGE_CMP template<int NB_OUTPUTS, int OUT_WIDTH, int OUT_HEIGHT, typename AidgeOutput_T, typename DevOutput_T> -typename std::enable_if<std::is_floating_point<DevOutput_T>::value>::type -aidge_cmp(std::string layer_name, AidgeOutput_T* aidge_output, DevOutput_T* dev_output) { +void aidge_cmp(std::string layer_name, AidgeOutput_T* aidge_output, DevOutput_T* dev_output) { printf("[AIDGE COMPARE] - %s\n", layer_name.c_str()); @@ -155,31 +154,13 @@ aidge_cmp(std::string layer_name, AidgeOutput_T* aidge_output, DevOutput_T* dev_ const int aidge_ofst = out * OUT_HEIGHT * OUT_WIDTH + h * OUT_WIDTH + w; const int dev_ofst = h * OUT_WIDTH * NB_OUTPUTS + w * NB_OUTPUTS + out; if (aidge_output[aidge_ofst] != dev_output[dev_ofst]) { - printf("[ERROR] - (float) First error detected at %dx%dx%d (out x h x w) : aidge_out = %f vs dev_out = %f\n", - out, h, w, aidge_output[aidge_ofst], dev_output[dev_ofst]); - printf("Abort program.\n"); - exit(1); - } - } - } - } - printf("[SUCCESS]\n\n"); -} - -template<int NB_OUTPUTS, int OUT_WIDTH, int OUT_HEIGHT, typename AidgeOutput_T, typename DevOutput_T> -typename std::enable_if<std::is_integral<DevOutput_T>::value>::type -aidge_cmp(std::string layer_name, AidgeOutput_T* aidge_output, DevOutput_T* dev_output) { - - printf("[AIDGE COMPARE] - %s\n", layer_name.c_str()); - - for (auto out = 0; out < NB_OUTPUTS; ++out) { - for (auto h = 0; h < OUT_HEIGHT; ++h) { - for (auto w = 0; w < OUT_WIDTH; ++w) { - const int aidge_ofst = out * OUT_HEIGHT * OUT_WIDTH + h * OUT_WIDTH + w; - const int dev_ofst = h * OUT_WIDTH * NB_OUTPUTS + w * NB_OUTPUTS + out; - if (aidge_output[aidge_ofst] != dev_output[dev_ofst]) { - printf("[ERROR] - (float) First error detected at %dx%dx%d (out x h x w) : aidge_out = %d vs dev_out = %d\n", - out, h, w, aidge_output[aidge_ofst], dev_output[dev_ofst]); + if (std::is_floating_point<DevOutput_T>::value) { + printf("[ERROR] - (float) First error detected at %dx%dx%d (out x h x w) : aidge_out = %f vs dev_out = %f\n", + out, h, w, static_cast<double>(aidge_output[aidge_ofst]), static_cast<double>(dev_output[dev_ofst])); + } else { + printf("[ERROR] - (float) First error detected at %dx%dx%d (out x h x w) : aidge_out = %d vs dev_out = %d\n", + out, h, w, static_cast<int>(aidge_output[aidge_ofst]), static_cast<int>(dev_output[dev_ofst])); + } printf("Abort program.\n"); exit(1); }