GpuDelegate

public class GpuDelegate

Delegate for GPU inference.

Note: When calling Interpreter.Options.addDelegate() and Interpreter.run(), the caller must have an EGLContext in the current thread and Interpreter.run() 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 Interpreter.run() 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

void
close()
Frees TFLite resources in C runtime.
long
getNativeHandle()
Returns a native handle to the TensorFlow Lite delegate implementation.

Inherited Methods

Public Constructors

public GpuDelegate (GpuDelegateFactory.Options options)

Parameters
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.

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