---
title: "init(device:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:)"
framework: metalperformanceshaders
role: symbol
role_heading: Initializer
path: "metalperformanceshaders/mpscnnpooling/init(device:kernelwidth:kernelheight:strideinpixelsx:strideinpixelsy:)"
---

# init(device:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:)

Initializes a pooling filter.

## Declaration

```swift
init(device: any MTLDevice, kernelWidth: Int, kernelHeight: Int, strideInPixelsX: Int, strideInPixelsY: Int)
```

## Parameters

- `device`: The device the kernel will run on.
- `kernelWidth`: The width of the kernel. This value can be odd or even.
- `kernelHeight`: The height of the kernel. This value can be odd or even.
- `strideInPixelsX`: The output stride (downsampling factor) in the x dimension.
- `strideInPixelsY`: The output stride (downsampling factor) in the y dimension.

## Return Value

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

## See Also

### Instance Methods

- [init(coder:device:)](metalperformanceshaders/mpscnnpooling/init(coder:device:).md)
- [init(device:kernelWidth:kernelHeight:)](metalperformanceshaders/mpscnnpooling/init(device:kernelwidth:kernelheight:).md)
