mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-22 19:23:30 +00:00
Clarify naming of the API involving the RunOptions terminate flag. (#1768)
* Clarify naming of the RunOptions terminate flag. * Update C# code to use new names.
This commit is contained in:
parent
75f241d02c
commit
2e242a4089
7 changed files with 22 additions and 19 deletions
|
|
@ -237,10 +237,10 @@ namespace Microsoft.ML.OnnxRuntime
|
|||
// Set a flag so that any running OrtRun* calls that are using this instance of OrtRunOptions
|
||||
// will exit as soon as possible if the flag is true.
|
||||
[DllImport(nativeLib, CharSet = charSet)]
|
||||
public static extern IntPtr /*(OrtStatus*)*/ OrtRunOptionsEnableTerminate(IntPtr /* OrtRunOptions* */ options);
|
||||
public static extern IntPtr /*(OrtStatus*)*/ OrtRunOptionsSetTerminate(IntPtr /* OrtRunOptions* */ options);
|
||||
|
||||
[DllImport(nativeLib, CharSet = charSet)]
|
||||
public static extern IntPtr /*(OrtStatus*)*/ OrtRunOptionsDisableTerminate(IntPtr /* OrtRunOptions* */ options);
|
||||
public static extern IntPtr /*(OrtStatus*)*/ OrtRunOptionsUnsetTerminate(IntPtr /* OrtRunOptions* */ options);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace Microsoft.ML.OnnxRuntime
|
|||
|
||||
|
||||
/// <summary>
|
||||
/// Sets a flag to terminate any other Run() call that is using the same RunOptions object
|
||||
/// Sets a flag to terminate all Run() calls that are currently using this RunOptions object
|
||||
/// Default = false
|
||||
/// </summary>
|
||||
public bool Terminate
|
||||
|
|
@ -78,12 +78,12 @@ namespace Microsoft.ML.OnnxRuntime
|
|||
{
|
||||
if (!_terminate && value)
|
||||
{
|
||||
NativeApiStatus.VerifySuccess(NativeMethods.OrtRunOptionsEnableTerminate(_nativePtr));
|
||||
NativeApiStatus.VerifySuccess(NativeMethods.OrtRunOptionsSetTerminate(_nativePtr));
|
||||
_terminate = true;
|
||||
}
|
||||
else if (_terminate && !value)
|
||||
{
|
||||
NativeApiStatus.VerifySuccess(NativeMethods.OrtRunOptionsDisableTerminate(_nativePtr));
|
||||
NativeApiStatus.VerifySuccess(NativeMethods.OrtRunOptionsUnsetTerminate(_nativePtr));
|
||||
_terminate = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -300,10 +300,11 @@ ORT_API_STATUS(OrtRunOptionsGetRunLogVerbosityLevel, _In_ const OrtRunOptions* o
|
|||
ORT_API_STATUS(OrtRunOptionsGetRunLogSeverityLevel, _In_ const OrtRunOptions* options, _Out_ int* out);
|
||||
ORT_API_STATUS(OrtRunOptionsGetRunTag, _In_ const OrtRunOptions*, _Out_ const char** out);
|
||||
|
||||
// Set a flag so that any running OrtRun* calls that are using this instance of OrtRunOptions
|
||||
// will exit as soon as possible if the flag is true.
|
||||
ORT_API_STATUS(OrtRunOptionsEnableTerminate, _Inout_ OrtRunOptions* options);
|
||||
ORT_API_STATUS(OrtRunOptionsDisableTerminate, _Inout_ OrtRunOptions* options);
|
||||
// Set a flag so that ALL incomplete OrtRun calls that are using this instance of OrtRunOptions
|
||||
// will exit as soon as possible.
|
||||
ORT_API_STATUS(OrtRunOptionsSetTerminate, _Inout_ OrtRunOptions* options);
|
||||
// Unset the terminate flag to enable this OrtRunOptions instance being used in new OrtRun calls.
|
||||
ORT_API_STATUS(OrtRunOptionsUnsetTerminate, _Inout_ OrtRunOptions* options);
|
||||
|
||||
/**
|
||||
* Create a tensor from an allocator. OrtReleaseValue will also release the buffer inside the output value
|
||||
|
|
|
|||
|
|
@ -125,8 +125,10 @@ struct RunOptions : Base<OrtRunOptions> {
|
|||
RunOptions& SetRunTag(const char* run_tag);
|
||||
const char* GetRunTag() const;
|
||||
|
||||
RunOptions& EnableTerminate();
|
||||
RunOptions& DisableTerminate();
|
||||
// terminate ALL currently executing Session::Run calls that were made using this RunOptions instance
|
||||
RunOptions& SetTerminate();
|
||||
// unset the terminate flag so this RunOptions instance can be used in a new Session::Run call
|
||||
RunOptions& UnsetTerminate();
|
||||
};
|
||||
|
||||
struct SessionOptions : Base<OrtSessionOptions> {
|
||||
|
|
|
|||
|
|
@ -116,13 +116,13 @@ inline const char* RunOptions::GetRunTag() const {
|
|||
return out;
|
||||
}
|
||||
|
||||
inline RunOptions& RunOptions::EnableTerminate() {
|
||||
ORT_THROW_ON_ERROR(OrtRunOptionsEnableTerminate(p_));
|
||||
inline RunOptions& RunOptions::SetTerminate() {
|
||||
ORT_THROW_ON_ERROR(OrtRunOptionsSetTerminate(p_));
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline RunOptions& RunOptions::DisableTerminate() {
|
||||
ORT_THROW_ON_ERROR(OrtRunOptionsDisableTerminate(p_));
|
||||
inline RunOptions& RunOptions::UnsetTerminate() {
|
||||
ORT_THROW_ON_ERROR(OrtRunOptionsUnsetTerminate(p_));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,12 +43,12 @@ ORT_API_STATUS_IMPL(OrtRunOptionsGetRunTag, _In_ const OrtRunOptions* options, c
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
ORT_API_STATUS_IMPL(OrtRunOptionsEnableTerminate, _Inout_ OrtRunOptions* options) {
|
||||
ORT_API_STATUS_IMPL(OrtRunOptionsSetTerminate, _Inout_ OrtRunOptions* options) {
|
||||
options->terminate = true;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ORT_API_STATUS_IMPL(OrtRunOptionsDisableTerminate, _Inout_ OrtRunOptions* options) {
|
||||
ORT_API_STATUS_IMPL(OrtRunOptionsUnsetTerminate, _Inout_ OrtRunOptions* options) {
|
||||
options->terminate = false;
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ OrtRunOptionsGetRunTag
|
|||
OrtRunOptionsSetRunLogVerbosityLevel
|
||||
OrtRunOptionsSetRunLogSeverityLevel
|
||||
OrtRunOptionsSetRunTag
|
||||
OrtRunOptionsEnableTerminate
|
||||
OrtRunOptionsDisableTerminate
|
||||
OrtRunOptionsSetTerminate
|
||||
OrtRunOptionsUnsetTerminate
|
||||
OrtSessionGetInputCount
|
||||
OrtSessionGetInputName
|
||||
OrtSessionGetInputTypeInfo
|
||||
|
|
|
|||
Loading…
Reference in a new issue