---
title: "encode(commandBuffer:sourceImage:convolutionGradientState:destinationState:destinationStateIsTemporary:)"
framework: metalperformanceshaders
role: symbol
role_heading: Instance Method
path: "metalperformanceshaders/mpscnnconvolutiontranspose/encode(commandbuffer:sourceimage:convolutiongradientstate:destinationstate:destinationstateistemporary:)"
---

# encode(commandBuffer:sourceImage:convolutionGradientState:destinationState:destinationStateIsTemporary:)

## Declaration

```swift
func encode(commandBuffer: any MTLCommandBuffer, sourceImage: MPSImage, convolutionGradientState: MPSCNNConvolutionGradientState?, destinationState outState: AutoreleasingUnsafeMutablePointer<MPSCNNConvolutionTransposeGradientState?>, destinationStateIsTemporary isTemporary: Bool) -> MPSImage
```
