# ORTSessionOptions Class Reference

# ORTSessionOptions

Objective-C

    @interface ORTSessionOptions : NSObject

Swift

    class ORTSessionOptions : NSObject

Options for configuring a session.

- `-init`

  Unavailable

  #### Declaration

  Objective-C

      - (instancetype)init NS_UNAVAILABLE;

- `-initWithError:`

  Creates session configuration options.

  #### Declaration

  Objective-C

      - (nullable instancetype)initWithError:(NSError *_Nullable *_Nullable)error;

  Swift

      init() throws

  #### Parameters

  `error` | Optional error information set if an error occurs.

  #### Return Value

  The instance, or nil if an error occurs.

- `-setIntraOpNumThreads:error:`

  Sets the number of threads used to parallelize the execution within nodes. A value of 0 means ORT will pick a default value.

  #### Declaration

  Objective-C

      - (BOOL)setIntraOpNumThreads:(int)intraOpNumThreads
                             error:(NSError *_Nullable *_Nullable)error;

  Swift

      func setIntraOpNumThreads(_ intraOpNumThreads: Int32) throws

  #### Parameters

  `intraOpNumThreads` | The number of threads.
  `error` | Optional error information set if an error occurs.

  #### Return Value

  Whether the option was set successfully.

- `-setGraphOptimizationLevel:error:`

  Sets the graph optimization level.

  #### Declaration

  Objective-C

      - (BOOL)setGraphOptimizationLevel:
                  (ORTGraphOptimizationLevel)graphOptimizationLevel
                                  error:(NSError *_Nullable *_Nullable)error;

  Swift

      func setGraphOptimizationLevel(_ graphOptimizationLevel: ORTGraphOptimizationLevel) throws

  #### Parameters

  `graphOptimizationLevel` | The graph optimization level.
  `error` | Optional error information set if an error occurs.

  #### Return Value

  Whether the option was set successfully.

- `-setOptimizedModelFilePath:error:`

  Sets the path to which the optimized model file will be saved.

  #### Declaration

  Objective-C

      - (BOOL)setOptimizedModelFilePath:(nonnull NSString *)optimizedModelFilePath
                                  error:(NSError *_Nullable *_Nullable)error;

  Swift

      func setOptimizedModelFilePath(_ optimizedModelFilePath: String) throws

  #### Parameters

  `optimizedModelFilePath` | The optimized model file path.
  `error` | Optional error information set if an error occurs.

  #### Return Value

  Whether the option was set successfully.

- `-setLogID:error:`

  Sets the session log ID.

  #### Declaration

  Objective-C

      - (BOOL)setLogID:(nonnull NSString *)logID
                 error:(NSError *_Nullable *_Nullable)error;

  Swift

      func setLogID(_ logID: String) throws

  #### Parameters

  `logID` | The log ID.
  `error` | Optional error information set if an error occurs.

  #### Return Value

  Whether the option was set successfully.

- `-setLogSeverityLevel:error:`

  Sets the session log severity level.

  #### Declaration

  Objective-C

      - (BOOL)setLogSeverityLevel:(ORTLoggingLevel)loggingLevel
                            error:(NSError *_Nullable *_Nullable)error;

  Swift

      func setLogSeverityLevel(_ loggingLevel: ORTLoggingLevel) throws

  #### Parameters

  `loggingLevel` | The log severity level.
  `error` | Optional error information set if an error occurs.

  #### Return Value

  Whether the option was set successfully.

- `-addConfigEntryWithKey:value:error:`

  Sets a session configuration key-value pair. Any value for a previously set key will be overwritten. The session configuration keys and values are documented here: https://github.com/microsoft/onnxruntime/blob/main/include/onnxruntime/core/session/onnxruntime_session_options_config_keys.h

  #### Declaration

  Objective-C

      - (BOOL)addConfigEntryWithKey:(nonnull NSString *)key
                              value:(nonnull NSString *)value
                              error:(NSError *_Nullable *_Nullable)error;

  Swift

      func addConfigEntry(withKey key: String, value: String) throws

  #### Parameters

  `key` | The key.
  `value` | The value.
  `error` | Optional error information set if an error occurs.

  #### Return Value

  Whether the option was set successfully.

### ORTSessionOptionsCoreMLEP

- `-appendCoreMLExecutionProviderWithOptions:error:`

  Enables the CoreML execution provider in the session configuration options. It is appended to the execution provider list which is ordered by decreasing priority.

  #### Declaration

  Objective-C

      - (BOOL)appendCoreMLExecutionProviderWithOptions:
                  (nonnull ORTCoreMLExecutionProviderOptions *)options
                                                 error:(NSError *_Nullable *_Nullable)
                                                           error;

  Swift

      func appendCoreMLExecutionProvider(with options: ORTCoreMLExecutionProviderOptions) throws

  #### Parameters

  `options` | The CoreML execution provider configuration options.
  `error` | Optional error information set if an error occurs.

  #### Return Value

  Whether the provider was enabled successfully.

© 2022 ONNX Runtime Authors. All rights reserved. (Last updated: 2022-10-22)

Generated by jazzy ♪♫ v0.14.3, a Realm project.