公共类 CompatibilityList
GPU 委托 CompatibilityListing 数据。
由于可用的 OpenGL 版本、驱动程序功能和设备资源存在差异,并非所有 Android 设备都支持 GPU 代理。此类提供了关于 GPU 代理是否适合当前设备的信息。
此 API 目前处于实验阶段,可能会发生变化。
警告:compatibilityList 通过对有限的一组模型进行测试构建而成。您应计划验证自己的模型是否有效。
用法示例:
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);
公共构造函数
公共方法
void |
close()
在 C 运行时中释放 TFLite 资源。
|
GpuDelegate.Options |
getBestOptionsForThisDevice()
应为 GPU 代理使用哪些选项。
|
布尔值 |
isDelegateSupportedOnThisDevice()
此设备是否支持 GPU 代理。
|
继承的方法
公共构造函数
public CompatibilityList ()
公共方法
public void close ()
在 C 运行时中释放 TFLite 资源。
用户应明确调用此方法。
public 布尔值 isDelegateSupportedOnThisDevice ()
此设备是否支持 GPU 代理。