// Handle errors: corrupted file, unsupported opset, missing dependencies Debug.WriteLine($"Load failed: ex.Message");
// Force GPU var device = new LearningModelDevice(LearningModelDeviceKind.DirectXHighPerformance);
public async Task<float[]> RunInference(VideoFrame inputFrame)
The magic of windows.ai.machinelearning is invisible to the developer. You do not write CUDA code or DirectML shaders. Windows handles the hardware abstraction.
private async Task LoadModelAsync(string modelPath)
Once a model is loaded, you cannot simply run data through it immediately. You must create a LearningModelSession . This class encapsulates the state of the model evaluation.