<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/BNNSGraph/Context/executeFunction(_:arguments:)-95snr",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate9BNNSGraphO7ContextC15executeFunction_9argumentsySSSg_SayxGtKAC15PointerArgumentRzlF"
  },
  "title" : "executeFunction(_:arguments:)"
}
-->

# executeFunction(_:arguments:)

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

```
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 [`argumentPosition(forFunction:argument:)`](/documentation/Accelerate/BNNSGraph/Context/argumentPosition(forFunction:argument:)) function to get the correct position in the `arguments` array for a given argument.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)