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

%   Copyright 2019 The MathWorks, Inc.

% Ensure all inputs have the same data type
[dZ, Z] = nnet.internal.cnnhost.castToSuperiorFloat(dZ, Z);

Z = nnet.internal.cnn.util.boundAwayFromZero(Z);

dZ = nnet.internal.cnnhost.softmaxBackward(Z, dZ, channelDim);

end

