From c1166d1cd91fd7920d4744300e401a63e5477183 Mon Sep 17 00:00:00 2001 From: Hariharan Seshadri Date: Tue, 3 Mar 2020 11:32:48 -0800 Subject: [PATCH] Add a summary for each ExecutionProviderAppend methods in SessionOptions.cs (#3111) (#3112) * Add a summary for each ExecutionProviderAppend methods in SessionOptions.cs OnnxRuntime managed dll is EP agnostic meaning it will expose all methods pertaining to all possible EPs supported by OnnxRuntime in general. Not all these methods are really "available" to use for a .NET developer unless they have the correpsonding native onnxruntime shared library. Adding a summary line so that intellisense points that out. * remove empty line --- .../SessionOptions.cs | 107 +++++++++++------- 1 file changed, 66 insertions(+), 41 deletions(-) diff --git a/csharp/src/Microsoft.ML.OnnxRuntime/SessionOptions.cs b/csharp/src/Microsoft.ML.OnnxRuntime/SessionOptions.cs index 45c4087461..f50efbbf2c 100644 --- a/csharp/src/Microsoft.ML.OnnxRuntime/SessionOptions.cs +++ b/csharp/src/Microsoft.ML.OnnxRuntime/SessionOptions.cs @@ -50,7 +50,8 @@ namespace Microsoft.ML.OnnxRuntime } /// - /// A helper method to construct a SessionOptions object for CUDA execution + /// A helper method to construct a SessionOptions object for CUDA execution. + /// Use only if CUDA is installed and you have the onnxruntime package specific to this Execution Provider. /// /// A SessionsOptions() object configured for execution on deviceId=0 public static SessionOptions MakeSessionOptionWithCudaProvider() @@ -59,7 +60,8 @@ namespace Microsoft.ML.OnnxRuntime } /// - /// A helper method to construct a SessionOptions object for CUDA execution + /// A helper method to construct a SessionOptions object for CUDA execution. + /// Use only if CUDA is installed and you have the onnxruntime package specific to this Execution Provider. /// /// /// A SessionsOptions() object configured for execution on deviceId @@ -72,46 +74,9 @@ namespace Microsoft.ML.OnnxRuntime return options; } - #endregion - - #region ExecutionProviderAppends - public void AppendExecutionProvider_CPU(int useArena) - { - NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_CPU(_nativePtr, useArena)); - } - - public void AppendExecutionProvider_Dnnl(int useArena) - { - NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_Dnnl(_nativePtr, useArena)); - } - - public void AppendExecutionProvider_CUDA(int deviceId) - { - NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_CUDA(_nativePtr, deviceId)); - } - - public void AppendExecutionProvider_NGraph(string nGraphBackendType) - { - NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_NGraph(_nativePtr, nGraphBackendType)); - } - - public void AppendExecutionProvider_OpenVINO(string deviceId) - { - NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_OpenVINO(_nativePtr, deviceId)); - } - - public void AppendExecutionProvider_Tensorrt(int deviceId) - { - NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_Tensorrt(_nativePtr, deviceId)); - } - - public void AppendExecutionProvider_Nnapi() - { - NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_Nnapi(_nativePtr)); - } - /// - /// A helper method to construct a SessionOptions object for Nuphar execution + /// A helper method to construct a SessionOptions object for Nuphar execution. + /// Use only if you have the onnxruntime package specific to this Execution Provider. /// /// settings string, comprises of comma separated key:value pairs. default is empty /// A SessionsOptions() object configured for execution with Nuphar @@ -121,6 +86,66 @@ namespace Microsoft.ML.OnnxRuntime NativeMethods.OrtSessionOptionsAppendExecutionProvider_Nuphar(options._nativePtr, 1, settings); return options; } + + #endregion + + #region ExecutionProviderAppends + public void AppendExecutionProvider_CPU(int useArena) + { + NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_CPU(_nativePtr, useArena)); + } + + /// + /// Use only if you have the onnxruntime package specific to this Execution Provider. + /// + public void AppendExecutionProvider_Dnnl(int useArena) + { + NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_Dnnl(_nativePtr, useArena)); + } + + /// + /// Use only if you have the onnxruntime package specific to this Execution Provider. + /// + public void AppendExecutionProvider_CUDA(int deviceId) + { + NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_CUDA(_nativePtr, deviceId)); + } + + /// + /// Use only if you have the onnxruntime package specific to this Execution Provider. + /// + public void AppendExecutionProvider_NGraph(string nGraphBackendType) + { + NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_NGraph(_nativePtr, nGraphBackendType)); + } + + /// + /// Use only if you have the onnxruntime package specific to this Execution Provider. + /// + public void AppendExecutionProvider_OpenVINO(string deviceId) + { + NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_OpenVINO(_nativePtr, deviceId)); + } + + /// + /// Use only if you have the onnxruntime package specific to this Execution Provider. + /// + public void AppendExecutionProvider_Tensorrt(int deviceId) + { + NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_Tensorrt(_nativePtr, deviceId)); + } + + /// + /// Use only if you have the onnxruntime package specific to this Execution Provider. + /// + public void AppendExecutionProvider_Nnapi() + { + NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_Nnapi(_nativePtr)); + } + + /// + /// Use only if you have the onnxruntime package specific to this Execution Provider. + /// public void AppendExecutionProvider_Nuphar(string settings = "") { NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_Nuphar(_nativePtr, 1, settings));