Automatic code generation with mlgen
Windows Machine Learning's code generator mlgen creates an interface (C#, C++/WinRT, and C++/CX) with wrapper classes that call the Windows ML API for you, allowing you to easily load, bind, and evaluate a model in your project.
mlgen is provided as a Visual Studio extension for developers creating WinML applications in VS 2017 or later.
In Windows 10, version 1903 and later, mlgen is no longer included in the Windows 10 SDK, so you must download and install the extension. There is one for Visual Studio 2017 and one for Visual Studio 2019.
Once you have mlgen installed, inside your Visual Studio project, add your ONNX file to your project’s Assets folder, and VS will generate Windows ML wrapper classes in a new interface file. You can use these classes and methods to integrate your model into your application. See Tutorial: Create a Windows Machine Learning UWP application (C#) for a tutorial that integrates a model using this method.