---
title: "encode(inputs:states:outputViews:to:)"
framework: coreai
role: symbol
role_heading: Instance Method
path: "coreai/inferencefunction/encode(inputs:states:outputviews:to:)"
---

# encode(inputs:states:outputViews:to:)

Encodes the inference to the provided compute stream, returning async values for the outputs.

## Declaration

```swift
func encode(inputs: [String : InferenceFunction.AsyncValue], states: consuming InferenceFunction.AsyncMutableViews = AsyncMutableViews(), outputViews: consuming InferenceFunction.AsyncMutableViews = AsyncMutableViews(), to stream: ComputeStream) throws -> [String : InferenceFunction.AsyncValue]
```
