Steganalysis/PhaseAwareNet_SRC/MatConvNet/matconvnet-1.0-beta20/matlab/vl_nnabs.m

20 lines
557 B
Mathematica
Raw Normal View History

2021-12-30 11:48:37 +00:00
function out = vl_nnabs(x,dzdy)
%VL_NNABS CNN ABS unit.
% Y = VL_NNABS(X) computes the absolute value of the data X. X can
% have an arbitrary size. The abs is defined as follows:
%
% ABS(X) = |X|.
%
% DZDX = VL_NNABS(X, DZDY) computes the derivative of the
% block projected onto DZDY. DZDX and DZDY have the same
% dimensions as X and Y respectively.
% Note, MATLAB built-in function ABS() and SIGN() are used because their
% support for gpuArray
if nargin <= 1 || isempty(dzdy)
out = abs( x ) ;
else
out = dzdy .* sign( x );
end