aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/lua-torch/nn/LogSigmoid.lua
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/lua-torch/nn/LogSigmoid.lua')
-rw-r--r--contrib/lua-torch/nn/LogSigmoid.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/contrib/lua-torch/nn/LogSigmoid.lua b/contrib/lua-torch/nn/LogSigmoid.lua
new file mode 100644
index 000000000..cab848f4d
--- /dev/null
+++ b/contrib/lua-torch/nn/LogSigmoid.lua
@@ -0,0 +1,27 @@
+local LogSigmoid, parent = torch.class('nn.LogSigmoid', 'nn.Module')
+
+function LogSigmoid:updateOutput(input)
+ self.buffer = self.buffer or input.new()
+ input.THNN.LogSigmoid_updateOutput(
+ input:cdata(),
+ self.output:cdata(),
+ self.buffer:cdata()
+ )
+ return self.output
+end
+
+function LogSigmoid:updateGradInput(input, gradOutput)
+ input.THNN.LogSigmoid_updateGradInput(
+ input:cdata(),
+ gradOutput:cdata(),
+ self.gradInput:cdata(),
+ self.buffer:cdata()
+ )
+ return self.gradInput
+end
+
+function LogSigmoid:clearState()
+ if self.buffer then self.buffer:set() end
+ return parent.clearState(self)
+end
+