File tree Expand file tree Collapse file tree 1 file changed +28
-15
lines changed Expand file tree Collapse file tree 1 file changed +28
-15
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,19 @@ using torch::headeronly::ScalarType;
2424
2525namespace impl {
2626
27+ inline const char * toString (ScalarType t) {
28+ #define DEFINE_CASE (_, name ) \
29+ case ScalarType::name: \
30+ return #name;
31+
32+ switch (t) {
33+ AT_FORALL_SCALAR_TYPES_WITH_COMPLEX_AND_QINTS (DEFINE_CASE)
34+ default :
35+ return " UNKNOWN_SCALAR" ;
36+ }
37+ #undef DEFINE_CASE
38+ }
39+
2740template <ScalarType N>
2841struct ScalarTypeToCPPType ;
2942
@@ -51,21 +64,21 @@ using ScalarTypeToCPPTypeT = typename ScalarTypeToCPPType<N>::type;
5164 return __VA_ARGS__ (); \
5265 }
5366
54- #define STABLE_DISPATCH_SWITCH (TYPE, NAME, ...) \
55- [&] { \
56- const auto & the_type = TYPE; \
57- constexpr const char * at_dispatch_name = NAME; \
58- switch (the_type) { \
59- __VA_ARGS__ \
60- default : \
61- STD_TORCH_CHECK ( \
62- false , \
63- ' "' , \
64- at_dispatch_name, \
65- " \" not implemented for '" , \
66- toString (the_type), \
67- " '" ); \
68- } \
67+ #define STABLE_DISPATCH_SWITCH (TYPE, NAME, ...) \
68+ [&] { \
69+ const auto & the_type = TYPE; \
70+ constexpr const char * at_dispatch_name = NAME; \
71+ switch (the_type) { \
72+ __VA_ARGS__ \
73+ default : \
74+ STD_TORCH_CHECK ( \
75+ false , \
76+ ' "' , \
77+ at_dispatch_name, \
78+ " \" not implemented for '" , \
79+ torchaudio::stable::impl:: toString (the_type), \
80+ " '" ); \
81+ } \
6982 }()
7083
7184#define STABLE_DISPATCH_CASE_FLOATING_TYPES_AND_HALF (...) \
You can’t perform that action at this time.
0 commit comments