public class **GpuDelegate** `https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/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.

<br />

### Nested Classes

|---|---|---|---|
| class | [GpuDelegate.Options](https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/gpu/GpuDelegate.Options) || *This class is deprecated. Use `https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/gpu/GpuDelegateFactory.Options` instead.* |

### Public Constructors

|---|---|
|   | [GpuDelegate](https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/gpu/GpuDelegate#GpuDelegate(org.tensorflow.lite.gpu.GpuDelegateFactory.Options))([GpuDelegateFactory.Options](https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/gpu/GpuDelegateFactory.Options) options) |
|   | [GpuDelegate](https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/gpu/GpuDelegate#GpuDelegate())() |

### Public Methods

|---|---|
| void | [close](https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/gpu/GpuDelegate#close())() Frees TFLite resources in C runtime. |
| long | [getNativeHandle](https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/gpu/GpuDelegate#getNativeHandle())() Returns a native handle to the TensorFlow Lite delegate implementation. |

### Inherited Methods

From class java.lang.Object

|---|---|
| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object.html) arg0) |
| final [Class](https://developer.android.com/reference/java/lang/Class.html)\<?\> | getClass() |
| int | hashCode() |
| final void | notify() |
| final void | notifyAll() |
| [String](https://developer.android.com/reference/java/lang/String.html) | toString() |
| final void | wait(long arg0, int arg1) |
| final void | wait(long arg0) |
| final void | wait() |

From interface [org.tensorflow.lite.Delegate](https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/Delegate)

|---|---|
| void | [close](https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/Delegate#close())() Closes the delegate and releases any resources associated with it. |
| abstract long | [getNativeHandle](https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/Delegate#getNativeHandle())() Returns a native handle to the TensorFlow Lite delegate implementation. |

From interface java.io.Closeable

|---|---|
| abstract void | close() |

From interface java.lang.AutoCloseable

|---|---|
| abstract void | close() |

## Public Constructors

#### public
**GpuDelegate**
([GpuDelegateFactory.Options](https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/gpu/GpuDelegateFactory.Options) options)

<br />

##### Parameters

| options |   |
|---|---|

#### public
**GpuDelegate**
()

<br />

## Public Methods

#### public void
**close**
()

Frees TFLite resources in C runtime.

User is expected to call this method explicitly.

<br />

#### public long
**getNativeHandle**
()

Returns a native handle to the TensorFlow Lite delegate implementation.

Note: The Java `https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/Delegate` maintains ownership of the native delegate instance, and
must ensure its existence for the duration of usage with any `https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/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.

<br />

<br />

##### Returns

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