---
title: "encode(to:sourceArrays:resultState:destinationArray:)"
framework: metalperformanceshaders
role: symbol
role_heading: Instance Method
path: "metalperformanceshaders/mpsndarraymultiarykernel/encode(to:sourcearrays:resultstate:destinationarray:)"
---

# encode(to:sourceArrays:resultState:destinationArray:)

## Declaration

```swift
func encode(to cmdBuf: any MTLCommandBuffer, sourceArrays: [MPSNDArray], resultState outGradientState: MPSState?, destinationArray destination: MPSNDArray)
```
