blob: 2e223580a401b885965764e98b0d0e8a8b23b76b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
local SpatialAdaptiveAveragePooling, parent = torch.class('nn.SpatialAdaptiveAveragePooling', 'nn.Module')
function SpatialAdaptiveAveragePooling:__init(W, H)
parent.__init(self)
self.W = W
self.H = H
end
function SpatialAdaptiveAveragePooling:updateOutput(input)
input.THNN.SpatialAdaptiveAveragePooling_updateOutput(
input:cdata(),
self.output:cdata(),
self.W, self.H
)
return self.output
end
function SpatialAdaptiveAveragePooling:updateGradInput(input, gradOutput)
input.THNN.SpatialAdaptiveAveragePooling_updateGradInput(
input:cdata(),
gradOutput:cdata(),
self.gradInput:cdata()
)
return self.gradInput
end
-- for backward compat
function SpatialAdaptiveAveragePooling:empty()
self:clearState()
end
function SpatialAdaptiveAveragePooling:clearState()
return parent.clearState(self)
end
|