aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/torch/nn/Abs.lua
blob: b32b64f799d820fbd054c052de86c4b9f9bebcad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
local Abs, parent = torch.class('nn.Abs', 'nn.Module')

function Abs:__init()
   parent.__init(self)
end

function Abs:updateOutput(input)
   input.THNN.Abs_updateOutput(
      input:cdata(),
      self.output:cdata()
   )
   return self.output
end

function Abs:updateGradInput(input, gradOutput)
   input.THNN.Abs_updateGradInput(
      input:cdata(),
      gradOutput:cdata(),
      self.gradInput:cdata()
   )
   return self.gradInput
end