---
title: "init(device:kernelWidth:kernelHeight:weights:)"
framework: metalperformanceshaders
role: symbol
role_heading: Initializer
path: "metalperformanceshaders/mpsimagepyramid/init(device:kernelwidth:kernelheight:weights:)"
---

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

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

## Declaration

```swift
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

Return Value A valid MPSImagePyramid object or nil, if failure.

## See Also

### Methods

- [init(device:)](metalperformanceshaders/mpsimagepyramid/init(device:).md)
- [init(device:centerWeight:)](metalperformanceshaders/mpsimagepyramid/init(device:centerweight:).md)
