classdef GDN < dagnn.ElementWise
    
    properties
        gdnepsilon = 2e-10
        opts = {}
    end
    
    methods
        function outputs = forward(obj, inputs, params)
            outputs{1} = vl_nngdn(inputs{1}, params{1}, params{2}, [], 'gdnepsilon', obj.gdnepsilon, obj.opts{:}) ;
        end
        
        function [derInputs, derParams] = backward(obj, inputs, params, derOutputs)
            [derInputs{1}, derParams{1}, derParams{2}] =  vl_nngdn(inputs{1}, params{1}, params{2}, derOutputs{1}, 'gdnepsilon', obj.gdnepsilon, obj.opts{:}) ;
        end
        
        function obj = GDN(varargin)
            obj.load(varargin) ;
        end
    end
end
