diff options
author | Ronan Collobert <ronan@collobert.com> | 2012-01-25 17:55:20 +0400 |
---|---|---|
committer | Ronan Collobert <ronan@collobert.com> | 2012-01-25 17:55:20 +0400 |
commit | 4df3893abd1b9f840f1d9a8c1859799ccbf941de (patch) | |
tree | e8a1e1cc1b6ea6e47855347b157eaf419fdb357b /SoftShrink.lua |
initial revamp of torch7 tree
Diffstat (limited to 'SoftShrink.lua')
-rw-r--r-- | SoftShrink.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/SoftShrink.lua b/SoftShrink.lua new file mode 100644 index 0000000..379dc61 --- /dev/null +++ b/SoftShrink.lua @@ -0,0 +1,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 |