-
Notifications
You must be signed in to change notification settings - Fork 0
/
DagGatedsum2.m
31 lines (28 loc) · 996 Bytes
/
DagGatedsum2.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
classdef DagGatedsum2 < dagnn.ElementWise
properties
method = 'sum';
end
% properties (Transient)
% % storing hidden representation in the forward pass
% h = [];
% end
methods
function outputs = forward(obj, inputs, params)
if strcmp(obj.method, 'sum')
[outputs{1}] = Gated_sum_batch2(inputs, params{1});
else
[outputs{1}] = Gated_sum_batch2(inputs, params{1});
end
end
function [derInputs, derParams] = backward(obj, inputs, params, derOutputs)
if strcmp(obj.method, 'sum')
[derInputs, derParams{1}] = Gated_sum_batch2(inputs, params{1}, derOutputs{1});
else
[derInputs, derParams{1}] = Gated_sum_batch2(inputs, params{1}, derOutputs{1});
end
end
function obj = DagGatedsum2(varargin)
obj.load(varargin) ;
end
end
end