<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetalPerformanceShadersGraph",
  "identifier" : "/documentation/MetalPerformanceShadersGraph/MPSGraphExecutable/run(with:inputs:results:executionDescriptor:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal Performance Shaders Graph"
    ],
    "preciseIdentifier" : "c:objc(cs)MPSGraphExecutable(im)runWithMTLCommandQueue:inputsArray:resultsArray:executionDescriptor:"
  },
  "title" : "run(with:inputs:results:executionDescriptor:)"
}
-->

# run(with:inputs:results:executionDescriptor:)

Runs the graph for the given feeds and returns the target tensor values, ensuring all target operations also executed.

```
func run(with commandQueue: any MTLCommandQueue, inputs inputsArray: [MPSGraphTensorData], results resultsArray: [MPSGraphTensorData]?, executionDescriptor: MPSGraphExecutableExecutionDescriptor?) -> [MPSGraphTensorData]
```

## Parameters

`commandQueue`

CommandQueue passed to exectute the graph on.

`inputsArray`

Feeds tensorData for the placeholder tensors, same order as arguments of main function.

`resultsArray`

Results tensorData for which the caller wishes MPSGraphTensorData to be returned.

## Return Value

A valid MPSGraphTensorData array with results synchronized to the CPU memory if MPSGraphOptionsSynchronizeResults set.

## Discussion

This call is synchronous and will return on completion of execution.

---

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)