Back to Tensorflow

CompatibilityList

tensorflow/lite/g3doc/api_docs/java/org/tensorflow/lite/gpu/CompatibilityList.html

2.21.02.9 KB
Original Source

public class CompatibilityList

GPU Delegate CompatibilityListing data.

The GPU delegate is not supported on all Android devices, due to differences in available OpenGL versions, driver features, and device resources. This class provides information on whether the GPU delegate is suitable for the current device.

This API is experimental and subject to change.

WARNING: the compatibilityList is constructed from testing done on a limited set of models. You should plan to verify that your own model(s) work.

Example usage:

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);

Public Constructors

| | CompatibilityList() |

Public Methods

| void | close() Frees TFLite resources in C runtime.

| | GpuDelegate.Options | getBestOptionsForThisDevice() What options should be used for the GPU delegate.

| | boolean | isDelegateSupportedOnThisDevice() Whether the GPU delegate is supported on this device.

|

Inherited Methods

From class java.lang.Object

| boolean | equals(Object arg0) | | final Class<?> | getClass() | | int | hashCode() | | final void | notify() | | final void | notifyAll() | | String | toString() | | final void | wait(long arg0, int arg1) | | final void | wait(long arg0) | | final void | wait() |

From interface java.io.Closeable

| abstract void | close() |

From interface java.lang.AutoCloseable

| abstract void | close() |

Public Constructors

public CompatibilityList ()

Public Methods

public void close ()

Frees TFLite resources in C runtime.

User is expected to call this method explicitly.

public GpuDelegate.Options getBestOptionsForThisDevice ()

What options should be used for the GPU delegate.

public boolean isDelegateSupportedOnThisDevice ()

Whether the GPU delegate is supported on this device.