---
title: "encode(to:)"
framework: createml
role: symbol
role_heading: Instance Method
path: "createml/mlcheckpoint/encode(to:)"
---

# encode(to:)

Encodes the checkpoint into the encoder.

## Declaration

```swift
func encode(to encoder: any Encoder) throws
```

## Parameters

- `encoder`: The encoder to write data to.

## See Also

### Encoding and decoding a checkpoint

- [init(from:)](createml/mlcheckpoint/init(from:).md)
