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

# init(device:kernelWidth:kernelHeight:)

Initializes a spatial normalization kernel.

## Declaration

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

## Parameters

- `device`: The device the kernel will run on.
- `kernelWidth`: The width of the kernel.
- `kernelHeight`: The height of the kernel.

## Return Value

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

## Discussion

Discussion note: The value of kernelWidth must be equal to the value of kernelHeight.

## See Also

### Initializers

- [init(coder:device:)](metalperformanceshaders/mpscnnspatialnormalization/init(coder:device:).md)
