mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-05 04:17:53 +00:00
Allow disable exceptions to work with ort-extensions (#16536)
This commit is contained in:
parent
0051497055
commit
5b3447beef
2 changed files with 9 additions and 0 deletions
|
|
@ -5,7 +5,12 @@
|
|||
|
||||
void simple_assert(const bool cond, const std::string& text) {
|
||||
if (!cond) {
|
||||
#ifndef ORT_NO_EXCEPTIONS
|
||||
throw std::runtime_error(text);
|
||||
#else
|
||||
std::cerr << text << std::endl;
|
||||
std::terminate();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,17 +25,21 @@ OrtStatus* ORT_API_CALL RegisterCustomOps(OrtSessionOptions* options, const OrtA
|
|||
|
||||
OrtStatus* result = nullptr;
|
||||
|
||||
#ifndef ORT_NO_EXCEPTIONS
|
||||
try {
|
||||
#endif
|
||||
Ort::CustomOpDomain domain{c_OpDomain};
|
||||
domain.Add(&c_CustomOp);
|
||||
|
||||
session_options.Add(domain);
|
||||
AddOrtCustomOpDomainToContainer(std::move(domain));
|
||||
|
||||
#ifndef ORT_NO_EXCEPTIONS
|
||||
} catch (const std::exception& e) {
|
||||
Ort::Status status{e};
|
||||
result = status.release();
|
||||
}
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue