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

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

function SoftMin:updateOutput(input)
   self.mininput = self.mininput or input.new()
   self.mininput:resizeAs(input):copy(input):mul(-1)
   return input.nn.SoftMax_updateOutput(self, self.mininput)
end

function SoftMin:updateGradInput(input, gradOutput)
   self.mininput = self.mininput or input.new()
   self.mininput:resizeAs(input):copy(input):mul(-1)
   self.gradInput = input.nn.SoftMax_updateGradInput(self, self.mininput, gradOutput)
   self.gradInput:mul(-1)
   return self.gradInput
end