<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.13.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetalPerformanceShaders",
  "identifier" : "/documentation/MetalPerformanceShaders/MPSImagePyramid/init(device:kernelWidth:kernelHeight:weights:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Metal Performance Shaders"
    ],
    "preciseIdentifier" : "c:objc(cs)MPSImagePyramid(im)initWithDevice:kernelWidth:kernelHeight:weights:"
  },
  "title" : "init(device:kernelWidth:kernelHeight:weights:)"
}
-->

# init(device:kernelWidth:kernelHeight:weights:)

Initialize a downwards n-tap image pyramid with a custom filter kernel and device.

```
init(device: any MTLDevice, kernelWidth: Int, kernelHeight: Int, weights kernelWeights: UnsafePointer<Float>)
```

## Parameters

`device`

The device the filter will run on.

`kernelWidth`

The width of the filter kernel.

`kernelHeight`

The height of the filter kernel.

`kernelWeights`

A pointer to an array of `kernelWidth*kernelHeight` values to be used as the kernel. These values are in row-major order.

## Return Value

A valid [`MPSImagePyramid`](/documentation/MetalPerformanceShaders/MPSImagePyramid) object or `nil`, if failure.

---

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)