---
title: "compile(options:device:)"
framework: ML Compute
role: symbol
role_heading: Instance Method
platforms: [iOS 14.0+, iPadOS 14.0+, Mac Catalyst 14.0+, macOS 11.0+, tvOS 14.0+]
path: "mlcompute/mlctraininggraph/compile(options:device:)"
---

# compile(options:device:)

Compiles the training graph for the options and device you specify.

## Declaration

```swift
func compile(options: MLCGraphCompilationOptions = [], device: MLCDevice) -> Bool
```

## Parameters

- `options`: The compiler options.
- `device`: The device.

## Return Value

Return Value true if the operation was successful.

## See Also

### Preparing Training Graphs

- [addInputs(_:lossLabels:)](mlcompute/mlctraininggraph/addinputs(_:losslabels:).md)
- [addInputs(_:lossLabels:lossLabelWeights:)](mlcompute/mlctraininggraph/addinputs(_:losslabels:losslabelweights:).md)
- [addOutputs(_:)](mlcompute/mlctraininggraph/addoutputs(_:).md)
- [stopGradient(for:)](mlcompute/mlctraininggraph/stopgradient(for:).md)
- [compileOptimizer(_:)](mlcompute/mlctraininggraph/compileoptimizer(_:).md)
- [compile(options:device:inputTensors:inputTensorsData:)](mlcompute/mlctraininggraph/compile(options:device:inputtensors:inputtensorsdata:).md)
- [link(with:)](mlcompute/mlctraininggraph/link(with:).md)
- [allocateUserGradient(for:)](mlcompute/mlctraininggraph/allocateusergradient(for:).md)
- [MLCGraphCompilationOptions](mlcompute/mlcgraphcompilationoptions.md)
