---
title: "encodeForData(to:gradientMatrix:weightMatrix:resultGradientForDataMatrix:)"
framework: metalperformanceshaders
role: symbol
role_heading: Instance Method
path: "metalperformanceshaders/mpsmatrixfullyconnectedgradient/encodefordata(to:gradientmatrix:weightmatrix:resultgradientfordatamatrix:)"
---

# encodeForData(to:gradientMatrix:weightMatrix:resultGradientForDataMatrix:)

## Declaration

```swift
func encodeForData(to commandBuffer: any MTLCommandBuffer, gradientMatrix: MPSMatrix, weightMatrix: MPSMatrix, resultGradientForDataMatrix: MPSMatrix)
```
