---
title: "encode(to:gradientMatrix:forwardOutputMatrix:resultMatrix:)"
framework: metalperformanceshaders
role: symbol
role_heading: Instance Method
path: "metalperformanceshaders/mpsmatrixsoftmaxgradient/encode(to:gradientmatrix:forwardoutputmatrix:resultmatrix:)"
---

# encode(to:gradientMatrix:forwardOutputMatrix:resultMatrix:)

## Declaration

```swift
func encode(to commandBuffer: any MTLCommandBuffer, gradientMatrix: MPSMatrix, forwardOutputMatrix: MPSMatrix, resultMatrix: MPSMatrix)
```
