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 回答
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://docs.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/
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.
you can also track the supported opset versions at the version matrix table.