---
title: MPSRNNMatrixTrainingLayer
framework: metalperformanceshaders
role: symbol
role_heading: Class
path: metalperformanceshaders/mpsrnnmatrixtraininglayer
---

# MPSRNNMatrixTrainingLayer

A layer for training recurrent neural networks on Metal Performance Shaders matrices.

## Declaration

```swift
class MPSRNNMatrixTrainingLayer
```

## Topics

### Initializers

- [init(coder:device:)](metalperformanceshaders/mpsrnnmatrixtraininglayer/init(coder:device:).md)
- [init(device:rnnDescriptor:trainableWeights:)](metalperformanceshaders/mpsrnnmatrixtraininglayer/init(device:rnndescriptor:trainableweights:).md)

### Instance Properties

- [accumulateWeightGradients](metalperformanceshaders/mpsrnnmatrixtraininglayer/accumulateweightgradients.md)
- [inputFeatureChannels](metalperformanceshaders/mpsrnnmatrixtraininglayer/inputfeaturechannels.md)
- [outputFeatureChannels](metalperformanceshaders/mpsrnnmatrixtraininglayer/outputfeaturechannels.md)
- [recurrentOutputIsTemporary](metalperformanceshaders/mpsrnnmatrixtraininglayer/recurrentoutputistemporary.md)
- [storeAllIntermediateStates](metalperformanceshaders/mpsrnnmatrixtraininglayer/storeallintermediatestates.md)
- [trainingStateIsTemporary](metalperformanceshaders/mpsrnnmatrixtraininglayer/trainingstateistemporary.md)

### Instance Methods

- [copy(with:device:)](metalperformanceshaders/mpsrnnmatrixtraininglayer/copy(with:device:).md)
- [createTemporaryWeightGradientMatrices(_:dataType:commandBuffer:)](metalperformanceshaders/mpsrnnmatrixtraininglayer/createtemporaryweightgradientmatrices(_:datatype:commandbuffer:).md)
- [createWeightGradientMatrices(_:dataType:)](metalperformanceshaders/mpsrnnmatrixtraininglayer/createweightgradientmatrices(_:datatype:).md)
- [createWeightMatrices(_:)](metalperformanceshaders/mpsrnnmatrixtraininglayer/createweightmatrices(_:).md)
- [encodeCopyWeights(commandBuffer:weights:matrixId:matrix:copyFromWeightsToMatrix:matrixOffset:)](metalperformanceshaders/mpsrnnmatrixtraininglayer/encodecopyweights(commandbuffer:weights:matrixid:matrix:copyfromweightstomatrix:matrixoffset:).md)
- [encodeForwardSequence(commandBuffer:sourceMatrices:destinationMatrices:trainingStates:weights:)](metalperformanceshaders/mpsrnnmatrixtraininglayer/encodeforwardsequence(commandbuffer:sourcematrices:destinationmatrices:trainingstates:weights:).md)
- [encodeForwardSequence(commandBuffer:sourceMatrices:sourceOffsets:destinationMatrices:destinationOffsets:trainingStates:recurrentInputState:recurrentOutputStates:weights:)](metalperformanceshaders/mpsrnnmatrixtraininglayer/encodeforwardsequence(commandbuffer:sourcematrices:sourceoffsets:destinationmatrices:destinationoffsets:trainingstates:recurrentinputstate:recurrentoutputstates:weights:).md)
- [encodeGradientSequence(commandBuffer:forwardSources:forwardSourceOffsets:sourceGradients:sourceOffsets:destinationGradients:destinationOffsets:weightGradients:trainingStates:recurrentInputState:recurrentOutputStates:weights:)](metalperformanceshaders/mpsrnnmatrixtraininglayer/encodegradientsequence(commandbuffer:forwardsources:forwardsourceoffsets:sourcegradients:sourceoffsets:destinationgradients:destinationoffsets:weightgradients:trainingstates:recurrentinputstate:recurrentoutputstates:weights:).md)
- [encodeGradientSequence(commandBuffer:forwardSources:sourceGradients:destinationGradients:weightGradients:trainingStates:weights:)](metalperformanceshaders/mpsrnnmatrixtraininglayer/encodegradientsequence(commandbuffer:forwardsources:sourcegradients:destinationgradients:weightgradients:trainingstates:weights:).md)

## Relationships

### Inherits From

- [MPSKernel](metalperformanceshaders/mpskernel.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)

## See Also

### Recurrent Neural Networks

- [MPSRNNImageInferenceLayer](metalperformanceshaders/mpsrnnimageinferencelayer.md)
- [MPSRNNMatrixInferenceLayer](metalperformanceshaders/mpsrnnmatrixinferencelayer.md)
- [MPSRNNSingleGateDescriptor](metalperformanceshaders/mpsrnnsinglegatedescriptor.md)
- [MPSGRUDescriptor](metalperformanceshaders/mpsgrudescriptor.md)
- [MPSLSTMDescriptor](metalperformanceshaders/mpslstmdescriptor.md)
- [MPSRNNSequenceDirection](metalperformanceshaders/mpsrnnsequencedirection.md)
- [MPSRNNMatrixTrainingState](metalperformanceshaders/mpsrnnmatrixtrainingstate.md)
