Method: Chainer::Functions::Pooling::AveragePooling2DGrad#forward

Defined in:
lib/chainer/functions/pooling/average_pooling_2d.rb

#forward(gy) ⇒ Object



51
52
53
54
55
56
57
58
59
60
# File 'lib/chainer/functions/pooling/average_pooling_2d.rb', line 51

def forward(gy)
  h, w  = @in_shape[2..-1]
  shape = gy[0].shape
  shape.insert(2, 1, 1)
  gcol = gy[0].reshape(*shape).tile(1, 1, @kh, @kw, 1, 1)

  gx = Chainer::Utils::Conv.col2im(gcol, @sy, @sx, @ph, @pw, h, w)
  gx /= @kh * @kw
  [gx]
end