CompatibilityList

公開類別 CompatibilityList

GPU 委派 CompatibilityListing 資料。

由於可用的 OpenGL 版本、驅動程式功能和裝置資源不同,部分 Android 裝置並不支援 GPU 委派功能。這個類別可提供資訊,說明 GPU 委派是否適用於目前的裝置。

這個 API 仍在實驗階段,可能會有變動。

警告:相容性清單是在部分模型上進行測試所建構。您應規劃驗證自己的模型是否有效。

使用方式範例:

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 GpuDelegate.Options getBestOptionsForThisDevice ()

哪些選項適用於 GPU 委派。

public boolean isDelegateSupportedOnThisDevice ()

這部裝置是否支援 GPU 委派功能。