blob: 0f189726b3a290370047e23c17b4699a9cb000ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
local JustElement, parent = torch.class('nngraph.JustElement', 'nn.Module')
function JustElement:__init()
self.gradInput = {}
end
-- The input is a table with one element.
-- The output the element from the table.
function JustElement:updateOutput(input)
assert(#input == 1, "expecting one element")
self.output = input[1]
return self.output
end
function JustElement:updateGradInput(input, gradOutput)
self.gradInput[1] = gradOutput
return self.gradInput
end
|