---
title: "executeFunction(_:arguments:)"
framework: accelerate
role: symbol
role_heading: Instance Method
path: "accelerate/bnnsgraph/context/executefunction(_:arguments:)-95snr"
---

# executeFunction(_:arguments:)

Executes the specified function using an array of input and output pointers.

## Declaration

```swift
func executeFunction<T>(_ function: String? = nil, arguments: [T]) throws where T : BNNSGraph.PointerArgument
```

## Parameters

- `function`: The function. Specify as nil if the graph only contains one function.
- `arguments`: The output and input arguments. Note that the arguments may not be in the same order as the original mlpackage or mlmodelc file. Use the doc://com.apple.accelerate/documentation/Accelerate/BNNSGraph/Context/argumentPosition(forFunction:argument:) function to get the correct position in the arguments array for a given argument.

## See Also

### Executing a graph

- [executeFunction(_:arguments:)](accelerate/bnnsgraph/context/executefunction(_:arguments:)-8bhcn.md)
- [BNNSGraph.PointerArgument](accelerate/bnnsgraph/pointerargument.md)
