---
title: "encodeBatch(commandBuffer:sourceImages:labels:weights:destinationStates:destinationImages:)"
framework: metalperformanceshaders
role: symbol
role_heading: Instance Method
path: "metalperformanceshaders/mpsnnforwardloss/encodebatch(commandbuffer:sourceimages:labels:weights:destinationstates:destinationimages:)"
---

# encodeBatch(commandBuffer:sourceImages:labels:weights:destinationStates:destinationImages:)

## Declaration

```swift
func encodeBatch(commandBuffer: any MTLCommandBuffer, sourceImages: [MPSImage], labels: [MPSImage], weights: [MPSImage]?, destinationStates: [MPSState]?, destinationImages: [MPSImage])
```
