Commit 8dbabda5 authored by Paul's avatar Paul
Browse files

Print out error amount

parent a5d58187
...@@ -12,7 +12,7 @@ constexpr T normalize(unsigned long z) ...@@ -12,7 +12,7 @@ constexpr T normalize(unsigned long z)
{ {
if(z == 0) if(z == 0)
return 0; return 0;
const auto max = 32768; const auto max = 2048;
const double range = max / 2; // NOLINT const double range = max / 2; // NOLINT
double result = (z % max) / range; double result = (z % max) / range;
result -= 1; result -= 1;
......
...@@ -162,10 +162,12 @@ double rms_range(R1&& r1, R2&& r2) ...@@ -162,10 +162,12 @@ double rms_range(R1&& r1, R2&& r2)
} }
template <class R1, class R2> template <class R1, class R2>
bool verify_range(R1&& r1, R2&& r2, double tolerance = 80) bool verify_range(R1&& r1, R2&& r2, double tolerance = 80, double * out_error = nullptr)
{ {
double threshold = std::numeric_limits<range_value<R1>>::epsilon() * tolerance; double threshold = std::numeric_limits<range_value<R1>>::epsilon() * tolerance;
auto error = rms_range(r1, r2); auto error = rms_range(r1, r2);
if(out_error != nullptr)
*out_error = error;
return error <= threshold; return error <= threshold;
} }
} // namespace migraph } // namespace migraph
......
...@@ -12,10 +12,12 @@ inline void verify_args(const std::string& name, ...@@ -12,10 +12,12 @@ inline void verify_args(const std::string& name,
double tolerance = 80) double tolerance = 80)
{ {
visit_all(cpu_arg, gpu_arg)([&](auto cpu, auto gpu) { visit_all(cpu_arg, gpu_arg)([&](auto cpu, auto gpu) {
if(not verify_range(cpu, gpu, tolerance)) double error;
if(not verify_range(cpu, gpu, tolerance, &error))
{ {
// TODO: Check for nans // TODO: Check for nans
std::cout << "FAILED: " << name << std::endl; std::cout << "FAILED: " << name << std::endl;
std::cout << "error: " << error << std::endl;
if(cpu.size() < 32) if(cpu.size() < 32)
std::cout << "cpu:" << cpu << std::endl; std::cout << "cpu:" << cpu << std::endl;
if(gpu.size() < 32) if(gpu.size() < 32)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment