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

# encode(to:)

Encode a shaped array.

## Declaration

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

## Parameters

- `encoder`: The object to encode the shaped array.

## See Also

### Encoding and decoding

- [init(from:)](coreml/mlshapedarray/init(from:).md)
