Skip to content
Snippets Groups Projects
Commit 84bef9d2 authored by Maxence Naud's avatar Maxence Naud Committed by Maxence Naud
Browse files

enhance: add debug details for tensor comparison

parent 49abcf60
No related branches found
No related tags found
2 merge requests!279v0.4.0,!273[Fix] Producer clone and Tensor copy
...@@ -44,6 +44,7 @@ bool approxEq(const Tensor& t1, const Tensor& t2, float relative = 1e-5f, float ...@@ -44,6 +44,7 @@ bool approxEq(const Tensor& t1, const Tensor& t2, float relative = 1e-5f, float
} }
for(size_t i = 0; 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)))))){ 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)))))){
fmt::print("t1:\n{}\nt2\n{}\nat index {} {} != {}", t1, t2, i, t1.get<T1>(i), t2.get<T1>(i));
return false; return false;
} }
} }
......
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