aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/lua-torch/nn/SoftMax.lua
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/lua-torch/nn/SoftMax.lua')
-rw-r--r--contrib/lua-torch/nn/SoftMax.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/contrib/lua-torch/nn/SoftMax.lua b/contrib/lua-torch/nn/SoftMax.lua
new file mode 100644
index 000000000..23a444cf6
--- /dev/null
+++ b/contrib/lua-torch/nn/SoftMax.lua
@@ -0,0 +1,19 @@
+local SoftMax, _ = torch.class('nn.SoftMax', 'nn.Module')
+
+function SoftMax:updateOutput(input)
+ input.THNN.SoftMax_updateOutput(
+ input:cdata(),
+ self.output:cdata()
+ )
+ return self.output
+end
+
+function SoftMax:updateGradInput(input, gradOutput)
+ input.THNN.SoftMax_updateGradInput(
+ input:cdata(),
+ gradOutput:cdata(),
+ self.gradInput:cdata(),
+ self.output:cdata()
+ )
+ return self.gradInput
+end