Commit 647d7908 authored by Paul's avatar Paul
Browse files

Add missing header

parent 238bfadd
#ifndef MIGRAPH_GUARD_RTGLIB_TYPE_NAME_HPP
#define MIGRAPH_GUARD_RTGLIB_TYPE_NAME_HPP
#include <string>
namespace migraph {
template <class PrivateMigraphTypeNameProbe>
const std::string& get_type_name()
{
static std::string name;
if(name.empty())
{
#ifdef _MSC_VER
name = typeid(PrivateMigraphTypeNameProbe).name();
name = name.substr(7);
#else
const char parameter_name[] = "PrivateMigraphTypeNameProbe =";
name = __PRETTY_FUNCTION__;
auto begin = name.find(parameter_name) + sizeof(parameter_name);
#if(defined(__GNUC__) && !defined(__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7)
auto length = name.find_last_of(",") - begin;
#else
auto length = name.find_first_of("];", begin) - begin;
#endif
name = name.substr(begin, length);
#endif
}
return name;
}
template <class T>
const std::string& get_type_name(const T&)
{
return migraph::get_type_name<T>();
}
} // namespace migraph
#endif
...@@ -72,13 +72,9 @@ void migemm_impl(tensor_view<T> cmat, ...@@ -72,13 +72,9 @@ void migemm_impl(tensor_view<T> cmat,
assert(m == amat.get_shape().lens()[0]); assert(m == amat.get_shape().lens()[0]);
assert(n == bmat.get_shape().lens()[1]); assert(n == bmat.get_shape().lens()[1]);
dfor(m, n)([&](auto ii, auto jj) dfor(m, n)([&](auto ii, auto jj) {
{
double s = cmat(ii, jj) * beta; double s = cmat(ii, jj) * beta;
dfor(k)([&](auto kk) dfor(k)([&](auto kk) { s += amat(ii, kk) * bmat(kk, jj); });
{
s += amat(ii, kk) * bmat(kk, jj);
});
cmat(ii, jj) = alpha * s; cmat(ii, jj) = alpha * s;
}); });
} }
......
...@@ -242,7 +242,7 @@ void reshape_test() ...@@ -242,7 +242,7 @@ void reshape_test()
} }
} }
template<class T> template <class T>
void gemm_test() void gemm_test()
{ {
migraph::program p; migraph::program p;
......
...@@ -50,7 +50,8 @@ void verify_program() ...@@ -50,7 +50,8 @@ void verify_program()
auto cpu_arg = run_cpu<V>(); auto cpu_arg = run_cpu<V>();
auto gpu_arg = run_gpu<V>(); auto gpu_arg = run_gpu<V>();
visit_all(cpu_arg, gpu_arg)([](auto cpu, auto gpu) { visit_all(cpu_arg, gpu_arg)([](auto cpu, auto gpu) {
if(not test::verify_range(cpu, gpu)) { if(not test::verify_range(cpu, gpu))
{
std::cout << "FAILED: " << migraph::get_type_name<V>() << std::endl; std::cout << "FAILED: " << migraph::get_type_name<V>() << std::endl;
} }
}); });
......
#include <migraph/type_name.hpp>
#include "test.hpp"
struct global_class
{
struct inner_class
{
};
};
namespace foo {
struct ns_class
{
struct inner_class
{
};
};
} // namespace foo
int main()
{
EXPECT(migraph::get_type_name<global_class>() == "global_class");
EXPECT(migraph::get_type_name<global_class::inner_class>() == "global_class::inner_class");
EXPECT(migraph::get_type_name<foo::ns_class>() == "foo::ns_class");
EXPECT(migraph::get_type_name<foo::ns_class::inner_class>() == "foo::ns_class::inner_class");
}
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