blob: 56f0b40e2ad7e3310f3d353614aa5548a7e585fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
local SpatialSoftMax, _ = torch.class('nn.SpatialSoftMax', 'nn.Module')
function SpatialSoftMax:updateOutput(input)
input.THNN.SoftMax_updateOutput(
input:cdata(),
self.output:cdata()
)
return self.output
end
function SpatialSoftMax:updateGradInput(input, gradOutput)
input.THNN.SoftMax_updateGradInput(
input:cdata(),
gradOutput:cdata(),
self.gradInput:cdata(),
self.output:cdata()
)
return self.gradInput
end
|