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

Model.Builder

public static class Model.Builder

This class was deprecated in API level .
Please use Model.createModel(Context, String, Options).

Builder for Model.

Public Constructors

Builder(Context context, String modelPath)
Creates a builder which loads tflite model from asset folder using memory-mapped files.

Public Methods

Model
build()
Model.Builder
setDevice(Model.Device device)
Sets running device.
Model.Builder
setNumThreads(int numThreads)
Sets number of threads.

Inherited Methods

Public Constructors

public Builder (Context context, String modelPath)

Creates a builder which loads tflite model from asset folder using memory-mapped files.

Parameters
context Application context to access assets.
modelPath Asset path of the model (.tflite file).
Throws
IOException if an I/O error occurs when loading the tflite model.

Public Methods

public Model build ()

public Model.Builder setDevice (Model.Device device)

Sets running device. By default, TFLite will run on CPU.

Parameters
device

public Model.Builder setNumThreads (int numThreads)

Sets number of threads. By default it's 1.

Parameters
numThreads