# InferenceOutput.Builder

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Ctors](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput.Builder#pubctors)\|[Methods](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput.Builder#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput.Builder#inhmethods)  

# InferenceOutput.Builder

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/adservices/ondevicepersonalization/InferenceOutput.Builder "View this page in Kotlin")\|Java

`
public
static
final

class
InferenceOutput.Builder
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|--------------------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.adservices.ondevicepersonalization.InferenceOutput.Builder |

<br />

*** ** * ** ***

A builder for[InferenceOutput](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput)

## Summary

|                                                          ### Public constructors                                                           ||
|-----------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[Builder](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput.Builder#Builder())`() ` |

|                                                                                                                                                                                                                                                                                                                                                                    ### Public methods                                                                                                                                                                                                                                                                                                                                                                     ||
|------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[InferenceOutput.Builder](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput.Builder) | ` `[addDataOutput](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput.Builder#addDataOutput(int,%20java.lang.Object))`(int key, `[Object](https://developer.android.com/reference/java/lang/Object)` value) `                                                                                                                                                                                                                                                                                                                                                   |
| ` `[InferenceOutput](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput)                 | ` `[build](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput.Builder#build())`() ` Builds the instance.                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ` `[InferenceOutput.Builder](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput.Builder) | ` `[setData](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput.Builder#setData(byte[]))`(byte[] value) ` A byte array that holds input data.                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ` `[InferenceOutput.Builder](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput.Builder) | ` `[setDataOutputs](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput.Builder#setDataOutputs(java.util.Map<java.lang.Integer,java.lang.Object>))`(`[Map](https://developer.android.com/reference/java/util/Map)`<`[Integer](https://developer.android.com/reference/java/lang/Integer)`, `[Object](https://developer.android.com/reference/java/lang/Object)`> value) ` Note: use[InferenceOutput.Builder.setData(byte[])](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput.Builder#setData(byte[]))instead. |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public constructors

### Builder

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Builder ()
```

<br />

<br />

## Public methods

### addDataOutput

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public InferenceOutput.Builder addDataOutput (int key, 
                Object value)
```

<br />

<br />

|                      Parameters                       ||
|---------|----------------------------------------------|
| `key`   | `int` <br />                                 |
| `value` | `Object`: This value cannot be`null`. <br /> |

|                                                                                  Returns                                                                                  ||
|---------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [InferenceOutput.Builder](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput.Builder) | This value cannot be`null`. <br /> |

**See also:**

- [setDataOutputs(Map)](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput.Builder#setDataOutputs(java.util.Map<java.lang.Integer,java.lang.Object>))  

### build

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public InferenceOutput build ()
```

Builds the instance. This builder should not be touched after calling this!

<br />

|                                                                          Returns                                                                          ||
|-----------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [InferenceOutput](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput) | This value cannot be`null`. <br /> |

### setData

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public InferenceOutput.Builder setData (byte[] value)
```

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 Mapthat 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.

<br />

|                     Parameters                      ||
|---------|--------------------------------------------|
| `value` | `byte`: This value cannot be`null`. <br /> |

|                                                                                  Returns                                                                                  ||
|---------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [InferenceOutput.Builder](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput.Builder) | This value cannot be`null`. <br /> |

### setDataOutputs

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public InferenceOutput.Builder setDataOutputs (Map<Integer, Object> value)
```

Note: use[InferenceOutput.Builder.setData(byte[])](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput.Builder#setData(byte[]))instead.

A map mapping output indices to multidimensional arrays of output.

For TFLite, this field is mapped to outputs of runForMultipleInputsOutputs: https://www.tensorflow.org/lite/api_docs/java/org/tensorflow/lite/InterpreterApi#parameters_9

<br />

|                     Parameters                     ||
|---------|-------------------------------------------|
| `value` | `Map`: This value cannot be`null`. <br /> |

|                                                                                  Returns                                                                                  ||
|---------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [InferenceOutput.Builder](https://developer.android.com/reference/android/adservices/ondevicepersonalization/InferenceOutput.Builder) | This value cannot be`null`. <br /> |