Class SessionOptionsContainer
Helper to allow the creation/addition of session options based on pre-defined named entries.
Inheritance
Namespace: Microsoft.ML.OnnxRuntime
Assembly: Microsoft.ML.OnnxRuntime.dll
Syntax
public static class SessionOptionsContainer : object
Methods
| Improve this Doc View SourceApplyConfiguration(SessionOptions, String, Boolean)
Apply a configuration to a SessionOptions instance.
Declaration
public static SessionOptions ApplyConfiguration(this SessionOptions options, string configuration = null, bool useDefaultAsFallback = true)
Parameters
Type | Name | Description |
---|---|---|
SessionOptions | options | SessionOptions to apply configuration to. |
System.String | configuration | Configuration to use. |
System.Boolean | useDefaultAsFallback | Use the default configuration if 'configuration' is not provided or not found. |
Returns
Type | Description |
---|---|
SessionOptions | Updated SessionOptions instance. |
Create(String, Boolean)
Create a SessionOptions instance with configuration applied.
Declaration
public static SessionOptions Create(string configuration = null, bool useDefaultAsFallback = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | configuration | Configuration to use. If not provided, the default set of session options will be applied if useDefaultAsFallback is true. |
System.Boolean | useDefaultAsFallback | If configuration is not provided or not found, use the default session options. |
Returns
Type | Description |
---|---|
SessionOptions | SessionOptions with configuration applied. |
Register(Action<SessionOptions>)
Register the default handler. This is used when a configuration name is not provided.
Declaration
public static void Register(Action<SessionOptions> defaultHandler)
Parameters
Type | Name | Description |
---|---|---|
Action<><SessionOptions> | defaultHandler | Handler that applies the default settings to a SessionOptions instance. |
Register(String, Action<SessionOptions>)
Register a named handler.
Declaration
public static void Register(string configuration, Action<SessionOptions> handler)
Parameters
Type | Name | Description |
---|---|---|
System.String | configuration | Configuration name. |
Action<><SessionOptions> | handler | Handler that applies the settings for the configuration to a SessionOptions instance. |
Reset()
Reset by removing all registered handlers.
Declaration
public static void Reset()