Thanks for tuning in to Google I/O. View all sessions on demandWatch on demand


public class GpuDelegate

Delegate for GPU inference.

Note: When calling Interpreter.Options.addDelegate() and, the caller must have an EGLContext in the current thread and must be called from the same EGLContext. If an EGLContext does not exist, the delegate will internally create one, but then the developer must ensure that is always called from the same thread in which Interpreter.Options.addDelegate() was called.

Nested Classes

class GpuDelegate.Options This class is deprecated. Use GpuDelegateFactory.Options instead.  

Public Constructors

Public Methods

Frees TFLite resources in C runtime.
Returns a native handle to the TensorFlow Lite delegate implementation.

Inherited Methods

Public Constructors

public GpuDelegate (GpuDelegateFactory.Options options)


public GpuDelegate ()

Public Methods

public void close ()

Frees TFLite resources in C runtime.

User is expected to call this method explicitly.

public long getNativeHandle ()

Returns a native handle to the TensorFlow Lite delegate implementation.

Note: The Java Delegate maintains ownership of the native delegate instance, and must ensure its existence for the duration of usage with any InterpreterApi instance.

Note: the native delegate instance may not be created until the delegate has been attached to an interpreter, so this method should not be called until after an interpreter has been constructed with this delegate.

  • The native delegate handle. In C/C++, this should be a pointer to 'TfLiteOpaqueDelegate'.