-
Notifications
You must be signed in to change notification settings - Fork 0
/
DagGatedsum.m
32 lines (29 loc) · 932 Bytes
/
DagGatedsum.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
classdef DagGatedsum < dagnn.ElementWise
properties
method = 'sum';
end
% properties (Transient)
% % storing hidden representation in the forward pass
% h = [];
% end
methods
function outputs = forward(obj, inputs, ~)
if strcmp(obj.method, 'sum')
[outputs{1}] = Gated_sum_batch(inputs);
else
[outputs{1}] = Gated_sum_batch(inputs);
end
end
function [derInputs,derParams] = backward(obj, inputs, ~,derOutputs)
derParams=[];
if strcmp(obj.method, 'sum')
[derInputs] = Gated_sum_batch(inputs, derOutputs{1});
else
[derInputs] = Gated_sum_batch(inputs, derOutputs{1});
end
end
function obj = DagGatedsum(varargin)
obj.load(varargin) ;
end
end
end