Skip to content

Commit d892645

Browse files
authored
Merge pull request #106 from ljn917/cppflow2-type-deduce
Show typeid in deduce_tf_type() if error
2 parents a6b71df + 1447599 commit d892645

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

include/cppflow/datatype.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
#ifndef CPPFLOW2_DATATYPE_H
66
#define CPPFLOW2_DATATYPE_H
77

8+
#include <type_traits>
9+
#include <string>
10+
#include <typeinfo>
11+
#include <ostream>
12+
#include <stdexcept>
13+
814
namespace cppflow {
915

1016
using datatype = TF_DataType;
@@ -96,7 +102,8 @@ namespace cppflow {
96102
if (std::is_same<T, uint64_t>::value)
97103
return TF_UINT64;
98104

99-
throw std::runtime_error{"Could not deduce type!"};
105+
// decode with `c++filt --type $output` for gcc
106+
throw std::runtime_error{"Could not deduce type! type_name: " + std::string(typeid(T).name())};
100107
}
101108

102109
/**

0 commit comments

Comments
 (0)