Back to Tensorflow

BaseOptions.Builder

tensorflow/lite/g3doc/api_docs/java/org/tensorflow/lite/task/core/BaseOptions.Builder.html

2.21.04.0 KB
Original Source

public static abstract class BaseOptions.Builder

Builder for BaseOptions.

Public Constructors

| | Builder() |

Public Methods

| abstract BaseOptions | build() | | abstract BaseOptions.Builder | setComputeSettings(ComputeSettings computeSettings) Sets the advanced accelerator options.

| | abstract BaseOptions.Builder | setNumThreads(int numThreads) Sets the number of threads to be used for TFLite ops that support multi-threading when running inference with CPU.

| | BaseOptions.Builder | useGpu() Uses GPU for inference.

| | BaseOptions.Builder | useNnapi() Uses NNAPI for inference.

|

Inherited Methods

From class java.lang.Object

| boolean | equals(Object arg0) | | final Class<?> | getClass() | | int | hashCode() | | final void | notify() | | final void | notifyAll() | | String | toString() | | final void | wait(long arg0, int arg1) | | final void | wait(long arg0) | | final void | wait() |

Public Constructors

public Builder ()

Public Methods

public abstract BaseOptions build ()

public abstract BaseOptions.Builder setComputeSettings (ComputeSettings computeSettings)

Sets the advanced accelerator options.

Note: this method will override those highlevel API to choose an delegate, such as useGpu() and useNnapi().

Parameters

| computeSettings | |

public abstract BaseOptions.Builder setNumThreads (int numThreads)

Sets the number of threads to be used for TFLite ops that support multi-threading when running inference with CPU. Defaults to -1.

numThreads should be greater than 0 or equal to -1. Setting numThreads to -1 has the effect to let TFLite runtime set the value.

Parameters

| numThreads | |

public BaseOptions.Builder useGpu ()

Uses GPU for inference. The advanced GPU configuration settings will be set to default values.

Note: this method will override the settings from setComputeSettings(ComputeSettings).

To manipulate the advanced GPU configuration settings, use setComputeSettings(ComputeSettings).

public BaseOptions.Builder useNnapi ()

Uses NNAPI for inference. The advanced NNAPI configuration settings will be set to default values.

Note: this method will override the settings from setComputeSettings(ComputeSettings).

To manipulate the advanced NNAPI configuration settings, use setComputeSettings(ComputeSettings).