ML Community Day is November 9! Join us for updates from TensorFlow, JAX, and more Learn more

BaseOptions.Builder

public static abstract class BaseOptions.Builder

Builder for BaseOptions.

Public Constructors

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

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