blob: 23a444cf6a37e9e760e8f030780707feeeb7533b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
|