Windows.ai.machinelearning 🎯 Ad-Free

var session = new LearningModelSession(model, device);

// Prepare input tensor (example: image 224x224 RGB) var inputData = new float[1 * 3 * 224 * 224]; // fill with your image data var inputTensor = TensorFloat.CreateFromArray(new long[] 1, 3, 224, 224 , inputData); binding.Bind("input", inputTensor);

using Microsoft.ML.OnnxRuntime; using Microsoft.AI.MachineLearning; // Load model var file = await StorageFile.GetFileFromApplicationUriAsync( new Uri("ms-appx:///Assets/model.onnx")); var model = await LearningModel.LoadFromStorageFileAsync(file); // Create session var session = new LearningModelSession(model, new LearningModelDevice(LearningModelDeviceKind.Default)); // Create binding var binding = new LearningModelBinding(session); windows.ai.machinelearning

// 1. Preprocess: resize to model input size (224x224) var resized = await ImageHelper.ResizeBitmap(bitmap, 224, 224); // 2. Convert to float tensor (channel-first, normalized) var tensor = ImageHelper.BitmapToTensor(resized);

// Run inference var results = await session.EvaluateAsync(binding, "runId"); Load model (cache globally) var model = await App

// 3. Load model (cache globally) var model = await App.ModelLoader.GetModelAsync();

// Force GPU var device = new LearningModelDevice(LearningModelDeviceKind.DirectXHighPerformance); // Force NPU (Windows 11 24H2+) var device = new LearningModelDevice(LearningModelDeviceKind.Npu); options.CloseModelOnSessionCreation = false

// 4. Bind & evaluate var session = new LearningModelSession(model); var binding = new LearningModelBinding(session); binding.Bind("data", tensor);

// 5. Map to label return Labels[ArgMax(classId)]; Windows ML automatically uses DirectML – you don’t need to change code. But you can select the device:

LearningModelSessionOptions options = new LearningModelSessionOptions(); options.CloseModelOnSessionCreation = false; options.LoggingName = "MyModel";

var result = await session.EvaluateAsync(binding, ""); var classId = result.Outputs["softmaxout"] as TensorFloat;

©2025 KLEO Template a premium and multipurpose theme from Seventh Queen

Terms & conditions | Privacy Policy

Choose from the demos we created for you.
You can customize side area from admin with any content.
#1 SELLING BUDDYPRESS THEME FOR 2025
windows.ai.machinelearning
BUDDYPRESS PROFILE
windows.ai.machinelearning
NEWS MAGAZINE
windows.ai.machinelearning
COMPANY PAGE
windows.ai.machinelearning
PROFILE SEARCH
windows.ai.machinelearning
PINTEREST STYLE
windows.ai.machinelearning
REGISTER LANDING
windows.ai.machinelearning
GEO DIRECTORY
windows.ai.machinelearning
FOOD/RESTAURANT
windows.ai.machinelearning
COMMUNITY
windows.ai.machinelearning
TRAVEL DESTINATION
windows.ai.machinelearning
PORTFOLIO
windows.ai.machinelearning
FITNESS
windows.ai.machinelearning
MEDICAL CLINIQUE
windows.ai.machinelearning
AGENCY
windows.ai.machinelearning
SENSEI
windows.ai.machinelearning
PRODUCT LANDING
windows.ai.machinelearning
MATERIAL DESIGN
windows.ai.machinelearning
STYLISH SHOP
windows.ai.machinelearning
ECOMMERCE
windows.ai.machinelearning
RESUME
windows.ai.machinelearning
GET CONNECTED V.
windows.ai.machinelearning
MOBILE APP
windows.ai.machinelearning
BLACK FRIDAY
windows.ai.machinelearning
NEW YEAR
windows.ai.machinelearning
NEW YEAR
DEMOS
PURCHASE LICENSE!
or
User: demo Password: demo

Log in with your credentials

or    

Forgot your details?

or

Create Account