---
title: "encodeBatch(commandBuffer:primaryImages:secondaryImages:destinationStates:destinationImages:)"
framework: metalperformanceshaders
role: symbol
role_heading: Instance Method
path: "metalperformanceshaders/mpscnnarithmetic/encodebatch(commandbuffer:primaryimages:secondaryimages:destinationstates:destinationimages:)"
---

# encodeBatch(commandBuffer:primaryImages:secondaryImages:destinationStates:destinationImages:)

## Declaration

```swift
func encodeBatch(commandBuffer: any MTLCommandBuffer, primaryImages: [MPSImage], secondaryImages: [MPSImage], destinationStates: [MPSCNNArithmeticGradientState], destinationImages: [MPSImage])
```
