Welcome to mirror list, hosted at ThFree Co, Russian Federation.

LogSigmoid.lua - github.com/torch/nn.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cab848f4d7f54e7e1b48fb46ddb5e90bf3f12190 (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
local LogSigmoid, parent = torch.class('nn.LogSigmoid', 'nn.Module')

function LogSigmoid:updateOutput(input)
   self.buffer = self.buffer or input.new()
   input.THNN.LogSigmoid_updateOutput(
      input:cdata(),
      self.output:cdata(),
      self.buffer:cdata()
   )
   return self.output
end

function LogSigmoid:updateGradInput(input, gradOutput)
   input.THNN.LogSigmoid_updateGradInput(
      input:cdata(),
      gradOutput:cdata(),
      self.gradInput:cdata(),
      self.buffer:cdata()
   )
   return self.gradInput
end

function LogSigmoid:clearState()
   if self.buffer then self.buffer:set() end
   return parent.clearState(self)
end