Skip to content
Snippets Groups Projects
Commit abfa1d87 authored by Olivier BICHLER's avatar Olivier BICHLER
Browse files

Fixed issues

parent 8d9cc1f3
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@
#include <cmath> // std::abs
#include "aidge/data/Tensor.hpp"
namespace Aidge {
/**
* @brief Compare two :cpp:class:`Aidge::Tensor` value wise. The comparison function is:
*
......@@ -41,12 +42,13 @@ bool approxEq(Aidge::Tensor t1, Aidge::Tensor t2, float relative, float absolute
if (t1.size() != t2.size()){
return false;
}
for(size_t i; i < t1.size(); ++i){
for(size_t i = 0; i < t1.size(); ++i){
if (static_cast<float>(std::abs(t1.get<T1>(i) - t2.get<T2>(i))) > (absolute + (relative * static_cast<float>(std::abs(t2.get<T2>(i)))))){
return false;
}
}
return true;
}
}
#endif /* AIDGE_CORE_UTILS_TENSOR_UTILS_H_s */
......@@ -51,7 +51,7 @@ void addTensorUtilsFunction(py::module &m){
void init_TensorUtils(py::module &m) {
addTensorUtilsFunction<float>(m);
addTensorUtilsFunction<double>(m);
addTensorUtilsFunction<int>(m);
addTensorUtilsFunction<long>(m);
addTensorUtilsFunction<int32_t>(m);
addTensorUtilsFunction<int64_t>(m);
}
} // namespace Aidge
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