A normalization kernel applied across feature channels.
SDKs
- iOS 10.0+
- macOS 10.13+
- Mac Catalyst 13.0+
- tvOS 10.0+
Framework
- Metal Performance Shaders
Declaration
@interface MPSCNNCrossChannelNormalization : MPSCNNKernel
Overview
The normalization kernel applies the kernel to a local region across nearby feature channels, but with no spatial extent (i.e., they have the shape kernel size x 1 x 1
). The normalized output is given by the function:

Where the normalizing factor is:

Where N
is the kernel size. The window Q(k)
itself is defined as:
![Q(k) = [max(0, k-floor(N/2)), min(D-1, k+floor((N-1)/2)]](https://docs-assets.developer.apple.com/published/866dd98e74/1b5a6df5-ed45-4f14-843e-ef3d621f4979.png)
Where k
is the feature channel index (running from 0 to D-1
) and D
is the number of feature channels, and the values of alpha
, beta
, and delta
are set via properties.
It is your responsibility to ensure that the combination of the values of the delta
and alpha
properties does not result in a situation where the denominator becomes zero - in such situations the resulting pixel-value is undefined.
Note
The encoding methods in the MPSUnary
class can be used to encode an MPSCNNCross
object to a MTLCommand
object.