Dela via


LearningModelSessionOptions Class

Definition

Describes inference options that are used during the creation of LearningModelSession objects.

public ref class LearningModelSessionOptions sealed
/// [Windows.Foundation.Metadata.Activatable(131072, "Windows.AI.MachineLearning.MachineLearningContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.AI.MachineLearning.MachineLearningContract, 131072)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class LearningModelSessionOptions final
[Windows.Foundation.Metadata.Activatable(131072, "Windows.AI.MachineLearning.MachineLearningContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.AI.MachineLearning.MachineLearningContract), 131072)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class LearningModelSessionOptions
function LearningModelSessionOptions()
Public NotInheritable Class LearningModelSessionOptions
Inheritance
Object Platform::Object IInspectable LearningModelSessionOptions
Attributes

Windows requirements

Device family
Windows 10, version 1903 (introduced in 10.0.18362.0)
API contract
Windows.AI.MachineLearning.MachineLearningContract (introduced in v2.0)

Examples

The following example creates a LearningModelSessionOptions object for use during session creation.

private LearningModelSessionOptions CreateSessionOptions()
{
    var options = new LearningModelSessionOptions();

    // Disable constant batch size optimizations
    options.BatchSizeOverride = 0;

    return options;
}

Remarks

The LearningModelSessionOptions object can be used to configure LearningModelSession construction.

Version history

Windows version SDK version Value added
2004 19041 CloseModelOnSessionCreation

Constructors

LearningModelSessionOptions()

Creates options to configure the creation of a LearningModelSession.

Properties

BatchSizeOverride

A numeric value that specifies a constant batch size override value for the target model.

CloseModelOnSessionCreation

Specifies whether a LearningModelSession should close the associated learning model when it is created.

Methods

OverrideNamedDimension(String, UInt32)

Provides the ability to override named input dimensions of a Learning Model to concrete values.

Applies to