Piecewise Linear Function

class td3a_cpp_deep.fcts.piecewise_linear.PiecewiseLinearFunction(*args, **kwargs)[source]

Implements a function similar to a piecewise linear function. It multiplies by different coefficient on negative and positive number. It takes a tensor of shape (N, 1).

class td3a_cpp_deep.fcts.piecewise_linear.PiecewiseLinearFunctionC(*args, **kwargs)[source]

Same function as PiecewiseLinearFunction but the implementation of forward and backward functions are done in C. See piecewise_linear_forward and piecewise_linear_backward. It follows the tutorial Custom C++ and Cuda Extensions.