public interface **Delegate**

|---|---|---|
| Known Indirect Subclasses [GpuDelegate](https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/gpu/GpuDelegate) |---|---| | [GpuDelegate](https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/gpu/GpuDelegate) | `https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/Delegate` for GPU inference. | |||

Wrapper for a native TensorFlow Lite Delegate.

If a delegate implementation holds additional resources or memory that should be explicitly
freed, then best practice is to add a `close()` method to the implementation and have the
client call that explicitly when the delegate instance is no longer in use. While this approach
technically allows sharing of a single delegate instance across multiple interpreter instances,
the delegate implementation must explicitly support this.

<br />

### Public Methods

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

### Inherited Methods

From interface java.io.Closeable

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

From interface java.lang.AutoCloseable

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

## Public Methods

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

Closes the delegate and releases any resources associated with it.

In contrast to the method declared in the base `https://developer.android.com/reference/java/io/Closeable.html` interface, this method
does not throw checked exceptions.

<br />

#### public abstract 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'.

##### Throws

| [IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException.html) | if called before the native delegate instance has been constructed. |
|---|---|