---
title: "executeForward(batchSize:options:outputsData:)"
framework: ML Compute
role: symbol
role_heading: Instance Method
platforms: [iOS 15.0+, iPadOS 15.0+, Mac Catalyst 15.0+, macOS 12.0+, tvOS 15.0+]
path: "mlcompute/mlctraininggraph/executeforward(batchsize:options:outputsdata:)"
---

# executeForward(batchSize:options:outputsData:)

Executes the forward pass of the training graph with the batch size, execution options, and output data you specify.

## Declaration

```swift
@discardableResult func executeForward(batchSize: Int, options: MLCExecutionOptions = [], outputsData: [String : MLCTensorData]? = nil) async throws -> (result: MLCTensor?, executionTime: TimeInterval)
```

## Parameters

- `batchSize`: The batch size.
- `options`: The execution options.
- `outputsData`: A dictionary that contains output data.

## Return Value

Return Value The result tensor, if any, and the execution time if you specify profiling.

## See Also

### Executing Forward, Gradient, and Optimizer Updates

- [executeForward(batchSize:options:completionHandler:)](mlcompute/mlctraininggraph/executeforward(batchsize:options:completionhandler:).md)
- [executeForward(batchSize:options:outputsData:completionHandler:)](mlcompute/mlctraininggraph/executeforward(batchsize:options:outputsdata:completionhandler:).md)
- [executeGradient(batchSize:options:completionHandler:)](mlcompute/mlctraininggraph/executegradient(batchsize:options:completionhandler:).md)
- [executeGradient(batchSize:options:outputsData:completionHandler:)](mlcompute/mlctraininggraph/executegradient(batchsize:options:outputsdata:completionhandler:).md)
- [executeGradient(batchSize:options:outputsData:)](mlcompute/mlctraininggraph/executegradient(batchsize:options:outputsdata:).md)
- [executeOptimizerUpdate(options:completionHandler:)](mlcompute/mlctraininggraph/executeoptimizerupdate(options:completionhandler:).md)
- [executeOptimizerUpdate(options:)](mlcompute/mlctraininggraph/executeoptimizerupdate(options:).md)
- [synchronizeUpdates()](mlcompute/mlctraininggraph/synchronizeupdates().md)
- [setTrainingTensorParameters(_:)](mlcompute/mlctraininggraph/settrainingtensorparameters(_:).md)
- [MLCExecutionOptions](mlcompute/mlcexecutionoptions.md)
- [MLCGraphCompletionHandler](mlcompute/mlcgraphcompletionhandler.md)
