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

SpatialMaxSampling.lua - github.com/clementfarabet/lua---nnx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d6dc5125bbb43aa51d297d42fd0fb33d538eb940 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
local SpatialMaxSampling, parent = torch.class('nn.SpatialMaxSampling', 'nn.Module')

function SpatialMaxSampling:__init(...)
   parent.__init(self)
   xlua.unpack_class(
      self, {...}, 'nn.SpatialMaxSampling',
      'resample an image using max selection',
      {arg='owidth', type='number', help='output width'},
      {arg='oheight', type='number', help='output height'}
   )
   self.indices = torch.Tensor()
end

function SpatialMaxSampling:updateOutput(input)
   input.nn.SpatialMaxSampling_updateOutput(self, input)
   return self.output
end

function SpatialMaxSampling:updateGradInput(input, gradOutput)
   input.nn.SpatialMaxSampling_updateGradInput(self, input, gradOutput)
   return self.gradInput
end