---
title: cancel()
framework: coreml
role: symbol
role_heading: Instance Method
path: coreml/mltask/cancel()
---

# cancel()

Cancels a machine learning task before it completes.

## Declaration

```swift
func cancel()
```

## See Also

### Starting and stopping a task

- [resume()](coreml/mltask/resume().md)
