Maps an int value tensor to a list of string labels. It takes an array of strings as the
dictionary. Example: if the given tensor is [3, 1, 0], and given labels is ["background",
"apple", "banana", "cherry", "date"], the result will be ["date", "banana", "apple"].
Parameters
tensorBuffer
A tensor with index values. The values should be non-negative integers, and
each value x will be converted to labels[x + offset]. If the tensor is
given as a float TensorBuffer, values will be cast to integers. All values that are
out of bound will map to empty string.
labels
A list of strings, used as a dictionary to look up. The index of the array
element will be used as the key. To get better performance, use an object that implements
RandomAccess, such as ArrayList.
offset
The offset value when look up int values in the labels.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-05-10 UTC."],[],[],null,["# LabelUtil\n\npublic class **LabelUtil** \nLabel operation utils. \n\n### Public Methods\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [List](https://developer.android.com/reference/java/util/List.html)\\\u003c[String](https://developer.android.com/reference/java/lang/String.html)\\\u003e | [mapValueToLabels](/edge/api/tflite/java/org/tensorflow/lite/support/label/LabelUtil#mapValueToLabels(org.tensorflow.lite.support.tensorbuffer.TensorBuffer,%20java.util.List\u003cjava.lang.String\u003e,%20int))([TensorBuffer](/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer) tensorBuffer, [List](https://developer.android.com/reference/java/util/List.html)\\\u003c[String](https://developer.android.com/reference/java/lang/String.html)\\\u003e labels, int offset) Maps an int value tensor to a list of string labels. |\n\n### Inherited Methods\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|\n| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object.html) arg0) |\n| final [Class](https://developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](https://developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Methods\n--------------\n\n#### public static [List](https://developer.android.com/reference/java/util/List.html)\\\u003c[String](https://developer.android.com/reference/java/lang/String.html)\\\u003e\n**mapValueToLabels**\n([TensorBuffer](/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer) tensorBuffer, [List](https://developer.android.com/reference/java/util/List.html)\\\u003c[String](https://developer.android.com/reference/java/lang/String.html)\\\u003e labels, int offset)\n\nMaps an int value tensor to a list of string labels. It takes an array of strings as the\ndictionary. Example: if the given tensor is \\[3, 1, 0\\], and given labels is \\[\"background\",\n\"apple\", \"banana\", \"cherry\", \"date\"\\], the result will be \\[\"date\", \"banana\", \"apple\"\\]. \n\n##### Parameters\n\n| tensorBuffer | A tensor with index values. The values should be non-negative integers, and each value `x` will be converted to `labels[x + offset]`. If the tensor is given as a float [TensorBuffer](/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer), values will be cast to integers. All values that are out of bound will map to empty string. |\n| labels | A list of strings, used as a dictionary to look up. The index of the array element will be used as the key. To get better performance, use an object that implements RandomAccess, such as [ArrayList](https://developer.android.com/reference/java/util/ArrayList.html). |\n| offset | The offset value when look up int values in the `labels`. |\n|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n\n##### Returns\n\n- the mapped strings. The length of the list is [TensorBuffer.getFlatSize()](/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer#getFlatSize()). \n\n##### Throws\n\n| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html) | if `tensorBuffer` or `labels` is null. |\n|-------------------------------------------------------------------------------------------------------------|----------------------------------------|"]]