function dZ = internal_reluBackward(dZ, Z)
% This function is undocumented and will change in a future release.

%   Copyright 2019-2022 The MathWorks, Inc.

% Note, this function gives the same answer whether X or Z is passed. Using
% Z instead of X consumes less memory for architectures like Resnet.

if ~isreal(dZ)
    error(message('deep:dlarray:ComplexGradientOutput', 'relu'));
end

dZ = nnet.internal.cnnhost.reluBackward(Z, dZ, Z);

end

