---
title: MLComputePolicy
framework: coreml
role: symbol
role_heading: Structure
path: coreml/mlcomputepolicy
---

# MLComputePolicy

The compute policy determining what compute device, or compute devices, to execute ML workloads on.

## Declaration

```swift
struct MLComputePolicy
```

## Topics

### Compute policies

- [cpuAndGPU](coreml/mlcomputepolicy/cpuandgpu.md)
- [cpuOnly](coreml/mlcomputepolicy/cpuonly.md)

### Creating a compute policy

- [init(_:)](coreml/mlcomputepolicy/init(_:).md)

### Default Implementations

- [CustomReflectable Implementations](coreml/mlcomputepolicy/customreflectable-implementations.md)
- [CustomStringConvertible Implementations](coreml/mlcomputepolicy/customstringconvertible-implementations.md)

## Relationships

### Conforms To

- [Copyable](swift/copyable.md)
- [CustomReflectable](swift/customreflectable.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [Hashable](swift/hashable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Compute plan

- [MLComputePlan](coreml/mlcomputeplan-1w21n.md)
- [MLModelStructure](coreml/mlmodelstructure-swift.enum.md)
- [withMLTensorComputePolicy(_:_:)](coreml/withmltensorcomputepolicy(_:_:)-8stx9.md)
- [withMLTensorComputePolicy(_:_:)](coreml/withmltensorcomputepolicy(_:_:)-6z33x.md)
