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

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

function TemporalMaxPooling:__init(kW, dW)
   parent.__init(self)

   dW = dW or kW
   
   self.kW = kW
   self.dW = dW

   self.indices = torch.Tensor()
end

function TemporalMaxPooling:updateOutput(input)
   input.nn.TemporalMaxPooling_updateOutput(self, input)
   return self.output
end

function TemporalMaxPooling:updateGradInput(input, gradOutput)
   input.nn.TemporalMaxPooling_updateGradInput(self, input, gradOutput)
   return self.gradInput
end

function TemporalMaxPooling: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