Welcome to mirror list, hosted at ThFree Co, Russian Federation.

SpatialAdaptiveMaxPooling.lua - github.com/torch/nn.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 90af10f92d9630e07368287a61aa2f0491720de6 (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
local SpatialAdaptiveMaxPooling, parent = torch.class('nn.SpatialAdaptiveMaxPooling', 'nn.Module')

function SpatialAdaptiveMaxPooling:__init(W, H)
   parent.__init(self)
   
   self.W = W
   self.H = H

   self.indices = torch.Tensor()
end

function SpatialAdaptiveMaxPooling:updateOutput(input)
   input.nn.SpatialAdaptiveMaxPooling_updateOutput(self, input)
   return self.output
end

function SpatialAdaptiveMaxPooling:updateGradInput(input, gradOutput)
   input.nn.SpatialAdaptiveMaxPooling_updateGradInput(self, input, gradOutput)
   return self.gradInput
end

function SpatialAdaptiveMaxPooling:empty()
   self.gradInput:resize()
   self.gradInput:storage():resize(0)
   self.output:resize()
   self.output:storage():resize(0)
   self.indices:resize()
   self.indices:storage():resize(0)
end