"vscode:/vscode.git/clone" did not exist on "86ecd4b795f865b5b615b8c54991c177bb3dbef5"
Commit 12aacfe9 authored by Po-Yen, Chen's avatar Po-Yen, Chen
Browse files

Use span<> to generalize check_err() interface

parent 3fdff5bb
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "ck/ck.hpp" #include "ck/ck.hpp"
#include "ck/utility/data_type.hpp" #include "ck/utility/data_type.hpp"
#include "ck/utility/span.hpp"
#include "ck/utility/type.hpp" #include "ck/utility/type.hpp"
#include "ck/host_utility/io.hpp" #include "ck/host_utility/io.hpp"
...@@ -108,9 +109,9 @@ check_err(const std::vector<T>& out, ...@@ -108,9 +109,9 @@ check_err(const std::vector<T>& out,
} }
template <typename T> template <typename T>
typename std::enable_if<std::is_same<T, half_t>::value, bool>::type typename std::enable_if<std::is_same_v<std::remove_cv_t<T>, half_t>, bool>::type
check_err(const std::vector<T>& out, check_err(span<T> out,
const std::vector<T>& ref, span<T> ref,
const std::string& msg = "Error: Incorrect results!", const std::string& msg = "Error: Incorrect results!",
double rtol = 1e-3, double rtol = 1e-3,
double atol = 1e-3) double atol = 1e-3)
...@@ -150,6 +151,17 @@ check_err(const std::vector<T>& out, ...@@ -150,6 +151,17 @@ check_err(const std::vector<T>& out,
return res; return res;
} }
template <typename T>
typename std::enable_if<std::is_same<T, half_t>::value, bool>::type
check_err(const std::vector<T>& out,
const std::vector<T>& ref,
const std::string& msg = "Error: Incorrect results!",
double rtol = 1e-3,
double atol = 1e-3)
{
return check_err(span<const T>{out}, span<const T>{ref}, msg, rtol, atol);
}
template <typename T> template <typename T>
std::enable_if_t<(std::is_integral_v<T> && !std::is_same_v<T, bhalf_t>) std::enable_if_t<(std::is_integral_v<T> && !std::is_same_v<T, bhalf_t>)
#ifdef CK_EXPERIMENTAL_BIT_INT_EXTENSION_INT4 #ifdef CK_EXPERIMENTAL_BIT_INT_EXTENSION_INT4
......
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