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

# run(inputs:states:outputViews:)

Runs the function on the provided input arrays and returns the output values.

## Declaration

```swift
func run(inputs: [String : NDArray], states: consuming InferenceFunction.MutableViews = MutableViews(), outputViews: consuming InferenceFunction.MutableViews = MutableViews()) async throws -> InferenceFunction.Outputs
```

## Parameters

- `inputs`: A dictionary that maps input names to their doc://com.apple.coreai/documentation/CoreAI/NDArray values.
- `states`: The in-out arguments of the function, which the function reads and writes during inference. You must provide views for all states; omitting any state produces an error.
- `outputViews`: Pre-allocated output values that the function updates during inference. Outputs with a provided view are updated in-place and are not included in the returned doc://com.apple.coreai/documentation/CoreAI/InferenceFunction/Outputs. Outputs without a provided view produce new values in the returned doc://com.apple.coreai/documentation/CoreAI/InferenceFunction/Outputs.

## Return Value

Return Value The outputs from the function.

## Discussion

Discussion This is a convenience overload that accepts a dictionary of NDArray values instead of an InferenceFunction.Inputs collection. Any NDArray values in the returned outputs have a row-major contiguous layout.
