-api-id | -api-type |
---|---|
P:Windows.AI.MachineLearning.Preview.LearningModelPreview.InferencingOptions |
winrt property |
Deprecated. Gets or sets the inferencing options for the evaluation of a model.
The inferencing options for the evaluation of a model.
Warning
This is a deprecated API. Please use the Windows.AI.MachineLearning namespace instead.
public async Task LoadModelAsync()
{
// Load Model
var modelFile = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync("model.onnx");
LearningModelPreview model = await LearningModelPreview.LoadModelFromStorageFileAsync(modelFile);
//Set inferencing options to use GPU
InferencingOptionsPreview options = model.InferencingOptions;
options.PreferredDeviceKind = LearningModelDeviceKindPreview.LearningDeviceCpu;
model.InferencingOptions = options;
}