CompatibilityList

公共类 CompatibilityList

GPU 代理 CompatibilityListing 数据。

并非所有 Android 设备都支持 GPU 代理,这是因为 OpenGL 版本、驱动程序功能和设备资源。这个类提供有关 GPU 代理是否适合当前设备。

此 API 处于实验阶段,可能会发生变化。

WARNING: 对兼容性列表进行构建时,需要对一组数量有限的一组 模型。您应计划验证自己的模型能否正常运行。

用法示例:

Interpreter.Options options = new Interpreter.Options();
 try (CompatibilityList compatibilityList = new CompatibilityList()) {
   if (compatibilityList.isDelegateSupportedOnThisDevice()) {
     GpuDelegate.Options delegateOptions = compatibilityList.getBestOptionsForThisDevice();
     gpuDelegate = new GpuDelegate(delegateOptions):
     options.addDelegate(gpuDelegate);
   }
 }
 Interpreter interpreter = new Interpreter(modelBuffer, options);
 

公共构造函数

公共方法

无效
close()
在 C 运行时中释放 TFLite 资源。
GpuDelegate.Options
getBestOptionsForThisDevice()
应对 GPU 委托使用哪些选项。
布尔值
isDelegateSupportedOnThisDevice()
此设备是否支持 GPU 代理。

继承的方法

公共构造函数

<ph type="x-smartling-placeholder"></ph> 公开 CompatibilityList ()

公共方法

<ph type="x-smartling-placeholder"></ph> 公开 无效 关闭 ()

在 C 运行时中释放 TFLite 资源。

用户应显式调用此方法。

<ph type="x-smartling-placeholder"></ph> 公开 GpuDelegate.Options getBestOptionsForThisDevice ()

应对 GPU 委托使用哪些选项。

<ph type="x-smartling-placeholder"></ph> 公开 布尔值 isDelegateSupportedOnThisDevice ()

此设备是否支持 GPU 代理。