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

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

function SoftShrink:__init(lam)
   parent.__init(self)
   self.lambda = lam or 0.5
end

function SoftShrink:updateOutput(input)
   input.nn.SoftShrink_updateOutput(self, input)
   return self.output
end

function SoftShrink:updateGradInput(input, gradOutput)
   input.nn.SoftShrink_updateGradInput(self, input, gradOutput)
   return self.gradInput
end