在 Windows ML 中检查执行提供程序版本

Windows ML 中的大多数执行提供程序在运行时动态获取,如 安装 Windows ML EP 中所示,更新版本会通过兼容更新自动更新,如 更新 Windows ML EP 中所述,这意味着 EP 的版本可能会随时间而变化。

请参阅 支持的执行提供程序文档 ,了解可用的执行提供程序及其发布历史记录。

检查最终用户的 EP 版本

可以通过检查 ExecutionProvider 上的 PackageId 属性,以编程方式检查设备上存在的执行提供程序(EP)的版本。

如果 EP 尚不存在,PackageId 将返回 null。

// Get all EPs compatible with this device
var providers = ExecutionProviderCatalog.GetDefault().FindAllProviders();

// For each provider
foreach (var provider in providers)
{
    // Log the name
    Debug.WriteLine($"Windows ML EP: {provider.Name}");

    // Log the version
    if (provider.PackageId != null)
    {
        var v = provider.PackageId.Version;
        Debug.WriteLine($"Version: {v.Major}.{v.Minor}.{v.Build}.{v.Revision}");
    }
    else
    {
        Debug.WriteLine("Version: Not installed");
    }
}

在安装了 QNN EP 的设备上,此代码输出以下代码...

Windows ML EP: QNNExecutionProvider
Version: 1.8.27.0

请检查您设备的 EP 版本号

还可以使用 PowerShell 轻松检查开发设备上安装了哪个版本的 EP。

Get-AppxPackage MicrosoftCorporationII.WinML.*

在安装了 QNN EP 的设备上,这会输出以下内容...

Name              : MicrosoftCorporationII.WinML.Qualcomm.QNN.EP.1.8
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : Arm64
ResourceId        :
Version           : 1.8.27.0
...

另请参阅