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

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

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

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