---
title: "encodeForwardSequence(commandBuffer:sourceMatrices:destinationMatrices:trainingStates:weights:)"
framework: metalperformanceshaders
role: symbol
role_heading: Instance Method
path: "metalperformanceshaders/mpsrnnmatrixtraininglayer/encodeforwardsequence(commandbuffer:sourcematrices:destinationmatrices:trainingstates:weights:)"
---

# encodeForwardSequence(commandBuffer:sourceMatrices:destinationMatrices:trainingStates:weights:)

## Declaration

```swift
func encodeForwardSequence(commandBuffer: any MTLCommandBuffer, sourceMatrices: [MPSMatrix], destinationMatrices: [MPSMatrix], trainingStates: NSMutableArray, weights: [MPSMatrix])
```
