diff options
Diffstat (limited to 'contrib/lua-torch/nn/LogSoftMax.lua')
-rw-r--r-- | contrib/lua-torch/nn/LogSoftMax.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/contrib/lua-torch/nn/LogSoftMax.lua b/contrib/lua-torch/nn/LogSoftMax.lua new file mode 100644 index 000000000..37c8acae4 --- /dev/null +++ b/contrib/lua-torch/nn/LogSoftMax.lua @@ -0,0 +1,19 @@ +local LogSoftMax = torch.class('nn.LogSoftMax', 'nn.Module') + +function LogSoftMax:updateOutput(input) + input.THNN.LogSoftMax_updateOutput( + input:cdata(), + self.output:cdata() + ) + return self.output +end + +function LogSoftMax:updateGradInput(input, gradOutput) + input.THNN.LogSoftMax_updateGradInput( + input:cdata(), + gradOutput:cdata(), + self.gradInput:cdata(), + self.output:cdata() + ) + return self.gradInput +end |