In order to use my custom TF model through WinML, I converted it to onnx using the tf2onnx converter. The conversion finally worked using opset 11. Unfortunately I cannot load the model in the WinRT c++ library, therefore I am confused about the opset support: According to the Release Notes, the latest WinML release in May supports opset 11. I updated my VS2019 and downloaded the latest Windows 10 SDK, does the c++ API already include the latest onnx support? Or is there any alternative way to use my model in WinML c++?
3 Answers
The latest release of Windows OS contains support for opset 9. The latest release of Microsoft.AI.MachineLearning NuGet package contains support for opset 11.
Please refer to these release notes: https://learn.microsoft.com/en-us/windows/ai/windows-ml/release-notes
You can find the latest Microsoft.AI.MachineLearning NuGet package here: https://www.nuget.org/packages/Microsoft.AI.MachineLearning/

- 168
- 7
As @Kookei mentioned, there are 2 ways of building WinML: the "In-Box" way and the NuGet way.
In-Box basically just means link to whatever WinML DLLs that are included with Windows itself (e.g., in C:\Window\System32).
The NuGet package contains its own more recent set of DLLs, which other than providing support for the latest ONNX opset, has the obvious advantage of allowing you to easily distribute your binary to older versions of Windows lacking any built-in machine learning capability. Just install the package through Visual Studio's Nuget Package Manager, and build your solution; and you'll find that the output directory now contains the needed DLLs (currently directml.dll
, Microsoft.AI.MachineLearning.dll
, and onnxruntime.dll
) along with the generated EXE, ready for same-folder deployment.
In terms of source code, this is how the two versions are distinguished:
In-Box:
#include <winrt/Windows.AI.MachineLearning.h>
using WinMLModel = winrt::windows::AI::MachineLearning
NuGet:
#include <winrt/Microsoft.AI.MachineLearning.h>
using WinMLModel = winrt::Microsoft::AI::MachineLearning
In other words, the only difference is whether you use the Window
or Microsoft
header/namespace.

- 2,014
- 2
- 19
- 42
-
Thank you for the answer. I have noticed that when I install Microsoft.AI.MachineLearning over the NuGet package manager and afterwards uninstall it again, the behaviour of my code changes. Does this also update DirectML and onnxruntime distributions? – Camill Trüeb Aug 07 '20 at 13:35
-
@JamesTrüeb The NuGet package provides a complete ONNXRuntime→WinML→DirectML stack of DLLs, which should be completely gone again upon uninstall, so no; I don't think that should affect your code, or any other similar distributions installed elsewhere on your system. (If it's an issue you can explain in clear detail, and which is straightforward to reproduce, then that would be good separate question to post.) – Will Aug 07 '20 at 13:57