function X = internal_crosschannelnorm(X, windowSize, alpha, beta, k)
% internal_crosschannelnorm    Perform the cross-channel normalization
%
%   Y = internal_crosschannelnorm(X, windowSize, alpha, beta, k) computes the
%   channel normalized version Y of X using the parameters specified by
%   windowSize, alpha, beta and k.
%
%   Inputs: 
%   X          - The input feature channels in form of a (S)x(S)x(C)x(B)
%                gpuArray. 
%   windowSize - The number of neighboring channels to use for the
%                normalization of each element.
%   alpha      - Multiplier for the normalization term.
%   beta       - Exponent for the normalization term.
%   k          - Offset for the normalization term.
%
%   Output: 
%   Y          - The output feature channels in form of a (S)x(S)x(C)x(B)
%                gpuArray.

%   Copyright 2019-2021 The MathWorks, Inc.

if ~isreal(X) || ~isreal(alpha) || ~isreal(beta) || ~isreal(k)
    error(message('deep:dlarray:ComplexNotSupported'))
end

X = nnet.internal.cnngpu.localMapNormForward2D(X, windowSize, alpha, beta, k);

end
