---
title: "run(with:feeds:targetTensors:targetOperations:)"
framework: metalperformanceshadersgraph
role: symbol
role_heading: Instance Method
path: "metalperformanceshadersgraph/mpsgraph/run(with:feeds:targettensors:targetoperations:)"
---

# run(with:feeds:targetTensors:targetOperations:)

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

## Declaration

```swift
func run(with commandQueue: any MTLCommandQueue, feeds: [MPSGraphTensor : MPSGraphTensorData], targetTensors: [MPSGraphTensor], targetOperations: [MPSGraphOperation]?) -> [MPSGraphTensor : MPSGraphTensorData]
```

## Parameters

- `commandQueue`: CommandQueue passed to exectute the graph on.
- `feeds`: Feeds dictionary for the placeholder tensors.
- `targetTensors`: Tensors for which the caller wishes MPSGraphTensorData to be returned.
- `targetOperations`: Operations to be completed at the end of the run.

## Return Value

Return Value A valid MPSGraphTensor : MPSGraphTensorData dictionary with results synchronized to the CPU memory.

## Discussion

Discussion This call blocks until execution has completed.
