blob: a6292afb933f44492cca297e04f0f97e991df39d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
local Square, parent = torch.class('nn.Square', 'nn.Module')
function Square:__init(args)
parent.__init(self)
end
function Square:updateOutput(input)
input.THNN.Square_updateOutput(
input:cdata(),
self.output:cdata()
)
return self.output
end
function Square:updateGradInput(input, gradOutput)
input.THNN.Square_updateGradInput(
input:cdata(),
gradOutput:cdata(),
self.gradInput:cdata()
)
return self.gradInput
end
|