---
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/mlcinferencegraph/compile(options:device:)"
---

# compile(options:device:)

Compiles the inference 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 Inference Graphs

- [addInputs(_:)](mlcompute/mlcinferencegraph/addinputs(_:).md)
- [addInputs(_:lossLabels:lossLabelWeights:)](mlcompute/mlcinferencegraph/addinputs(_:losslabels:losslabelweights:).md)
- [addOutputs(_:)](mlcompute/mlcinferencegraph/addoutputs(_:).md)
- [compile(options:device:inputTensors:inputTensorsData:)](mlcompute/mlcinferencegraph/compile(options:device:inputtensors:inputtensorsdata:).md)
- [link(with:)](mlcompute/mlcinferencegraph/link(with:).md)
- [MLCGraphCompilationOptions](mlcompute/mlcgraphcompilationoptions.md)
