Absolute Value Backward Layer

The absolute value (abs) activation layer applies the transform f(x) = abs(x) to the input data. The backward abs layer computes the value z = y * f'(x), where y is the input gradient computed on the prior layer and f'(x) = {1 if x > 0, 0 if x = 0, -1 if x < 0}.

Problem Statement

Given p-dimensional tensors X and Y of size n1 x n2 x ... x np, the problem is to compute a p-dimensional tensor Z = (zi1...ip) of size n1 x n2 x ... x np, where:

zi1...ip = yi1...ip * sign(xi1...ip)

For more complete information about compiler optimizations, see our Optimization Notice.
Select sticky button color: 
Orange (only for download buttons)