Interpreter.Options

public static class Interpreter.Options

An options class for controlling runtime interpreter behavior.

Public Constructors

Public Methods

Interpreter.Options
addDelegate(Delegate delegate)
Adds a Delegate to be applied during interpreter creation.
Interpreter.Options
addDelegateFactory(DelegateFactory delegateFactory)
Adds a DelegateFactory which will be invoked to apply its created Delegate during interpreter creation.
Interpreter.Options
setAllowBufferHandleOutput(boolean allow)
Advanced: Set if buffer handle output is allowed.
Interpreter.Options
setAllowFp16PrecisionForFp32(boolean allow)
This method is deprecated. Prefer using NnApiDelegate.Options#setAllowFp16(boolean enable).
Interpreter.Options
setCancellable(boolean allow)
Advanced: Set if the interpreter is able to be cancelled.
Interpreter.Options
setNumThreads(int numThreads)
Sets the number of threads to be used for ops that support multi-threading.
Interpreter.Options
setRuntime(InterpreterApi.Options.TfLiteRuntime runtime)
Specify where to get the TF Lite runtime implementation from.
Interpreter.Options
setUseNNAPI(boolean useNNAPI)
Sets whether to use NN API (if available) for op execution.
Interpreter.Options
setUseXNNPACK(boolean useXNNPACK)
Enable or disable an optimized set of CPU kernels (provided by XNNPACK).

Inherited Methods

Public Constructors

public Options ()

public Options (InterpreterApi.Options options)

Parameters
options

Public Methods

public Interpreter.Options addDelegate (Delegate delegate)

Adds a Delegate to be applied during interpreter creation.

Delegates added here are applied before any delegates created from a DelegateFactory that was added with addDelegateFactory(DelegateFactory).

Note that TF Lite in Google Play Services (see setRuntime(InterpreterApi.Options.TfLiteRuntime)) does not support external (developer-provided) delegates, and adding a Delegate other than ERROR(/NnApiDelegate) here is not allowed when using TF Lite in Google Play Services.

Parameters
delegate

public Interpreter.Options addDelegateFactory (DelegateFactory delegateFactory)

Adds a DelegateFactory which will be invoked to apply its created Delegate during interpreter creation.

Delegates from a delegated factory that was added here are applied after any delegates added with addDelegate(Delegate).

Parameters
delegateFactory

public