Class OnnxRuntimeSessionOptions
Namespace: Aspose.OCR
Assembly: Aspose.OCR.dll (26.3.0)
Configuration options for creating ONNX InferenceSession. We recommend keeping the optimized defaults unless you are absolutely certain about the modifications. For technical details, refer to ONNX Runtime documentation.
public static class OnnxRuntimeSessionOptionsInheritance
object ← OnnxRuntimeSessionOptions
Inherited Members
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Properties
EnableCpuMemArena
Enables or disables the CPU memory arena allocator used by ONNX Runtime. When enabled, memory is pooled and reused for better performance, but may lead to increased memory consumption in multi-threaded scenarios. Disable to reduce peak memory usage at the cost of performance.
public static bool EnableCpuMemArena { get; set; }Property Value
EnableMemoryPattern
Enables or disables memory pattern optimization for input tensors. When enabled, ONNX Runtime caches memory allocation patterns for faster execution, but may increase memory usage for dynamic input shapes. Disable if inputs vary significantly or to reduce memory footprint.
public static bool EnableMemoryPattern { get; set; }Property Value
ExecutionMode
Execution mode for the session. By default, operators are executed concurrently, whenever possible.
public static ExecutionModeOnnx ExecutionMode { get; set; }Property Value
GraphOptimizationLevel
Graph optimization level for the session. By default, all available optimizations are enabled for maximum performance.
public static GraphOptimizationLevelOnnx GraphOptimizationLevel { get; set; }Property Value
InterOpNumThreads
Number of threads for running multiple operations in parallel. If sequential execution (ExecutionModeOnnx.ORT_SEQUENTIAL) is enabled in ExecutionMode property, this value is ignored.
public static int InterOpNumThreads { get; set; }Property Value
IntraOpNumThreads
Number of threads for a single operations.
public static int IntraOpNumThreads { get; set; }