blob: ca17acffca96987070abc060a6ea4f30e114a645 (
plain)
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
|
local Abs, parent = torch.class('nn.Abs', 'nn.Module')
function Abs:__init(args)
parent.__init(self)
if args then
error(xlua.usage('nn.Abs',
'a simple component-wise mapping: abs()',
'abs = nn.Abs()\n'..
'rectified = abs:forward(sometensor)',
{type='nil', help='no arg required'}))
end
end
function Abs:forward(input)
input.nn.Abs_forward(self, input)
return self.output
end
function Abs:backward(input, gradOutput)
input.nn.Abs_backward(self, input, gradOutput)
return self.gradInput
end
function Abs:write(file)
parent.write(self, file)
end
function Abs:read(file)
parent.read(self, file)
end
|