<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetalPerformanceShadersGraph",
  "identifier" : "/documentation/MetalPerformanceShadersGraph/MPSGraph/depthwiseConvolution3D(_:weights: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)depthwiseConvolution3DWithSourceTensor:weightsTensor:descriptor:name:"
  },
  "title" : "depthwiseConvolution3D(_:weights:descriptor:name:)"
}
-->

# depthwiseConvolution3D(_:weights:descriptor:name:)

Creates a 3D depthwise convolution operation and returns the result tensor.

```
func depthwiseConvolution3D(_ source: MPSGraphTensor, weights: MPSGraphTensor, descriptor: MPSGraphDepthwiseConvolution3DOpDescriptor, name: String?) -> MPSGraphTensor
```

## Parameters

`source`

A 3D Image source as tensor - must be at least rank=4 (CDHW when channelDimensionIndex = -4).

`weights`

The weights tensor, must be rank=4 - axes are interpreted as CDHW when channelDimensionIndex = -4 .

`descriptor`

The descriptor object that specifies strides, dilation rates and paddings.

`name`

The name for the operation.

## Return Value

A valid MPSGraphTensor object

## Discussion

Works exactly like depthwise convolution2D, but in three dimensions. Supports different layouts with
the [`channelDimensionIndex`](/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution3DOpDescriptor/channelDimensionIndex) property.
If your weights need a different layout add a permute operation on them before this operation.

---

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)