NLClassifier.NLClassifierOptions.Builder

public static abstract class NLClassifier.NLClassifierOptions.Builder

Public Constructors

Public Methods

abstract NLClassifier.NLClassifierOptions
build()
abstract NLClassifier.NLClassifierOptions.Builder
setBaseOptions(BaseOptions baseOptions)
Sets the general options to configure Task APIs, such as accelerators.
abstract NLClassifier.NLClassifierOptions.Builder
setInputTensorIndex(int inputTensorIndex)
Set the index of the input text tensor among all input tensors, if the model has multiple inputs.
abstract NLClassifier.NLClassifierOptions.Builder
setInputTensorName(String inputTensorName)
Set the name of the input text tensor, if the model has multiple inputs.
abstract NLClassifier.NLClassifierOptions.Builder
setOutputLabelTensorIndex(int outputLabelTensorIndex)
Set the index of the optional output label tensor among all output tensors, if the model has multiple outputs.
abstract NLClassifier.NLClassifierOptions.Builder
setOutputLabelTensorName(String outputLabelTensorName)
Set the name of the output label tensor, if the model has multiple outputs.
abstract NLClassifier.NLClassifierOptions.Builder
setOutputScoreTensorIndex(int outputScoreTensorIndex)
Set the index of the output score tensor among all output tensors, if the model has multiple outputs.
abstract NLClassifier.NLClassifierOptions.Builder
setOutputScoreTensorName(String outputScoreTensorName)
Set the name of the output score tensor, if the model has multiple outputs.

Inherited Methods

Public Constructors

public Builder ()

Public Methods

public abstract NLClassifier.NLClassifierOptions build ()

public abstract NLClassifier.NLClassifierOptions.Builder setBaseOptions (BaseOptions baseOptions)

Sets the general options to configure Task APIs, such as accelerators.

Parameters
baseOptions

public abstract NLClassifier.NLClassifierOptions.Builder setInputTensorIndex (int inputTensorIndex)

Set the index of the input text tensor among all input tensors, if the model has multiple inputs. Only the input tensor specified will be used for inference; other input tensors will be ignored. Dafualt to 0.

See the section, Configure the input/output tensors for NLClassifier, for more details.

Parameters
inputTensorIndex

public abstract NLClassifier.NLClassifierOptions.Builder setInputTensorName (String inputTensorName)

Set the name of the input text tensor, if the model has multiple inputs. Only the input tensor specified will be used for inference; other input tensors will be ignored. Dafualt to "INPUT".

See the section, Configure the input/output tensors for NLClassifier, for more details.

Parameters
inputTensorName

public abstract NLClassifier.NLClassifierOptions.Builder setOutputLabelTensorIndex (int outputLabelTensorIndex)

Set the index of the optional output label tensor among all output tensors, if the model has multiple outputs.

See the document above outputLabelTensorName for more information about what the output label tensor is.

See the section, Configure the input/output tensors for NLClassifier, for more details.

outputLabelTensorIndex dafualts to -1, meaning to disable the output label tensor.

Parameters
outputLabelTensorIndex

public abstract NLClassifier.NLClassifierOptions.Builder setOutputLabelTensorName (String outputLabelTensorName)

Set the name of the output label tensor, if the model has multiple outputs. Dafualt to "OUTPUT_LABEL".

See the section, Configure the input/output tensors for NLClassifier, for more details.

By default, label file should be packed with the output score tensor through Model Metadata. See the MetadataWriter for NLClassifier. NLClassifier reads and parses labels from the label file automatically. However, some models may output a specific label tensor instead. In this case, NLClassifier reads labels from the output label tensor.

Parameters
outputLabelTensorName

public abstract NLClassifier.NLClassifierOptions.Builder setOutputScoreTensorIndex (int outputScoreTensorIndex)

Set the index of the output score tensor among all output tensors, if the model has multiple outputs. Dafualt to 0.

See the section, Configure the input/output tensors for NLClassifier, for more details.

Parameters
outputScoreTensorIndex

public abstract NLClassifier.NLClassifierOptions.Builder setOutputScoreTensorName (String outputScoreTensorName)

Set the name of the output score tensor, if the model has multiple outputs. Dafualt to "OUTPUT_SCORE".

See the section, Configure the input/output tensors for NLClassifier, for more details.

Parameters
outputScoreTensorName