Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
A builder for InferenceOutput
Summary
Public constructors
Public methods
build
fun build(): InferenceOutput
Builds the instance. This builder should not be touched after calling this!
setData
fun setData(value: ByteArray): InferenceOutput.Builder
A byte array that holds input data. The inputs should be in the same order as inputs of the model.
For LiteRT, this field is a serialized Map that is mapped to outputs of runForMultipleInputsOutputs: https://www.tensorflow.org/lite/api_docs/java/org/tensorflow/lite/InterpreterApi#parameters_9
For ExecuTorch model, this field is a serialized EValue array.
Parameters |
value |
ByteArray: This value cannot be null . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[[["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 2025-08-20 UTC."],[],[],null,["# InferenceOutput.Builder\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/adservices/ondevicepersonalization/InferenceOutput.Builder \"View this page in Java\") \n\n```\nclass Builder\n```\n\n|---|-------------------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.adservices.ondevicepersonalization.InferenceOutput.Builder](#) |\n\nA builder for [InferenceOutput](/reference/kotlin/android/adservices/ondevicepersonalization/InferenceOutput)\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------|---|\n| [Builder](#Builder())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|-------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [InferenceOutput.Builder](#) | [addDataOutput](#addDataOutput(kotlin.Int,%20kotlin.Any))`(`key:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `value:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)`)` \u003cbr /\u003e |\n| [InferenceOutput](/reference/kotlin/android/adservices/ondevicepersonalization/InferenceOutput) | [build](#build())`()` Builds the instance. |\n| [InferenceOutput.Builder](#) | [setData](#setData(kotlin.ByteArray))`(`value:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)`)` A byte array that holds input data. |\n| [InferenceOutput.Builder](#) | [setDataOutputs](#setDataOutputs(kotlin.collections.MutableMap))`(`value:` `[MutableMap](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-map/index.html)\u003c[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!,` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!\u003e`)` Note: use [InferenceOutput.Builder.setData(byte[])](#setData(kotlin.ByteArray)) instead. |\n\nPublic constructors\n-------------------\n\n### Builder\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nBuilder()\n```\n\nPublic methods\n--------------\n\n### addDataOutput\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun addDataOutput(\n key: Int, \n value: Any\n): InferenceOutput.Builder\n```\n\n| Parameters ||\n|---------|----------------------------------------------------------------------------------------------------------|\n| `value` | [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html): This value cannot be `null`. |\n\n| Return ||\n|------------------------------|------------------------------|\n| [InferenceOutput.Builder](#) | This value cannot be `null`. |\n\n**See Also**\n\n- [#setDataOutputs](#setDataOutputs(kotlin.collections.MutableMap)) \n\n### build\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun build(): InferenceOutput\n```\n\nBuilds the instance. This builder should not be touched after calling this!\n\n| Return ||\n|-------------------------------------------------------------------------------------------------|------------------------------|\n| [InferenceOutput](/reference/kotlin/android/adservices/ondevicepersonalization/InferenceOutput) | This value cannot be `null`. |\n\n### setData\n\nAdded in [API level Baklava](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setData(value: ByteArray): InferenceOutput.Builder\n```\n\nA byte array that holds input data. The inputs should be in the same order as inputs of the model.\n\nFor LiteRT, this field is a serialized Map that is mapped to outputs of runForMultipleInputsOutputs: https://www.tensorflow.org/lite/api_docs/java/org/tensorflow/lite/InterpreterApi#parameters_9\n\nFor ExecuTorch model, this field is a serialized EValue array.\n\n| Parameters ||\n|---------|-----------------------------------------------------------------------------------------------------------------------|\n| `value` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html): This value cannot be `null`. |\n\n| Return ||\n|------------------------------|------------------------------|\n| [InferenceOutput.Builder](#) | This value cannot be `null`. |\n\n### setDataOutputs\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setDataOutputs(value: MutableMap\u003cInt!, Any!\u003e): InferenceOutput.Builder\n```\n\nNote: use [InferenceOutput.Builder.setData(byte[])](#setData(kotlin.ByteArray)) instead.\n\nA map mapping output indices to multidimensional arrays of output.\n\nFor TFLite, this field is mapped to outputs of runForMultipleInputsOutputs: https://www.tensorflow.org/lite/api_docs/java/org/tensorflow/lite/InterpreterApi#parameters_9\n\n| Parameters ||\n|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `value` | [MutableMap](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-map/index.html)\\\u003c[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!, [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!\\\u003e: This value cannot be `null`. |\n\n| Return ||\n|------------------------------|------------------------------|\n| [InferenceOutput.Builder](#) | This value cannot be `null`. |"]]