FirebaseModelInputs.Builder

public static class FirebaseModelInputs.Builder extends Object

Builder class of FirebaseModelInputs.

Public Constructor Summary

FirebaseModelInputs.Builder()
Creates a new builder to build FirebaseModelInputs.

Public Method Summary

FirebaseModelInputs.Builder
add(Object input)
Adds an input for custom model inference.
FirebaseModelInputs
build()
Builds a FirebaseModelInputs.

Inherited Method Summary

Public Constructors

public FirebaseModelInputs.Builder ()

Creates a new builder to build FirebaseModelInputs.

Public Methods

public FirebaseModelInputs.Builder add (Object input)

Adds an input for custom model inference.

Inputs must be added in the same order as inputs of the corresponding model. It accepts array, multidimensional array or a direct ByteBuffer as inputs of primitive types including int, float, long, and byte.

ByteBuffer is the preferred way to pass large input data. When ByteBuffer is used, its content should remain unchanged until model inference is done. Its type and dimensions must match the corresponding configurations provided by FirebaseModelInputOutputOptions.

Array and multidimensional array are also supported formats for input. However, these formats have performance impact especially when the data size is large. Please use it mainly for debugging or latency non-sensitive use cases.

Parameters
input an array, multidimensional array, or a direct ByteBuffer of primitive types including int, float, long, and byte.
Returns
  • a builder to build the FirebaseModelInputs.
Throws
NullPointerException if the input object is null.
IllegalArgumentException if the input object is not a ByteBuffer, an array or a multidimensional array.
FirebaseMLException if the input is not a direct ByteBuffer or is not in nativeOrder(). See also Direct VS non-direct buffers.

public FirebaseModelInputs build ()

Builds a FirebaseModelInputs.