public static class Interpreter.Options
extends java.lang.Object
| Constructor and Description |
|---|
Options() |
| Modifier and Type | Method and Description |
|---|---|
Interpreter.Options |
addDelegate(Delegate delegate)
Adds a
Delegate to be applied during interpreter creation. |
Interpreter.Options |
setAllowBufferHandleOutput(boolean allow)
Advanced: Set if buffer handle output is allowed.
|
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 |
setUseNNAPI(boolean useNNAPI)
Sets whether to use NN API (if available) for op execution.
|
Interpreter.Options |
setUseXNNPACK(boolean useXNNPACK)
Experimental: Enable an optimized set of floating point CPU kernels (provided by
XNNPACK).
|
public Interpreter.Options setNumThreads(int numThreads)
public Interpreter.Options setUseNNAPI(boolean useNNAPI)
public Interpreter.Options addDelegate(Delegate delegate)
Delegate to be applied during interpreter creation.
WARNING: This is an experimental interface that is subject to change.
public Interpreter.Options setAllowBufferHandleOutput(boolean allow)
When a Delegate supports hardware acceleration, the interpreter will make the
data of output tensors available in the CPU-allocated tensor buffers by default. If the
client can consume the buffer handle directly (e.g. reading output from OpenGL texture),
it can set this flag to false, avoiding the copy of data to the CPU buffer. The delegate
documentation should indicate whether this is supported and how it can be used.
WARNING: This is an experimental interface that is subject to change.
public Interpreter.Options setCancellable(boolean allow)
public Interpreter.Options setUseXNNPACK(boolean useXNNPACK)
Enabling this flag will enable use of a new, highly optimized set of CPU kernels provided via the XNNPACK delegate. Currently, this is restricted to a subset of floating point operations. Eventually, we plan to enable this by default, as it can provide significant peformance benefits for many classes of floating point models. See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/delegates/xnnpack/README.md for more details.
Things to keep in mind when enabling this flag:
WARNING: This is an experimental interface that is subject to change.