23 #include "ngraph/except.hpp"
27 static inline std::ostream& write_all_to_stream(std::ostream& str) {
return str; }
28 template <
typename T,
typename... TS>
29 static inline std::ostream& write_all_to_stream(std::ostream& str,
const T& arg, TS&&... args)
31 return write_all_to_stream(str << arg, args...);
38 const char* check_string;
46 const std::string& context_info,
47 const std::string& explanation)
48 :
ngraph_error(make_what(check_loc_info, context_info, explanation))
53 static std::string make_what(
const CheckLocInfo& check_loc_info,
54 const std::string& context_info,
55 const std::string& explanation);
124 #define NGRAPH_CHECK_HELPER2(exc_class, ctx, check, ...) \
129 ::std::stringstream ss___; \
130 ::ngraph::write_all_to_stream(ss___, __VA_ARGS__); \
132 (::ngraph::CheckLocInfo{__FILE__, __LINE__, #check}), (ctx), ss___.str()); \
136 #define NGRAPH_CHECK_HELPER1(exc_class, ctx, check) \
141 throw exc_class((::ngraph::CheckLocInfo{__FILE__, __LINE__, #check}), (ctx), ""); \
151 #define NGRAPH_CHECK(...) NGRAPH_CHECK_HELPER(::ngraph::CheckFailure, "", __VA_ARGS__)
157 #define NGRAPH_UNREACHABLE(...) NGRAPH_CHECK(false, "Unreachable: ", __VA_ARGS__)
158 #define NGRAPH_CHECK_HELPER(exc_class, ctx, ...) \
159 CALL_OVERLOAD(NGRAPH_CHECK_HELPER, exc_class, ctx, __VA_ARGS__)
161 #define GLUE(x, y) x y
163 #define RETURN_ARG_COUNT(_1_, \
191 #define EXPAND_ARGS(args) RETURN_ARG_COUNT args
192 #define COUNT_ARGS_MAXN(...) \
193 EXPAND_ARGS((__VA_ARGS__, \
221 #define OVERLOAD_MACRO2(name, count) name##count
222 #define OVERLOAD_MACRO1(name, count) OVERLOAD_MACRO2(name, count)
223 #define OVERLOAD_MACRO(name, count) OVERLOAD_MACRO1(name, count)
225 #define CALL_OVERLOAD(name, exc_class, ctx, ...) \
226 GLUE(OVERLOAD_MACRO(name, COUNT_ARGS_MAXN(__VA_ARGS__)), (exc_class, ctx, __VA_ARGS__))
Base class for check failure exceptions.
Definition: check.hpp:43
Base error for ngraph runtime errors.
Definition: except.hpp:28
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28