<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetalPerformanceShadersGraph",
  "identifier" : "/documentation/MetalPerformanceShadersGraph/MPSGraph/convolutionTranspose2D(_:weights:outputShape:descriptor:name:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal Performance Shaders Graph",
      "MetalPerformanceShadersGraph"
    ],
    "preciseIdentifier" : "c:objc(cs)MPSGraph(im)convolutionTranspose2DWithSourceTensor:weightsTensor:outputShape:descriptor:name:"
  },
  "title" : "convolutionTranspose2D(_:weights:outputShape:descriptor:name:)"
}
-->

# convolutionTranspose2D(_:weights:outputShape:descriptor:name:)

Creates a convolution transpose operation and returns the result tensor.

```
func convolutionTranspose2D(_ source: MPSGraphTensor, weights: MPSGraphTensor, outputShape: [NSNumber], descriptor: MPSGraphConvolution2DOpDescriptor, name: String?) -> MPSGraphTensor
```

## Parameters

`source`

input tensor

`weights`

weights tensor

`outputShape`

shape of the result tensor.

`descriptor`

descriptor for the corresponding forward 2D-convolution operation

`name`

name for the operation

## Return Value

A valid MPSGraphTensor object.

## Discussion

Convolution Tranpose operation is exactly the same as convolution gradint with respect to input image `convolution2DDataGradientWithIncomingGradient`.
Weights tensor and source tensors are interpreted as they are in `convolution2DDataGradientWithIncomingGradient`.
Convolution with stride `s` downsamples source tensor by factor `s` in spatial dimensions whereas convolution tranpose with stride `s` upsamples
source tensor by factor `s`. Convolution transpose can map the same source size to multiple destination sizes. The relationship between the width of the
source and the width of the destination is `(sourceWidth - 1)stride + 1 + (kernelWidth - 1)dilationRate <= destinationWidth + paddingLeft + paddingRight`
so there are stride -1 values of the width of the destination that give same width of the source. In order to disambiguate, outputShape parameter is used.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)