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

Log.lua - github.com/torch/nn.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d7755d32b3e3196e7ae853358f3d948ef3788849 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
local Log, parent = torch.class('nn.Log', 'nn.Module')

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

function Log:updateOutput(input)
   self.output:resizeAs(input)
   self.output:copy(input)
   self.output:log()
   return self.output 
end

function Log:updateGradInput(input, gradOutput) 
   self.gradInput:resizeAs(input)
   self.gradInput:fill(1)
   self.gradInput:cdiv(input)
   self.gradInput:cmul(gradOutput)
   return self.gradInput
end