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

# executeFunction(_:arguments:)

Synchronously executes the specified function with the provided context.

## Declaration

```swift
func executeFunction(_ function: String? = nil, arguments: inout [BNNSTensor]) throws
```

## Parameters

- `function`: The specific function to execute. You may set this to nil if there is only one function.
- `arguments`: The output and input arguments.

## Discussion

Discussion If the underlying model contains dynamic shaped inputs or outputs, these must be set prior to calling this routine through a call to either setDynamicShapes(_:forFunction:) or setBatchSize(_:forFunction:). Don’t modify the shapes again until this routine has returned. The same context must only be used by a single thread at a time. note: BNNSGraphContextExecute
