---
title: "encode(commandBuffer:sourceImage:reshapedWidth:reshapedHeight:reshapedFeatureChannels:)"
framework: metalperformanceshaders
role: symbol
role_heading: Instance Method
path: "metalperformanceshaders/mpsnnreshape/encode(commandbuffer:sourceimage:reshapedwidth:reshapedheight:reshapedfeaturechannels:)"
---

# encode(commandBuffer:sourceImage:reshapedWidth:reshapedHeight:reshapedFeatureChannels:)

## Declaration

```swift
func encode(commandBuffer: any MTLCommandBuffer, sourceImage: MPSImage, reshapedWidth: Int, reshapedHeight: Int, reshapedFeatureChannels: Int) -> MPSImage
```
