Class OnnxSessionOptions
Per-model session settings. One instance per registered model.
public sealed class OnnxSessionOptions
- Inheritance
-
OnnxSessionOptions
- Inherited Members
Properties
- DropOnMemoryPressure
Dispose this session on
MemoryPressure(Critical)and reload lazily.
- ExecutionProviders
How this session picks and configures its execution providers.
- FreeDimensionOverrides
Symbolic dimension name -> fixed value, applied with
SessionOptions.AddFreeDimensionOverrideByNamebefore the session is created. This is the ONLY mechanism that turns a graph's declared[batch_size, sequence_length]into static shapes, and therefore the only thing that makes RequireStaticInputShapes meaningful - padding the tensors fed at Run time does not, because CoreML partitions from the declared shapes at session creation. A session pinned this way serves exactly one shape: every batch is padded to it, and a second pinned shape would need a second session, which v1 does not do. Empty by default, so the default session is dynamic-shaped and CoreML partitions normally.This is a DIFFERENT ORT API from SessionConfigEntries. The two are separate properties on purpose and are never merged.
- MemoryHeadroomBytes
The fixed part of the memory pre-flight budget. Default 48 MB.
- MemoryHeadroomFactor
Refuse a session when the OS reports less than
modelBytes * factor +MemoryHeadroomBytes. 0 disables the pre-flight. The default is an engineering estimate anchored on the ~2x transient cost of session creation, NOT a measurement - see spec 19.
- SessionConfigEntries
Escape hatch for
SessionOptions.AddSessionConfigEntry. Unrelated to FreeDimensionOverrides, which is a different ORT API: that one rewrites the graph's declared symbolic dimensions, this one sets ORT's own string-keyed session configuration.