CpuAccelerationConfig.Builder

  • CpuAccelerationConfig.Builder facilitates the creation and configuration of CPU acceleration for TensorFlow Lite.

  • It allows customization of thread count and enabling/disabling of default delegates like XNNPack.

  • The build() method finalizes the configuration and creates a CpuAccelerationConfig object.

  • Invalid configurations, such as an incorrect number of threads, result in an IllegalArgumentException.

public static class CpuAccelerationConfig.Builder extends Object

Builder class.

Public Constructor Summary

Builder()
Creates the CPU acceleration config builder.

Public Method Summary

CpuAccelerationConfig
build()
Builds the CPU acceleration config.
CpuAccelerationConfig.Builder
setDisableDefaultDelegates(boolean value)
Sets whether to disable the default delegates (XNNPack).
CpuAccelerationConfig.Builder
setNumThreads(int numThreads)
Sets the number of threads.

Inherited Method Summary

Public Constructors

public Builder ()

Creates the CPU acceleration config builder.

Public Methods

public CpuAccelerationConfig build ()

Builds the CPU acceleration config.

Throws
IllegalArgumentException if number of threads is not -1 or positive
IllegalArgumentException if default delegates are disabled and XNNPack delegate flag is set

public CpuAccelerationConfig.Builder setDisableDefaultDelegates (boolean value)

Sets whether to disable the default delegates (XNNPack).

public CpuAccelerationConfig.Builder setNumThreads (int numThreads)

Sets the number of threads. Set to -1 to let the interpreter choose. Otherwise, must be > 0.