aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/lua-torch/nn/LogSoftMax.lua
blob: 37c8acae45302321ed69121e95863f2baf3bfc74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
local LogSoftMax = torch.class('nn.LogSoftMax', 'nn.Module')

function LogSoftMax:updateOutput(input)
   input.THNN.LogSoftMax_updateOutput(
      input:cdata(),
      self.output:cdata()
   )
   return self.output
end

function LogSoftMax:updateGradInput(input, gradOutput)
   input.THNN.LogSoftMax_updateGradInput(
      input:cdata(),
      gradOutput:cdata(),
      self.gradInput:cdata(),
      self.output:cdata()
   )
   return self.gradInput
end